Get Header from Request Received from Client

Not applicable

Hello,

I want get Content-Type from Header but in Request from client is application/json but after to convert json to xml the content-type change but i want take the first content-type the Request from client.

6554-req1.png

6555-req2.png

Thanks.

0 3 2,971
3 REPLIES 3

Hi @Josh iQu

You can store the header in a flow variable using Assign Message policy

<AssignVariable>
  <Name>reqContentType</Name>
  <Ref>request.header.Content-Type</Ref>
</AssignVariable>

and use this where ever you want. Make sure this policy executes before the JSON to XML policy

Same can be done using extract variable policy as well. Both work, question is when to use which ? Any recommendations ?

Doesn't matter. Choose which feels right to you.

ExtractVariable I think of as a thing that "Extracts" information from some larger set.

AssignVariable with the Ref element is just a simple way to copy the state of a variable. I prefer that. Your preference might be different.