mcdouchedy
Forum Replies Created
-
Forum: Plugins
In reply to: [Participants Database] API feature request? Return respons with recordID?Thanks Roland, indeed it’s working and there is everything I need. (I’d tried your example, but with the wrong route…) Thanks (and sorry) for your time,
-marc-
Forum: Plugins
In reply to: [Participants Database] API POST/PATCH doesn’t update (or create) the recordThanks 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.
{
"uri": "https://www.paragarage.be/wp-json/participants-database/v1/record/update/11",
"method": "POST",
"headers": {
"content-type": "multipart/form-data; boundary=separator",
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"connection": "keep-alive"
},
"authentication": {
"username": "McDouchedy",
"password": "*sanitized*",
"type": "Basic"
},
"body": "--separator\nContent-Disposition: form-data; name=\"make\"\n\nrebelie\n--separator--"
}Forum: Plugins
In reply to: [Participants Database] API POST/PATCH doesn’t update (or create) the recordOK, 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.
Here’s the output of another tool:
POST:
{
"uri": "https://www.paragarage.be/wp-json/participants-database/v1/record/add",
"method": "POST",
"headers": {
"accept": "*/*",
"Accept-Encoding": "gzip, deflate, br",
"Connection": "keep-alive",
"Content-Type": "application/json"
},
"authentication": {
"username": "McDouchedy",
"password": "*sanitized*",
"type": "Basic"
},
"body": {
"make": "Ozone",
"model": "Niviuk",
"serial": "1234"
}
}RESPONSE:
{
"statusCode": 200,
"headers": {
"Server": "nginx",
"Date": "Sat, 10 Aug 2024 05:53:09 GMT",
"Transfer-Encoding": "chunked",
"Connection": "keep-alive",
"Pragma": "no-cache",
"X-Robots-Tag": "noindex",
"Link": "<https://www.paragarage.be/wp-json/>; rel=\"https://api.w.org/\"",
"X-Content-Type-Options": "nosniff",
"Access-Control-Expose-Headers": "X-WP-Total, X-WP-TotalPages, Link",
"Access-Control-Allow-Headers": "Authorization, X-WP-Nonce, Content-Disposition, Content-MD5, Content-Type",
"Cache-Control": "no-store, must-revalidate, no-cache, max-age=0, private",
"Set-Cookie": "PHPSESSID=q6dam9rn4jj4lk1iv9p9icss2u; path=/",
"Content-Type": "application/json; charset=utf-8",
"Allow": "POST,PUT,PATCH",
"Expires": "Wed, 11 Jan 1984 05:00:00 GMT",
"Content-Length": "15"
},
"body": {
"record_id": 7
}
}EMPTY record created with id 7 ( not sure if you see the image ):
make model serial report validity Administrative Info Approved Record Info Last Updater Record ID read only Private ID Date Recorded
Delete the record:
{
"uri": "https://www.paragarage.be/wp-json/participants-database/v1/record/delete/7",
"method": "POST",
"headers": {
"accept": "*/*",
"Accept-Encoding": "gzip, deflate, br",
"Connection": "keep-alive",
"Content-Type": "application/json"
},
"authentication": {
"username": "McDouchedy",
"password": "*sanitized*",
"type": "Basic"
}
}Answer:
{
"statusCode": 200,
"headers": {
"Server": "nginx",
"Date": "Sat, 10 Aug 2024 05:58:35 GMT",
"Transfer-Encoding": "chunked",
"Connection": "keep-alive",
"Pragma": "no-cache",
"X-Robots-Tag": "noindex",
"Link": "<https://www.paragarage.be/wp-json/>; rel=\"https://api.w.org/\"",
"X-Content-Type-Options": "nosniff",
"Access-Control-Expose-Headers": "X-WP-Total, X-WP-TotalPages, Link",
"Access-Control-Allow-Headers": "Authorization, X-WP-Nonce, Content-Disposition, Content-MD5, Content-Type",
"Cache-Control": "no-store, must-revalidate, no-cache, max-age=0, private",
"Set-Cookie": "PHPSESSID=lvjj8o55un3s46rimkese84o30; path=/",
"Content-Type": "application/json; charset=utf-8",
"Allow": "POST,PUT,PATCH",
"Expires": "Wed, 11 Jan 1984 05:00:00 GMT",
"Content-Length": "4"
},
"body": true
}The result is that the record 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 1 year, 10 months ago by mcdouchedy. Reason: Image not visible