126
Views
6
Comments
Getting RequestText set in OnRequest in Exposed API
Question
Application Type
Reactive
Service Studio Version
11.53.21 (Build 61476)

I am exposing an API and using OnRequest to preprocess some data. I have set it to Request.RequestText but how do I retrieve this data from the API methods?

I have tried using GetRequestContent from HTTPRequestHandler Extension but to no avail.

2023-04-19 18-38-51
Bas de Jong

Hi Jeremy, you need to parse the RequestText with the JSON deserializer. I would recommend debugging to find the exact formatting of the JSON, then create a structure for it. 


You can then make your changes and after that you can serialize again to execute the rest of the request.

2022-08-26 05-45-19
Jeremy Kuang

Hmmm. But how do I get the Request from the API Methods? I am trying to get the data that is set to Request.RequestText, which in turn is set to the output parameter CustomizedRequest in the OnRequest Callback

The below is OnRequest

2023-04-19 18-38-51
Bas de Jong


Just use the input parameter in this OnRequest action:

2022-08-26 05-45-19
Jeremy Kuang

Yes, this Input Parameter is in the OnRequest API and I have set CustomizedRequest = Request. So the question is... how do I retrieved CustomizedRequest (or event Requst) from the API methods? In the particular case, it will be "EmailStatus".


2021-10-09 07-57-44
Stefan Weber
 
MVP

Hi

You can simply add an input parameter named eg. Request and set its data type to Text. That parameter will hold the complete Body text then. If your request is a json document you can also set Request to a Data structure with configured Name in JSON settings.

Best

Stefan

2025-11-14 08-42-31
Diogo Coelho

Any update on this question ? having the same question

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