Saturday, September 12, 2020

SAP API Management - Conditional Flow

Scenario: Client always wants response in XML format. Now, if client sends GET request to /json path, target system sends a JSON response. So, there should be a conversion rule to convert JSON to XML before sending response back to the client.

Sample JSON Payload returned from Target:

{"firstName":"John","lastName":"Doe","city":"San Jose","state":"CA"}

Steps:
1. Create a conditional Flow and specify condition for executing the flow.


Condition String:

(proxy.pathsuffix MatchesPath "/json") and (request.verb = "GET")

2. Add JSONToXML conversion policy to the conditional flow.

3. Test the API Proxy with path /json





No comments:

Post a Comment