Get HTTP Status Code From Consume REST API And Pass On Another Module
Application Type
Reactive

Hi OS Community.

I want to get HTTP Status Code of My Consume REST Api (For example : 200, 400, etc ) and want to pass on another module where i will use this code in IF condition. I am using Consume REST API (Get Method) For Get Data From External URL. Where I made Two Module First one is Service Type Where API Call And Second One Where API Response Call On Screen. 

Want this Status Code on Another Module in Variable/structure

And want to use in this DataAction.

Champion

Hi,

  • You can add a manual extra attribute to the ResponseStructure of the API Action.
  • Now in the onAfterReponse; You can Deserialize the ResponseText
  • Set the Status [ Manually Added Attribute] by passing it the Header-StatusCode
  • Serialize the ResponseStructure again & update it on the InputResponse


PFA OML; I had used a public API & pass the Status from the Header to the Response & then further on Screen.

Sample URL :
https://assif.outsystemscloud.com/RestAPI/Sample?_ts=637654268948448356


Hope it helps;

Assif

RestAPI.oml

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