on ‎2018 Jul 24 9:44 PM
Hi, I'm testing the api managment service and I'm having trouble doing the following:
I need to include a special header in the request flow, How should I perform this operation? Maybe with script policy preflow?
Any idea how I could do this operation? Thnks
Request clarification before answering.
Hello Rodrigo,
you can use the "AssignMessage" Policy to do so.
Simply add a new policy into you pre-flow/conditional flow/post-flow, in the request.
If you are not sure where to place the policy, check Elijah's great blog on flows. At the beginning it may look complicated, but it is pretty simple and gives you great power!
https://blogs.sap.com/2016/03/17/sap-api-management-understanding-policy-flow/
And here is a simple example of the Assign Message policy:
<AssignMessage async="false" continueOnError="false" enabled="true" xmlns='http://www.sap.com/apimgmt'>
<Add>
<Headers>
<Header name="X-SvenTest">Test</Header>
</Headers>
</Add>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>
And here the link to the documentation for more detailed information!
Cheers,
Sven
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello again,
yes, this is absolutely feasible.
To do so, you would use a Service Callout policy, an Extract Variable policy and then an Assign Message policy again.
The Service Callout policy calls the external API.
The Extract Variable policy extracts the desired information from the response of the previous call.
The Assign Message policy does what you did first: assign a variable to a header.
I have documented it in detail in another blog:
https://blogs.sap.com/2016/10/11/sap-api-management-mash-api-proxy/
Hope this helps!
Sven
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.