I am testing out using wp-api, I am very excited to use this by the way. Here is what I have done.
- installed wp-api and verified that I can get from the website using cURL
- Installed basic authentication, created an editor level account for this testing.
- I have tried to update a post using cURL and Postman in chrome.
my headers:
-Content-Type: application/javascript
-data in a file
I am not sure if there are other headers that I am missing. Both cURL and postman handle username and password in basic authentication for me.
my JSON
{
"title":"Hello Updated World!",
"content_raw":"Howdy updated content.",
"date":"2013-04-01T14:00:00+10:00"
}
straight from the examples in wp-api docs
the error I keep getting is
[
{
"code": "json_missing_callback_param",
"message": "Missing parameter data"
}
]
Looking at the source code on github it looks like a required parameter is missing
according to the documentation title and content raw seem to be the only required fields. I would love to know what I am missing if you have any suggestion. Thanks.
You can also try this plugin for making use of WordPress webservices and by using it you can also create your custom webservice too :
https://wordpress.org/plugins/json-api/
Here’s the code I use to call a local WP-API with PHP/cURL:
To update this post, I would change my data to:
ID is a required field when updating.