How to Dynamically add values to APIGEE Kvms when the number of entries depends on response array length

@Anil Sagar @ Google @Dino-at-Google

I have a requirement where in I'm getting array of objects as a response in apigee. these each objects i want to push to KVMs where in each object represents 1 KVM entry.

Suppose response is

Response = [{Key1: Value1},{Key2: Value2},{Key3: Value3}]

Seems I want to loop the KVM policy depending on the response length. Kindly assist.

0 2 339
2 REPLIES 2

You cannot do that with the KVM policy. As you know it can store a fixed number of items.

but you could change the way you’re modeling the problem and maybe reach a satisfactory solution.

Instead of storing each data item individually... just store the entire list as JSON. Store one JSON with your KVM policy. You can include as many values as necessary. (Up to a specified data size limit, which ... I don’t know. It’s documented though. And probably sufficient.)

Not applicable

Looping is not suggested in Apigee. If you want then you can create another api which takes key and value and suing the kvm put policy add to the kvm. Inside a javascript you can call that api in loop.

You can create the kvm frame and do one management api call to create the kvm with all the key and value pairs in only one api call.