All is working well when using the API except when trying to create or change a record in the DB: the fields in the body of my request are not updated. It’s to say, the custom fields I created; some fields like ‘last modified’ are updated.
Any clue? I tried a lot, but without success. ( even the delete of a record works, so I guess I have enough privileges to do updates or create new records )
Postman: simplest call (POST or PATCH) to change a field ‘make’ of record 4 (which works very well in the admin console)
First, the API will only respond to POST or GET requests.
You don’t mention what the response code was, it should be a 200 if successful. If a POST request is not successful, you probably are not authorizing the request properly. This is explained in the documentation.
OK, I stick to POST and GET from now on. The response was/is still 200 for a POST ( to add or update a record ). When I authorize the request for a delete, it’s working: the empty record created with my previous add is deleted.
That’s why I think the authentication is ok. I only have one user on this setup and it’s also the admin. The possibility to make anonymous request is not enabled.
I have the impression that the fieldnames in my request doesn’t match the fields in the record, and that’s why the record is created and all the fields are empty but I took the output of a GET record and pasted the body into a POST. Is there something with the encoding that I should check? I already emptied the DB and started over again with a new one. I don’t know anymore what I should check or test… Any hints are welcome ??
This reply was modified 7 months, 2 weeks ago by mcdouchedy. Reason: Image not visible
Looking at the header, it looks like the content type should be set to “multipart/form-data”, you’re using “application/javascript” I don’t know if that is the problem, but that’s the only difference from what is working in my tests here.
Thanks a lot Mr Barker, this was indeed the problem. The syntax of the body is a bit more complex than with JSON, but it does the job and that’s the most important.