Get header values from the REST request.

Hi,
I am exposing a REST service.
I need to store the values that are being passed in header by the rest call by client.
I tried to use the GetRequestHeader action in HttpRequestHandler, but that has to be done to get all the headers individually.
I also tried getRequestContent, but it returns the data in raw(text)  format. So a definite structure cannot be made, since the headers may vary for diff apis.
Is there any way I could get the headers in a simpler way (a common action is needed since it is to be used across other API's.)

thanks,
Anagha

The only solution I can think of is to use GetRequestContent, strip out the Headers. Create a generic list (key-value struct) from it, with HeaderName, HeaderValue.

That way the value is selectable using the headername.

An alternative solution would be to look up something on the forge, or create it yourself.

Joey Moree wrote:

The only solution I can think of is to use GetRequestContent, strip out the Headers. Create a generic list (key-value struct) from it, with HeaderName, HeaderValue.

That way the value is selectable using the headername.

An alternative solution would be to look up something on the forge, or create it yourself.

Hey,
The problem is that getRequestContent does not give the response in any particular format. We cannot just strip out the header, since the response is just a text.

Thanks,
Anagha


Hello Anagha Chikate,

You can get HTTP headers from the current web request via an extension.  I have published a Forge component to help with this: https://www.outsystems.com/forge/component-overview/5772/http-headers

Hope it helps!