0

I'm busy integrating onTime API to one of our clients website. All my API requests are successfull (GET, POST).

But for some reason POSTING a new /contacts just always give me:

Missing required fields: customer.id, first_name, last_name

Although they are there correctly inserted as per the API documentation. This is my json encoded data I'm posting:

{"item":{"customer":{"id":6},"first_name":"CUSTOMER_NAME","last_name":"CUSTOMER_SURNAME","email":"someemail@website.com","phone":"1231231234"}}

I'm out of ideas.

PS: I use an API class so the posting platform uses the same method throughout the project, and all my other posting of data works 100% it is just this action that is giving me issues.

4

1 回答 1

0

好的,

感谢一位开发人员,我也想出了这个:

问题是 json 对象被封装在 item{} 对象中。这是不正确的。它应该只是一个数据对象,例如:

{"customer":{"id":6},"first_name":"CUSTOMER_NAME","last_name":"CUSTOMER_SURNAME","email":"someemail@website.com","phone":"1231231234"}

于 2014-02-17T12:43:59.670 回答