Can we pass input query parameters using KVM policy?

Not applicable

Hi,

I am trying to use Apigee Edge online portal for my project. Is there any way to pass value for the input query parameters using any of the policies?

Thanks in Advance!

0 3 347
3 REPLIES 3

Hi @Vennila Pauldurai , yes we can use an Assign Message Policy & Set QueryParams as input.

<AssignMessage name="AssignMessage-3">
  <AssignTo createNew="true" type="request">request1</AssignTo>
  <Set>
    <QueryParams>
      <QueryParam name="address">{request.queryparam.pincode}</QueryParam>
      <QueryParam name="type">custom-value</QueryParam>
    </QueryParams>
    <Verb>GET</Verb>
  </Set>
  <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
</AssignMessage>

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

Hi @Siddharth Barahalikar,

Thanks for your input!

In your example, address is expecting value from query parameter.

I want to set the value using KVM and to refer the same in Assign Message Policy. Is it doable? or is there any other way to achieve this?

Thanks in Advance!

Yes, it is doable. You need to use a KVM Policy before Assign Message & get the value.

<KeyValueMapOperations mapIdentifier="FooKVM" async="false" continueOnError="false" enabled="true" name="GetKVM" mapIdentifier="KVM_name">
  <DisplayName>GetKVM</DisplayName>
  <ExpiryTimeInSecs>86400</ExpiryTimeInSecs>
  <Scope>environment</Scope>
  <Get assignTo="foo_variable" index="1">
    <Key>
      <Parameter>FooKey_1</Parameter>
    </Key>
  </Get>
</KeyValueMapOperations>
<AssignMessage name="AssignMessage-3">
  <AssignTo createNew="true" type="request">request1</AssignTo>
  <Set>
    <QueryParams>
      <QueryParam name="address">{foo_variable}</QueryParam>
      <QueryParam name="type">custom-value</QueryParam>
    </QueryParams>
    <Verb>GET</Verb>
  </Set>
  <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
</AssignMessage>