How to create a post using REST API with sending data as a JSON body?
I am able to create posts on my WordPress website using it's REST API with the below curl request format. Website uses basic auth plugin for the authentication process.
curl --user username:password -X POST -i https://mywebsite.com/wp-json/wp/v2/posts?title=myTitlecontent=MyContent
However, my problem is I need to set custom fields of the post when creating a post using REST API. I tried to send data as a JSON body using the below command and it didn't work. It just returns all the posts without creating a new post and also without giving any error.
curl --user username:password -X POST -i https://mywebsite.com/wp-json/wp/v2/posts -d '{title:NEw tiitle}'
I have tried sending post creation requests to my website using the Postman service also and the same thing happened. Could anyone please help me to solve this problem? Thanks in advance!