How to pass path params and query params in response payload?

Not applicable

How to pass path params and query params in response payload while creating apigee mock services on apigee edge?

0 2 3,661
2 REPLIES 2

@Naga Vadlapudi ,

Query Params are available for you as flow variables in the response. You can use them in Assign Message Policy to create the response payloads.

For Example, request.queryparam.{NAME OF QUERY PARAM} ,

Path Params, You need to extract from path variable, request.path using Extract Variable policy & Then use those extracted variables in Assign Message Policy to construct payload.

For more information,

https://docs.apigee.com/api-platform/reference/variables-reference

https://docs.apigee.com/api-services/reference/extract-variables-policy

https://docs.apigee.com/api-platform/reference/policies/assign-message-policy

Hope it helps.

-------------------------------

Anil Sagar

5997-screen-shot-2017-11-23-at-75916-pm.png Learn Apigee Concepts in 4 Minutes HandsOn

Thanks @Anil Sagar

I just want to post the approach which worked for me.

<?xml version="1.0" encoding="UTF-8"?>
<Flows>
   <Flow name="store-metrics">
      <Description />
      <Request />
      <Response>
<!--Assign response message only if condition satisfies-->
         <Step>
            <Name>Assign-Message-1</Name>
            <Condition>(request.queryparam.storeId=101)</Condition>
         </Step>
<!--get param from query param in the request-->
         <Step>
            <Name>Extract-Variables-1</Name>
         </Step>
      </Response>
      <Condition>(proxy.pathsuffix MatchesPath "/stores") and (request.verb = "GET")</Condition>
   </Flow>
</Flows>