Is there any way to store js variable into key value pair in javascript policy?
Alternatively you can create key-value in the form of json -
var mapVariable = {};
mapVariable.key1= "value1";
mapVariable.key2 = "value2"
request.setVariable("myMap", mapVariable)
1 Like
No.
The Apigee Edge KVM is accessible via the KeyValueMapOperations policy.
You can dynamically generate a value in JS, and then use that value in the KVM-Put.
<KeyValueMapOperations name='KVM-Put-1' mapIdentifier='nameOfMap'>
<Scope>environment</Scope>
<Put override='true'>
<Key>
<Parameter ref='variable.containing.key'/>
</Key>
<Value ref='variable.containing.value.to.store'/>
</Put>
<ExpiryTimeInSecs>60</ExpiryTimeInSecs>
</KeyValueMapOperations>
<br>
I think the question is about the Apigee Edge KVM.