[wp-trac] [WordPress Trac] #39466: Get list of post API request missing status
WordPress Trac
noreply at wordpress.org
Wed Jan 4 17:02:44 UTC 2017
#39466: Get list of post API request missing status
------------------------------------------+-----------------------
Reporter: gnanasekaran | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 4.7.2
Component: REST API | Version: 4.6.1
Severity: normal | Resolution:
Keywords: needs-patch needs-unit-tests | Focuses: rest-api
------------------------------------------+-----------------------
Changes (by jnylen0):
* keywords: => needs-patch needs-unit-tests
* milestone: Awaiting Review => 4.7.2
Old description:
> when send "get post" request, status ($data['status']) overwrite by
> default. I did not get "status" in response.
>
> For below request
>
> Definition
> GET /wp/v2/posts/
> Example Request
>
> $ curl http://demo.wp-api.org/wp-json/wp/v2/posts/
New description:
when send "get posts" request, status (`$data['status']`) is missing by
default. I did not get "status" in response.
For below request
Definition
GET /wp/v2/posts/
Example Request
$ curl http://demo.wp-api.org/wp-json/wp/v2/posts/
--
Comment:
We do only show the status in `context=edit`
([https://core.trac.wordpress.org/browser/tags/4.7/src/wp-includes/rest-
api/endpoints/class-wp-rest-posts-controller.php#L1715 ref]).
This has been reported at least one other time
[https://docs.google.com/spreadsheets/d/1Q9dyHi903GQjzzBK9jvi_lOpD9BxW176rdKGJK9eDC4/edit#gid=1331799258
in testing]. I think it's a bit silly not to include `status`: we
support querying for a post status unauthenticated, even if just for the
default status of `publish`
([https://core.trac.wordpress.org/browser/tags/4.7/src/wp-includes/rest-
api/endpoints/class-wp-rest-posts-controller.php?marks=2177,2180#L2160
ref]) or `inherit` for attachments
([https://core.trac.wordpress.org/browser/tags/4.7/src/wp-includes/rest-
api/endpoints/class-wp-rest-attachments-controller.php?marks=636#L626
ref]).
Another status-related issue: It's not possible to query posts with the
`inherit` status unauthenticated. But, it looks like they may show up in
`/wp/v2/posts` if read permission is otherwise allowed. Needs some
testing.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39466#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list