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

Assign message policy not reading json variable properly

Not applicable

jsontestassignmessage-rev1-2016-03-21.zipI have Assign message policy which reads a header variable.The header variable is populated with json message.

While reading that header variable,Assign message policy is not reading once it encounters comma in the json message.How to solve this issue?

For this input below,

{ "Fruits": [ { "Name": "Apple",Count": "20"}, { "Name": "Mango",Count": "30"}] }

Assign message policy:

<AssignVariable> <Name>Fruit</Name> <Value/> <Ref>request.header.Fruit</Ref> </AssignVariable>

Output variable "Fruit":

{ "Fruits": [ { "Name": "Apple"

But when I provide input as,

{ "Name": "Apple"}

Output variable "Fruit":

{ "Name": "Apple"}

I have also attached the Proxy bundle.

Solved Solved
0 3 234
1 ACCEPTED SOLUTION

Generally if you provide value as a comma separated for HTTP header it means that you are providing array of a header .

so for example :

Cache-Control: no-cache, no-store

is equivalent to (order is important)

Cache-Control: no-cache

Cache-Control: no-store

Thus when you read the variable in apigee, it reads the part till comma.

View solution in original post

3 REPLIES 3
Top Solution Authors