Reputation: 9648
I'm trying to use a key/value map operation on apigee edge but I can't seem to get any variables. I've since figured out that I have created an organization level key/value but I still can't figure out how to get the values. The data I created was from the samples and looks as follows:
{
"entry": [
{
"name": "Development",
"value": "65.87.18.18"
},
{
"name": "Staging",
"value": "65.87.18.22"
}
],
"name": "ipAddresses"
}
I've configured my policy up like so
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="Key-Value-Map-Operations-1" mapIdentifier="ipAddresses">
<DisplayName>Key Value Map Operations 1</DisplayName>
<FaultRules/>
<Properties/>
<ExclusiveCache>false</ExclusiveCache>
<ExpiryTimeInSecs>-1</ExpiryTimeInSecs>
<Get assignTo="myvar" index="1" >
<Key>
<Parameter ref="entry.Development"></Parameter>
</Key>
</Get>
<Scope>organization</Scope>
</KeyValueMapOperations>
But whenever I run a trace on this, myVar is always empty. I've tried various values for the Parameter ref such as
But nothing seems to work. Any suggestions? Do I need a basic auth header in there somewhere?
I've even tried doing this on an apiproxy scope and seeding the map at the same time, but even this doesn't return anything. And this is using the defaults from the policy!
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="Key-Value-Map-Operations-2" mapIdentifier="newkey">
<DisplayName>Key Value Map Operations 2</DisplayName>
<FaultRules/>
<Properties/>
<ExclusiveCache>false</ExclusiveCache>
<ExpiryTimeInSecs>-1</ExpiryTimeInSecs>
<InitialEntries>
<Entry>
<Key>
<Parameter>k1</Parameter>
</Key>
<Value>v1</Value>
</Entry>
<Entry>
<Key>
<Parameter>k2</Parameter>
</Key>
<Value>v3</Value>
<Value>v4</Value>
</Entry>
</InitialEntries>
<Get assignTo="mynewvar" index="1">
<Key>
<Parameter ref="k1"></Parameter>
</Key>
</Get>
<Scope>apiproxy</Scope>
</KeyValueMapOperations>
I can't help but think I'm missing something really obvious, or I've totally misunderstood the concept of the maps
Upvotes: 1
Views: 484
Reputation: 9648
For anyone else who has this problem, the issue was I was using
<Parameter ref="k1"></Parameter>
To retrieve the value when in fact it should be
<Parameter>k1</Parameter>
Upvotes: 3