How to list of posts with status private
-
Dear colleagues of the Forum,
I need help, I’m having trouble getting the list of private status posts for a category using this Plugin WP REST API v. 2.0-beta15.
To get a specific private post with you normally. But I can not get a list. I’ve tried it in several ways and I can not get the list of private posts. Being that I get the list of posts with publish status perfectly.
Here’s what I’m doing:
1. I do the authentication using the JWT Authentication for WP-API v.1.2.3 plugin and get token and access user and other information perfectly.
2. With this token I request through REST to get the list of posts of a category with private posts. And the user has access to private posts via web portal after authenticating in wordpress;
3. When executing the request via GET receive the return with error 400, with the code message “rest_invalid_param”. How to solution this problem?
Url of tests:
https://www.ampeb.org.br/homologacao/wp-json/wp/v2/posts?_embed&per_page=20&status=private&categories=28Following the requests and answers obtained via REST API plug-in Log:
Request Headers
{
“authorization”: “Bearer XXXXXXXXXXXXXXMODIFY”,
“cookie”: “wordpress_logged_in_9f590808e3fee45213203e1b0d16e9e3=MODIFY%7C1496272594%7CIjLqffyTdq5edPrSY73ITnklROWiOeiqSJe0MQvAbao%7Cc7035c8e02ec0813729f7c60b659193d152ca825b501ca7dbdfb91b792a630a2; PHPSESSID=122cce903a5128df05da0d0e60d40000”,
“accept_language”: “pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4”,
“accept_encoding”: “gzip, deflate, sdch”,
“accept”: “*\/*”,
“postman_token”: “a510dca4-554b-5a1b-229f-08ec8259ace2”,
“user_agent”: “Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/56.0.2924.87 Safari\/537.36”,
“cache_control”: “no-cache”,
“connection”: “keep-alive”,
“host”: “www.ampeb.org.br”
}Request Parameters:
{
“per_page”: “20”,
“status”: “private”,
“categories”: [
“28”
]
}Response Headers
{
“Pragma”: “no-cache”,
“Content-Type”: “application\/json; charset=UTF-8”,
“X-Robots-Tag”: “noindex”,
“Link”: “<http\/\/www.ampeb.org.br\/homologacao\/wp-json\/>; rel=”https\/\/api.w.org\/””,
“X-Content-Type-Options”: “nosniff”,
“Access-Control-Expose-Headers”: “X-WP-Total, X-WP-TotalPages”,
“Access-Control-Allow-Headers”: “Authorization, Content-Type”,
“Expires”: “Wed, 11 Jan 1984 050000 GMT”,
“Cache-Control”: “no-cache, must-revalidate, max-age=0”,
“Allow”: “GET”
}Response Body
{
“data”: {
“code”: “rest_invalid_param”,
“message”: “Paru00e2metro(s) invu00e1lido(s): status”,
“data”: {
“status”: 400,
“params”: {
“status”: “O status u00e9 proibido.”
}
}
},
“headers”: {
“Allow”: “GET”
},
“status”: 400
}Can someone help me with solution to this problem?
- The topic ‘How to list of posts with status private’ is closed to new replies.