I have a service on Azure APIM have a parameter Token .
the client should provide the token value . and I want to show token value in the response , How it is going to be ?
<policies>
<inbound>
<base />
</inbound>
<backend>
<base />
</backend>
<outbound>
<set-variable name="token" value="@(token)" />
</outbound>
<on-error>
<base />
</on-error>
I have used the below policy to write the token value in response.
<outbound>
<base />
<set-variable name="token" value="@(context.Request.Headers.GetValueOrDefault("token"))" />
<set-body>@("Token: "+ ((string)context.Variables["token"]))</set-body>
</outbound>
Please make sure to pass the token value in Header.
In this way, you can pass the token value in response.