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! Go to 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.
To resolve that problem, I would suggest either:
Read about the last, here:
http://docs.apigee.com/api-services/reference/variables-reference
BUT, I don't understand why you would simply assign the value of one variable to another.
Why not just use the first variable?
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.