WP-API / docs-v2

Documentation for version 2 of the API
http://v2.wp-api.org
58 stars 76 forks source link

getting the posts without authentication also #134

Closed knvpk closed 8 years ago

knvpk commented 8 years ago

Hi, just i set up my own wordpress site and wp-api v2 beta installed, im getting the users list when i go to this url myurl/wp-josn/wp/v2/users im getting the list as json im wondering this doesn't require an authentication like access token like that. I have also installed Oauth server plugin but no use of it.

BE-Webdesign commented 8 years ago

A request to wp/v2/users will return users who have currently published a public post with limited information about the user. The reason for this is on most WordPress sites if you were to see posts usually the author is shown to anyone. The only information that shows up with users request is information that can be seen without authentication in a typical WordPress install. To see more useful information wp/v2/users?context=edit requires authentication and authorization. Hope that clears it up.

BE-Webdesign commented 8 years ago

This is also the docs section for the plugin and most issues brought here are about v2.wp-api.org. If I am not understanding what you need help with let me know.

knvpk commented 8 years ago

Hi @BE-Webdesign , Actually I want to show all posts,users data through the API only, Bcoz I wanted to show the posts to only some users that are in some other site. And i dont want want default website given by wordpress other than the admin site. To setup this what i want change the wordpress settings.

BE-Webdesign commented 8 years ago

Actually I want to show all posts,users data through the API only, Bcoz I wanted to show the posts to only some users that are in some other site.

So you are trying to display posts from a WordPress database in another site over the API? What are you not seeing in your response(s) that you need? I think the default functionality of the API should cover your needs, if I am understanding them correctly.

knvpk commented 8 years ago

As per the API i got my requirement, but my actual consideration is the posts that are published should be open for the public users which is not required bcoz i want to show only for my another application authenticated users.

BE-Webdesign commented 8 years ago

https://developer.wordpress.org/reference/hooks/rest_pre_dispatch/

The rest_pre_dispatch hook will allow you to add additional permissions checks for your requests.

However, if I understand how you are using the API, you would want to handle the permissions of accessing the REST API in your separate application.

knvpk commented 8 years ago

No, I want the posts,categories,tags only from api but not the UI because i didnt want them to show for all public users, i want to show the posts only for my another application users.