Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wordpress rest api acting like no data is sent

I am trying to create a post with the wordpress rest api. With curl and postman I get the following response.

{"code":"empty_content","message":"Content, title, and excerpt are empty.","data":{"status":400}}

My curl command is

curl -X POST --user admin:secret http://mysite.local/wp-json/wp/v2/posts/ -d '{"post_title":"My New Title","Content":"the stuff","excerpt":"something"}'

I know I must be missing something basic here. It acts like no post data is reaching it. Any ideas?

like image 799
zortacon Avatar asked Sep 03 '17 08:09

zortacon


1 Answers

I had the same problem and solved it by add the following option

-H "Content-Type: application/json"

like image 138
raoof Avatar answered Sep 22 '22 14:09

raoof