Hello,
I have been trying to dynamically capture the URL of incoming requests and then update a Key-Value Map (KVM) in Apigee with that captured URL, but I'm encountering issues when attempting to update the KVM.
While the URL is being captured successfully, when I try to update the KVM using the KeyValueMapOperations policy, the KVM is not being updated with the captured value. The logs show that the key is being created, but the value is not being updated.
I’m using the following approach to update the KVM:
I would appreciate it if anyone could provide guidance on:
Solved! Go to Solution.
Possibly the values in the KVM may not permit slashes. Or colons. ?
one way to avoid this problem is to encode the URL (base64 encode?) before inserting it into the KVM. Can you try that and see?
Of course you would need to decode the value after retrieval, as well.
There are functions available in the Message template that can help with this. So you can do something like this:
<AssignMessage name="AM-Encode-Variable">
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignVariable>
<Name>encoded_url</Name>
<Template>{encodeBase64(extracted_url)}</Template>
</AssignVariable>
</AssignMessage>
Possibly the values in the KVM may not permit slashes. Or colons. ?
one way to avoid this problem is to encode the URL (base64 encode?) before inserting it into the KVM. Can you try that and see?
Of course you would need to decode the value after retrieval, as well.
There are functions available in the Message template that can help with this. So you can do something like this:
<AssignMessage name="AM-Encode-Variable">
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignVariable>
<Name>encoded_url</Name>
<Template>{encodeBase64(extracted_url)}</Template>
</AssignVariable>
</AssignMessage>