Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to modify request verb from POST to GET?

I tried using the AssignMessage Policy below

<AssignMessage name="AssignMessage-3">
  <AssignTo createNew="true" type="request">request1 </AssignTo>
  <Add>
    <QueryParams>
        <QueryParam name="ql">select password where username='{proxy.username}'</QueryParam>
    </QueryParams> 
</Add> 
    <AssignVariable>
        <Name>request.verb</Name>
      <Value>GET</Value>
    </AssignVariable>
  <AssignVariable>
        <Name>target.url</Name>
        <Value>https://api.usergrid.com/nagashree.b/digitalbranch/appusers</Value>
    </AssignVariable>
  <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
</AssignMessage>

Couldnt get it to work. Tried javascript callout on the target endpoint as well.Couldnt get that to work as well. Any pointers if i am missing something or doing something really stupid?

var username = context.getVariable("apigee.username");  

var targeturl = "https://api.usergrid.com/nagashree.b/digitalbranch/appusers";


targeturl = targeturl+"?ql=select password where username='"+username+"'"; conte
xt.setVariable('target.url', targeturl);


context.setVariable('target.verb', 'GET');
Solved Solved
0 4 7,708
1 ACCEPTED SOLUTION

Resolved it. Seems very silly, I had no content-type header set in the POST request :(. Lost close to 3 hours due to that.

View solution in original post

4 REPLIES 4
Top Solution Authors