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

Cannot Change JSON Body Request

Hi,

I'm trying the Apigee Edge API / Development.

I want to change the body request on a POST API on proxyRequest, but unfortunately i can't.

i use this code

print("before");
print(context.proxyRequest.body) //PROXY_REQ_FLOW

var body = context.proxyRequest.body;
body.HelloFromApigee = "HelloFromApigee";
context.setVariable("context.proxyRequest.body", body);

print("after")
print(context.proxyRequest.body) //PROXY_REQ_FLOW

but the result is this

before
{
  "title": "pippo",
  "personId": "1111",
  "pyngCode": "11111",
  "iban": "11111",
  "tipoPagamento": "SDD",
  "insoluti" : [
  		{
  			"codFattura" : "11111",
  			"importoFattura" : "245",
  			"codiceContratto" :"AAAAA",
  			"numRiepilogo" : "123",
  			"dataFattura" : "20/02/2020",
  			"dataRepAddebito" : "29/02/2020"
  		}
  	]
  }
}

after
{
  "title": "pippo",
  "personId": "1111",
  "pyngCode": "11111",
  "iban": "11111",
  "tipoPagamento": "SDD",
  "insoluti" : [
  		{
  			"codFattura" : "11111",
  			"importoFattura" : "245",
  			"codiceContratto" :"AAAAA",
  			"numRiepilogo" : "123",
  			"dataFattura" : "20/02/2020",
  			"dataRepAddebito" : "29/02/2020"
  		}
  	]
  }
}

The body doesn't change, but it should, even if use the bracelet notation instead of dot. The flow is correctly setted. I'm missing something?

0 1 133
1 REPLY 1