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.
The Flow:
-
Capture the Request URL in a JavaScript policy using:
var endpoint = context.getVariable(“request.url”) || context.getVariable(“proxy.basepath”) + context.getVariable(“proxy.pathsuffix”);
-
Generate a Unique KVM Key (timestamp-based):
var requestLogKey = “log_” + new Date().getTime(); context.setVariable(“kvm.key”, requestLogKey);
-
Use the KeyValueMapOperations Policy to update the KVM with the captured URL value.
The Problem:
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:
KVM Update Update KVM entries dynamicallyWhat I have tried:
- Using JavaScript to capture the URL and generate a unique key.
- Trying to update the KVM with the captured URL value using the KeyValueMapOperations policy.
- Logs indicate that the key is being generated, but the value does not get updated in the KVM.
I would appreciate it if anyone could provide guidance on:
- Why the KVM value isn’t being updated.
- If there’s anything I might be missing in the flow or setup.