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.

embert
  • 7,336
  • 10
  • 49
  • 78
Schalk Keun
  • 538
  • 4
  • 13

1 Answers1

0

Ok,

I figured this one out also thanks to a fellow developer:

The problem was that the json object was encapsulated in the item{} object. This is incorrect. It should only be a single object of data like:

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

Schalk Keun
  • 538
  • 4
  • 13