Adding a Body to a GET REST call

0
Hi Fellow Makers,   Im working on a GET interface and I have a working example in Postman.       in Postman I can add a request body to a GET.  As far as I can see I cannot add anything to a GET request in Mendix, any ideas on how to add a body to a REST GET call in Mendix?  
asked
2 answers
2

Hi Han Pieter,

You might want to take a look at this question (and answer) on stackoverflow: https://stackoverflow.com/questions/978061/http-get-with-request-body

→ “So, yes, you can send a body with GET, and no, it is never useful to do so.”

→ “...if the request method does not include defined semantics for an entity-body, then the message-body SHOULD be ignored when handling the request.”

So, it might be possible, but should not be used.

answered
1

I see you’re trying to use SAP services. When performing a GET-call to – for example – the SAP Gateway endpoints, you should be able to pass data to that endpoint via URL-query. Examples:

  • sap/opu/odata/sap/ZGW_SERVICENAME/Entityname(‘00001’)
  • sap/opu/odata/sap/ZGW_SERVICENAME/EntitySetname?propertyname eq ‘A’
  • Edit: sap/opu/odata/sap/ZGW_SERVICENAME/EntitySetname works as well, will probably provide you the full list of data

Other data (for example auth-data) can be given in the HTTP Authorization-header. For example, a Basic Authentication with Base64 encryption could result in the header ‘Authorization’:’Basic c2ltY...’

Your Postman GET-requests works because Postman completely ignores your body you entered.

Hope this helps!

Kind regards,

Leander

answered