SOAP to REST: No able to extract query params

Not applicable

API to echo the input to the output.

  • Resource: echo
  • path: /echo
  • Policy that I have set-up to extract the query param:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" continueOnError="true" enabled="true" name="echo-extract-query-param">
  <DisplayName>echo Extract Query Param</DisplayName>
  <Source>request</Source>
  <QueryParam name="message">
  <Pattern ignoreCase="true">{message}</Pattern>
  </QueryParam>
  <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</ExtractVariables>

But for some reason, when I am making the following call.

http://sumitp27-test.apigee.net/ask/echo?message=h...

the query param is not getting extracted.

Any specific reason for the same.

0 4 657
4 REPLIES 4

Hi, @ Sumit Pathak As I dont know what is your use case exactly, I tried one modification in your policy.

<?xml version="1.0" encoding="UTF-8"?>
<ExtractVariables async="false" continueOnError="true" enabled="true" name="echo-extract-query-param">
    <DisplayName>echo Extract Query Param</DisplayName>
    <Source>request</Source>
    <QueryParam name="message">
        <Pattern>{message}</Pattern>
    </QueryParam>
    <VariablePrefix>queryprefix</VariablePrefix>
    <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
</ExtractVariables>

Added "queryprefix" as VariablePrefix element. So your variable will be referred as "queryprefix.message".

It works on my side Let me know if this solves your issue.

sarthak
Participant V

If you are just trying to get a query param you do not need to use extract variables policy.

You will be able to access it directly using the flow variable : request.queryparam.<paramName>

Learn more about the flow variables available here : http://apigee.com/docs/api-services/reference/variables-reference

Tried. Not working.

Can you please your entire API proxy?