Solved! Go to Solution.
Thank for the question, and the code. I see you've got a couple problems in that API Proxy. For one thing, the order of policies you ran was:
JavaScript-1 putUrl getUrl
The Javascript was the thing that incremented the value. But it was starting from zero always, so it always incremented 0, resulting in a 1. The KVM PUT then stored the value 1, and the KVM Get then retrieved the value of 1.
Running it again, the same thing happened. Always 1.
There were some other problems too. For example with the KVM operations - you were referring to a variable in the key parameter of urlencoding.requesturl.hashed. Like this:
<Parameter ref="urlencoding.requesturl.hashed"/>
the ref="..." indicates that the parameter is a variable. But no such variable exists in the context.
Anyway, I've fixed up an API proxy that demonstrates the use of the KVM to store an incremented value for each additional request. Find it attached. To use it, deploy it to any Edge org + env. The invoke it like this:
curl -i http://ORG-ENV.apigee.net/1080-kvm/t1you should see something like
{ "status" : true, "numalerts" : "4" }
...after the 4th invocation.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |