How to add body content for REST API GET Method
Question
Application Type
Reactive
Service Studio Version
11.14.16 (Build 60354)

Hi All,


I'm trying to consume an REST API GET method and it requires body parameters to be passed for authenticating and then get the item. If I try without the body content in OutSystems I get 403 exception. 

Below is the method fallowed in postman and it is success (200 status). How can we achieve this is REST API GET method.?

Regards,

Vinod

Hey,

Inside logic tab,goto Integration section, under that go to api ,right click and choose consume option.popup will open and ask for single or multiple method to add,choose single if you want to consume individual. In input add api url ,choose type of api(get,post etc) and inside body add your Json formated data.then click on test button ,if you receive response then click on ok button button then outsystem will automatically create input object for your api.

https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/REST/Consume_REST_APIs

Hope you will understand. 

Thanks

Yogesh

Hi Yogesh, My issue is about passing parameters to GET method via a body which will initiate the authentication for the request and get item. As mentioned in the above snap.

Following.

Hi Vinod,

Please read below article about HttpGet method. Whatever API you are calling that have wrong implementation. For get API we can pass data in URL parameters or in headers for authentication.

https://reqbin.com/Article/HttpGet


Thanks

Vinod


Hi @Vinod Patidar,


I tried passing the data through header as below, but still I get 403 exception.

Issue here is even on the postman I have to first authenticate using POST and then use the GET method for positive result. If I directly execute the GET method it gives 403 error in postman too even though I provide authentication through header for GET method. 

POST URL:-

GET URL:-

 

As I executed in postman  (1st) POST to authenticate and (2nd) GET method for results I tried similar way in OutSystems REST API, first to authenticate and second to GET the results but the exception is still 403.

 Regards,

Vinod

  

Hi Vinod,

Are you getting success result after the first  (1st) POST to authenticate  SitecoreLogin API call If yes than add the response header of that success call to request of the second GET API call.

Mainly the .ASPXAUTH cookiee that sitecore returns after successful login to validate the next subsequent requests.

Hope this will help.

Best Regards

Devendra



Hi @Devendra Singh Baghel,

Below is the (1st) POST sitecore login API header output and GET request header input.

Login header output

Get Header input

I tried passing Post login header SetCookie output to Get request header input Cookie, but still I'm facing issue with 403 exception. Do I need to pass any other headers to GET request to authenticate from (1st) POST sitecore login.?


Regards,

Vinod

Hello Vinod, 

In the get method pass the no body and in the authentication pass the user credential which you are using to open
users application.
403 come for authentication

here we need to pass that

in this screen shot m not able to check the basic authentication that you need to pass 

you enabled the basic authentication that why pass this parameter and check.


hope this will helps. If not then you need to pass the URL and so at least you will get quick answer


Thanks and Regards,


Akshay Deshpande

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.