2
votes

I have imported an API to Azure APIM. I have to specify the header details on APIM. May I know, how can I do this ?

Note : I have tried adding policy for that API as mentioned on below URL, but this is static value. For my case I need to pass dynamic values/different values to header. https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/api-management/api-management-sample-send-request.md

Thanks, Infaaz

1
Share snippert of you code.. to better understand your questionPlanet-Zoom

1 Answers

1
votes

You can have dynamic headers in your APIM policy. We support expressions in policies

<set-header name="x-request-context-data" exists-action="override">
    <value>@(context.User.Id)</value>
</set-header>

from sample

please take a look at everything that is exposed on context object policy expressions context object

You can read about it Set HttpHeader policy