POST request returns 500 cannot update item
-
Hello,
I am trying to use POST / PUT to update fields for products. However I am running into issues.
The situation:
- I have a post type called ‘product’
- I have an ACF field called ‘connected_suppliers’
- I am using this request with Postman: https://dev.site/wp-json/acf/v3/product/13/?connected_suppliers=21
The POST request however is giving me:
{ "code": "cant_update_item", "message": "Cannot update item", "data": { "status": 500 } }
When I start debugging, I kind of get stuck at
prepare_item_for_database()
It looks like$request
over there has no params under POST.The
WP_REST_Request
contains this:WP_REST_Request Object ( [method:protected] => POST [params:protected] => Array ( [URL] => Array ( [id] => 13 ) [GET] => Array ( [connected_suppliers] => 21 ) [POST] => Array ( ) [FILES] => Array ( ) [JSON] => [defaults] => Array ( ) ) [headers:protected] => Array ( [connection] => Array ( [0] => keep-alive ) [content_length] => Array ( [0] => 0 ) [accept_encoding] => Array ( [0] => gzip, deflate ) [host] => Array ( [0] => dev.site ) [accept] => Array ( [0] => */* ) [user_agent] => Array ( [0] => PostmanRuntime/7.4.0 ) [postman_token] => Array ( [0] => 7b0448d9-7de9-40a5-b776-a01e7bfe3b5a ) [cache_control] => Array ( [0] => no-cache ) ) [body:protected] => [route:protected] => /acf/v3/product/13 [attributes:protected] => Array ( [methods] => Array ( [POST] => 1 [PUT] => 1 [PATCH] => 1 ) [accept_json] => [accept_raw] => [show_in_index] => 1 [args] => Array ( ) [callback] => Array ( [0] => ACF_To_REST_API_Posts_Controller Object ( [acf:protected] => ACF_To_REST_API_ACF_API Object ( [id:protected] => [type:protected] => product [controller:protected] => ACF_To_REST_API_Posts_Controller [field_objects:protected] => ) [type:protected] => product [controller:protected] => [namespace:protected] => acf/v3 [rest_base:protected] => product ) [1] => update_item ) [permission_callback] => Array ( [0] => ACF_To_REST_API_Posts_Controller Object ( [acf:protected] => ACF_To_REST_API_ACF_API Object ( [id:protected] => [type:protected] => product [controller:protected] => ACF_To_REST_API_Posts_Controller [field_objects:protected] => ) [type:protected] => product [controller:protected] => [namespace:protected] => acf/v3 [rest_base:protected] => product ) [1] => update_item_permissions_check ) ) [parsed_json:protected] => 1 [parsed_body:protected] => )
By now I am totally and utterly in the dark, because I have no idea on how to proceed from here.
I really hope anyone can help me out.
Thanks.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘POST request returns 500 cannot update item’ is closed to new replies.