[REST Extender] How to use the OnAfterResponseAdvanced data 

[REST Extender] How to use the OnAfterResponseAdvanced data 

  
Forge Component
(1)
Published on 9 Feb by Hanno
1 vote
Published on 9 Feb by Hanno

On a cloud platform (.net 10.0.405)  i consume an RestApi and during runtime I want to see to wich endpoint the request was done. As a base i used the Rest_extender from Hanno and added an GetRequestUrl to it. Now when i'm in a breakpoint I see the right value in the GetRequestUrl but i have no clue how to get this value in the calling function. Found 1 example where a site property was used but i assume this is not the way to go.

Hi Robert. 

A site property is definitely not the way to go. We stored the value in a session variable (Note: we don't have multiple requests going out at the same time) and that works quite well. 

Alternatively, you could persist the value to an entity if you are storing the requests. We have implemented this in a scenario where we needed to log the request details.

Hope this helps.

Regards
Hanno

Hello Hanno,

Thanks for the quick response this works fine (the solution with the session) I only have to check it with more requests after each one (so will there be an session for each request) I want to store it to an entity but I store the request and the response with the Id of the request and in the OnAfterResponseAdvanced i'm not aware of this ID

Regards Robert.

Robert, we have also found the disconnect between the request and response to be a bit of a pain. Unfortunately, we haven't found a way around it. I'm not sure if there is something deeper in the request/response details that we can dig into to actually get a link between the two.

Hanno, It looks like for every process i'm running (the API gets called from a process) the session variable is new. So for me it works fine with the session variables. Again thanks for youre quick reply.

Greeting Robert.