Post request with parameters



  • KalelKalel Posts: 4Member
    You can do POST request by using my this code:


    Local Variables

    CallRESTWebService(BaseUrl : Text;Method : Text;RestMethod : Text;VAR HttpContent : DotNet "System.Net.Http.HttpContent";VAR HttpResponseMessage : DotNet "System.Net.Http.HttpResponseMessage")
    HttpClient := HttpClient.HttpClient();
    HttpClient.BaseAddress := Uri.Uri(BaseUrl);
    CASE RestMethod OF
        HttpResponseMessage := HttpClient.GetAsync(Method).Result;
        HttpResponseMessage := HttpClient.PostAsync(Method,HttpContent).Result;
        HttpResponseMessage := HttpClient.PutAsync(Method,HttpContent).Result;
        HttpResponseMessage := HttpClient.DeleteAsync(Method).Result;

    Explanation of the parameters

    BaseUrl – the first part of the url that is being called, e.g.:

    Method – the resource on the web service, in other words, the second part of the url, e.g. somecoolapi/parameter?option=value

    RestMethod – one of the request verbs, either GET, POST, PUT or DELETE

    HttpContent – the content to be sent with the POST or PUT command

    HttpResponseMessage – the response message containing the status code and the response body. This parameter is ByVar because the calling code needs to handle the specific response itself. That’s not part of the generic pattern.

    You have to put your data in HttpContent because you are using POST method. This is the correct way of sending parameters via post.

    Como ingreso mi blob en un http content?
Sign In or Register to comment.