This is how I assigned
context.setVariable("response.content", response);
but in the trace session i could fine response.content =""org.mozilla.javascript.Undefined@*******:
Solved! Go to Solution.
Multiple issues found in your proxy ,
var result; context.setVariable("result",JSON.stringify(employees)); context.setVariable("response.content", result);
Above code actually assign empty variable "result" to "response.content"
It should be,
context.setVariable("result",JSON.stringify(employees)); context.setVariable("response.content", context.getVariable("result"));
Find more about same in docs here,
respcontent-rev2-2016-06-21.zip
Sample API call,
curl -X POST -H "Cache-Control: no-cache" -H "Postman-Token: c693e22c-d223-093a-0031-13f792caf87d" -d '{"accountingFrom": [ { "firstNameFrom" : "Johnny", "lastNameFrom" : "Doe", "ageFrom" : 23 }, { "firstNameFrom" : "Mary", "lastNameFrom" : "Smith", "ageFrom" : 32 } ] }' "http://anildevportal-test.apigee.net/sample"
Hope it helps, Keep us posted moving forward if any query regarding Apigee.