Can’t update ACFs using JSON
-
I’ve got a custom post type called “artist”, with a text ACF called “artist_first_name”.
When I update it by sending form data, it works fine:
[james@marlon ~] $ curl -i -k --user <redacted> "https://dev.<redacted>.com/wp-json/acf/v2/artist/39608" --data "fields[artist_first_name]=bob" HTTP/1.1 200 OK Date: Thu, 22 Dec 2016 21:18:56 GMT Server: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 X-Powered-By: PHP/5.4.45 X-Robots-Tag: noindex Access-Control-Expose-Headers: X-WP-Total, X-WP-TotalPages Access-Control-Allow-Headers: Authorization, Content-Type Transfer-Encoding: chunked Content-Type: application/json; charset=UTF-8 {"acf":{"artist_first_name":"bob"}}but if I try sending JSON, I get a 500 back:
[james@marlon ~] $ curl -i -k -H "Content-Type: application/json" --user <redacted> "https://dev.<redacted>.com/wp-json/acf/v2/artist/39608" --data-binary '{"fields[artist_first_name]":"bob"}' HTTP/1.1 500 Internal Server Error Date: Thu, 22 Dec 2016 21:21:49 GMT Server: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 X-Powered-By: PHP/5.4.45 X-Robots-Tag: noindex Access-Control-Expose-Headers: X-WP-Total, X-WP-TotalPages Access-Control-Allow-Headers: Authorization, Content-Type Transfer-Encoding: chunked Content-Type: application/json; charset=UTF-8 {"code":"cant_update_item","message":"Cannot update item","data":{"status":500}}What am I doing wrong? How can I send a JSON body?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Can’t update ACFs using JSON’ is closed to new replies.