Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

adding a value to kvm

I am pretty new to APIGEE and I am trying to use the KVM to store and retrieve some credentials. I will worry about encrypting the values at some point. Now I just want to store the values and be able to retrieve them later.

I have a post operation that I am calling to add a value to the KVM. It is returning with a success (200). I am then calling a GET operation to try and retrieve the value. It is returning a blank as it says it is undefined.

Here is the POST Flot

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="Add-KVM" mapIdentifier="TestKVM">
    <DisplayName>Add TestKVM</DisplayName>
    <Properties/>
    <ExclusiveCache>false</ExclusiveCache>
    <ExpiryTimeInSecs>-1</ExpiryTimeInSecs>
    <Put>
        <Key>
            <Parameter ref="testKey1"/>
        </Key>
        <Value>testValue1</Value>
    </Put>
    <Scope>environment</Scope>
</KeyValueMapOperations>

Here is the GET Flow

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="Get-KVM" mapIdentifier="TestKVM">
    <DisplayName>Get TestKVM</DisplayName>
    <Properties/>
    <ExclusiveCache>false</ExclusiveCache>
    <ExpiryTimeInSecs>-1</ExpiryTimeInSecs>
    <Get assignTo="kvmValue">
        <Key>
            <Parameter ref="testKey1"/>
        </Key>
    </Get>
    <Scope>environment</Scope>
</KeyValueMapOperations>

When I reference the kvmValue value in an assign message step in the response, I get a blank value.

Why is that? Any help would be greatly appreciated.

Solved Solved
1 7 1,742
1 ACCEPTED SOLUTION

Hi @Jamie Beauchamp,

In you populate cache policy you have used a parameter with a reference variable testKey1, where the value contained in this variable will be used to create a key in KVM.

<Parameter ref="testKey1"/>

If you want to give the parameter name as "testKey1" then use it as below in both of the cache policies.

<Parameter>testKey1</Parameter>

Hope this helps, Cheers!

View solution in original post

7 REPLIES 7