Opened 9 years ago
Closed 7 years ago
#1020 closed defect (bug) (fixed)
Only one speaker is exposed via JSON API
Reported by: | iandunn | Owned by: | iandunn |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | WordCamp Site & Plugins | Keywords: | |
Cc: |
Description
@aagam94 discovered that r1533 only embeds a single speaker into session posts, even though there can be multiple.
I've been thinking about what the best way to go about fixing that would be. Ideally we want a speakers
(plural) item, but we can't simply add that and remove the speaker
item, because that would break any clients that may already be using it.
The traditional approach would be to add a version to the query parameters, but the 1.x branch of the JSON API doesn't have a standardized way of doing that, so anything we do would be kind of clunky.
Version 2 will add versioning, and also separate core endpoints from custom endpoints created by plugins (e.g., /wp-rest/wp/v2/posts
and /wp-rest/wordcamp/v1/sessions
), so maybe the best thing to do is wait until version 2 is available, and then create custom endpoints to expose meta, embed related posts, etc, rather than modifying the Core endpoints like we have been doing.
That way we could increment the version whenever we need to make a breaking change, and it wouldn't affect the Core endpoints.
Since displaying additional speakers isn't a critical issue, I think we can wait and see what best practices develop around version 2 of the API, and implement a fix at that time. In the mean time, clients can just display the first speaker.
I'm open to other suggestions if anybody sees a better way.
The v2 REST API allows embedding of multiple speakers in a session. Here's an example:
https://2016.us.wordcamp.org/wp-json/wp/v2/sessions/7844?_embed