How to get private messages from Wordpress using JSON rest api?

In my wordpress, I have public posts, draft articles and private posts. I have installed WP REST API in order to access messages from another domain.

I can get public messages easily with the following json command

http://www.example.dev/wp-json/posts?_jsonp=?
complete code 
http://codepen.io/anon/pen/YXNrre

      

But I couldn't get private messages and message projects. I think I need to go through registration information

I have also tried

http://www.example.dev/wp-json/posts?type[]=post&_jsonp=?
http://www.example.dev/wp-json/posts?type[]=post&filter[status]=private&_jsonp=?

http://www.example.dev/wp-json/posts?filter[status]=private

      

How can I pass authentication information to the server from the client side? I have wordpress login and pass word. I don't know php. I think I only need jquery. and how to access private messages from another domain using JSON? thanks in advance.

+3


source to share


1 answer


There is API documentation here. http://wp-api.org/#posts_retrieve-posts

The field that sets the status for posts is called "post_status", not just "status". The default for post_status is usually published.



Also, you can only use this field if you are authenticated as you mentioned. There's docs for this here http://wp-api.org/guides/authentication.html

0


source







All Articles