How can I POST web api with nested json node using D365BC?

wolfskinwolfskin Member Posts: 84
Hi everyone,

Regarding this blog below.
http://vjeko.com/using-complex-types-with-custom-apis/


How can I POST this JSON to NAV's API page?
{
  "code": "HAC3",
  "make": "Honda2",
  "model": "Accord",
  "year": 2013,
  "registrationPlate": "GHI-789",
  "engine":
  [
	{
	  "type": "Gasoline",
	  "power": 210,
	  "displacement": 2400
	},
	{
	  "type": "Hybrid",
	  "power": 210,
	  "displacement": 2400
	}
  ]
}

I tried to POST json body from POSTMAN but got an error like this.

"code": "BadRequest",
"message": "A node of type 'StartArray' was read from the JSON reader when trying to read the contents of the property 'engine'; however, a 'StartObject' node or 'PrimitiveValue' node with null value was expected."


Thank you
Sign In or Register to comment.