Unable to remove entries from KeyValueMap using Update KeyValueMap API

I created a KVM "My_Test_KVM" with two entries

{
  "entry": [
    {
      "name": "Key1",
      "value": "value_one"
    },
    {
      "name": "Key2",
      "value": "value_two"
    }
  ],
  "name": "My_Test_Map"
}

Now I want to update the value of "Key1" as "ONE" and would like to delete the entry "Key2". So I used the "Update KeyValueMape in an Environment" API call - http://apigee.com/docs/management/apis/put/organi...

However, in the output, I see this

a) The value of "Key1" is updated to "ONE"

b) The entry "Key2" still exists

{
  "entry": [
    {
      "name": "Key1",
      "value": "ONE"
    },
    {
      "name": "Key2",
      "value": "value_two"
    }
  ],
  "name": "My_Test_Map"
}

Is this expected behaviour ?

Solved Solved
1 3 232
1 ACCEPTED SOLUTION

Not applicable

Hi there!

KVM update API updates an existing KeyValueMap in an environment and does not override the existing map. Instead, this method updates the entries if they exist or adds them if not. So, Update won't delete any entries of that map.

For deleting an individualKVM entry, please follow the below link.

http://apigee.com/docs/management/apis/delete/orga...

View solution in original post

3 REPLIES 3

I tried another thing that is add a new entry "Key3" along with "Key1" with the "Update KeyValueMap in an Environment" API call. It successfully added the new entry "Key3", but still the "Key2" continued to remain in the KeyValueMap.

Does this mean that we can't remove entries using the Update KeyValueMap API call ?

Should we always use "Delete the KeyValueMap Entry in an environment" to remove any unwanted entries ?

Not applicable

Hi there!

KVM update API updates an existing KeyValueMap in an environment and does not override the existing map. Instead, this method updates the entries if they exist or adds them if not. So, Update won't delete any entries of that map.

For deleting an individualKVM entry, please follow the below link.

http://apigee.com/docs/management/apis/delete/orga...

@archendra,

Thanks for your response. It confirms my interpretation of the Update KVM API documentation as well.

So we can use the Update KVM API calls for updating existing entries and adding any new entries. However, to delete any entries from the KVM, we need to use "Delete the KeyValueMap Entry in an environment" API call.