WordPress API – Get Drafts

I want to check if a post already exists. This includes to check if the post exists as draft as well. But I struggle a little bit with the wordpress API v2.
http://v2.wp-api.org/reference/posts/
Under List Posts -> status they say

Limit result set to posts assigned a specific status.
Default: publish

I tried to assign the value as parameter, but I get an error response:

{“code”:”rest_invalid_param”,”message”:”Invalid parameter: status”,”data”:{“status”:400,”params”:{“status”:”Status is forbidden”}}}

I als asign the title of the post to check:

filter[s] = post Title

So how to get the posts with draft state? I’m currently using the Basic Auth for developing?

I also tried

filter[post_status]=draft

but with no success.

I have the following plugins installed:
WP REST API
WP REST API – filter fields
JSON Basic Authentication

4 Answers
4

I think the query parameter that you want for post status is:

status=draft

Let me know if this doesn’t work.

Leave a Comment