Hi,
I'm consuming a REST api with GET method, I want to send parameters via body not header, how can I do that, tried to add
SyntaxEditor Code Snippet
GetRequest_AddArgument
in onbeforeRequest
but I don't think this is the solution. any help with that?
Hi Abeer ElAssal,
Did you tried to send in request body a binary format? See if this article helps: https://www.outsystems.com/forums/discussion/36156/guide-consume-rest-api-with-form-url-encoded-request/
Marco Arede wrote:
Thanks for your reply, but the option of changing request format is not available
Abeer ElAssal,
(regarding service studio configuration) Using Postman is possible to define first as POST and then change the method to GET, seems that here we may be limited to send a request parameters in body of a GET, if I see a workaround I'll let you know.
But could you use POST instead of GET method for your scenario?
Using Postman is possible to define first as POST and then change the method to GET, seems that here we may be limited to send a request parameters in body of a GET, if I see a workaround I'll let you know.
I tried it using Postman, but it works as get, so i'm trying now with integration studio with this following this documentation | https://success.outsystems.com/Documentation/11/Reference/OutSystems_APIs/REST_Extensibility_API
but still confused on how to use the method void SetRequestBody(string text)
Abeer ElAssal wrote:
Put Your request method as GET the output parameter Receive In having options as HEADER and BODY by this way only you could send your parameters
Thanks And Regards
Soundarya.P
Soundarya P wrote:
Hi, thank for your reply, but when I let the method GET, and use inputparameter to send in body it triggers error saying it's not allowed
GET method should not rely on the contents of the body. This is specified in the HTTP protocol. See: https://stackoverflow.com/questions/978061/http-get-with-request-body
If you have ownership of the service, please change its method to POST or PUT, and you'll be fine. If it's a third-party service, contact their support and make clear to them that they are violating the HTTP standard, and therefore limiting the interoperability of their services.
Many web services will accept parameters in either the body OR the URL. Have you tried just putting the parameters in the URL where they should be for a GET?
As Leonardo said the HTTP standards do not allow body parameters to be passed in a GET request but it sometimes works because the web service uses the same code to extract the URL and body for both get and POST which is why you may be able to get away with it in postman.