Opened 8 years ago
Closed 5 years ago
#7156 closed feature request (fixed)
Build REST-API endpoints for all Components.
Reported by: | DJPaul | Owned by: | espellcaste |
---|---|---|---|
Milestone: | 6.0.0 | Priority: | strategic |
Severity: | normal | Version: | |
Component: | REST API | Keywords: | needs-docs needs-codex has-patch |
Cc: | espellcaste@…, lmoffereins@… |
Description
To summarise countless discussions in the past, we need to build REST-API endpoints for BuddyPress.
Current work is happening on Github: https://github.com/buddypress/BP-REST
Technical requirements are still a bit sparse, but are currently:
- Query parameters / filters / returned data structure should be as uniform as possible across all Component endpoints.
- To adopt the JSON-LD specification to enrich the understandability of our endpoints by matching elements with schema.org.
- We can ship the API incomplete with BuddyPress as we build it (once we reach certain feature completion for each Component) because we can version our endpoints very easily.
Attachments (5)
Change History (32)
#2
@
8 years ago
@espellcaste Current version linked is not functional and is maybe 1/4 of the Activity endpoints.
#4
@
6 years ago
- Milestone changed from Awaiting Contributions to 5.0.0
Moving to the 5.0.0 milestone. Checklist:
- code review on existing endpoints (Boone is currently doing this)
- decisions about which subset of endpoints will appear in 5.0.0
- technical decisions about how we merge into core (leave as external project vs moving to SVN, where it lives in the filesystem, etc)
#5
@
6 years ago
- Keywords needs-docs needs-codex added
Just passing by to inform that all endpoints for the before-bp-merge
and v1
milestones are done, reviewed and ready: https://github.com/buddypress/BP-REST/milestones
A lot of work was put into it in the past two years! So I'm very excited about that!
There are, however, some components that don't have endpoints yet. Those will be added in the next BuddyPress release.
Those are the components with endpoint support:
- Activity
- Group Membership
- Group Membership Request(s)
- Group Avatar
- Group Invites
- XProfile Fields
- XProfile Groups
- XProfile Data
- Members
- Members Profile Photo (aka Avatar)
- Notifications
- Components
technical decisions about how we merge into core (leave as external project vs moving to SVN, where it lives in the filesystem, etc)
I'd recommend keeping at GH, at least until the next version of the API is ready, just like the BP CLI and BP Default.
If everyone agrees, I can have a patch ready with an example of the implementation. :)
Another important task pending is documentation. @boonebgorges and I have been testing some options. But a page at the Codex will also be necessary with basic information and probably a link to the actual doc of the API.
#7
@
6 years ago
I'd recommend keeping at GH, at least until the next version of the API is ready, just like the BP CLI and BP Default
Sounds good to me for now.
#8
@
5 years ago
- Keywords has-patch added
Hi,
I know we are still thinking about what is the best option between merging or including into a build step the BP REST API. Reading the thread of the ticket makes me feel, and I agree about this choice, that we can wait until all the remaining endpoints are built into the BP REST plugin before merging. It's the choice that leaves us all options: as @boonebgorges said during dev-chat "once we go Trac, we can't go back".
So I've been thinking about this scenario and built the 7156.patch. Here's what it does :
- put the REST Controllers into their components class directory (eg:
src/bp-activity/classes/class-bp-rest-activity-endpoint.php
), - make sure all
@since 0.1.0
are replaced by@since 5.0.0
, - make sure the
buddypress.pot
is generated after the REST endpoints have been added to the build directory. - copy the functions listed into the
/includes/functions.php
file of the BP REST plugin intosrc/bp-core/bp-core-rest-api.php
. (PS: I've added a pull-request about what needs to be done into the BP REST plugin about this). - update the class autoloader for the REST Controllers.
- add a new method
rest_api_init()
toBP_Component
and the components having REST controllers. - make sure these methods are only used when the WordPress version of the site is >=
4.7.0
and the BP REST plugin is not active.
On a side note I had to edit a unit test that was deleting the $_SERVER['SERVER_NAME']
global. Feedbacks welcome 😉
#9
@
5 years ago
Really good! A few things I noticed:
- version change: I wonder how that's gonna happen when other versions are add. Meaning, 5.0.1, etc.
- Should the bp rest api unit tests also be migrated as well? Or only on the "final" migration/merge?
- I think we should update the members path to the filterable one as it is in the @todo That might avoid breakages for some people
- The
svn export --force https://github.com/buddypress/BP-REST.git/trunk bp-rest
is exporting from the trunk branch but there is no trunk branch on that git repo. The main one ismaster
.
#10
@
5 years ago
Thanks a lot for your feedbacks @espellcaste
About version change, I think we just need to increase the version number of the BP REST plugin once BuddyPress 5.0.0 is released for instance:
- 0.1.0 => 5.0.0
- 0.1.1 => 5.1.0
- 0.2.0 => 6.0.0
About unit tests, I'd say final merge because you need them to carry on developing the remaining endpoints from GitHub in this scenario. (it helps doing a first "review" of PRs)
About the @todo
: I think it can be removed because the function is already using the filterable path. I've read the history of the file and, the @todo
appeared in 40b1288 but wasn't removed in a305cf7
About svn export, SVN trunk == GIT master 😉. It's the way to do it.
This ticket was mentioned in Slack in #buddypress by imath. View the logs.
5 years ago
#12
@
5 years ago
FYI 7156.2.patch is updating the patch to take in account the latest changes made here about the /includes/functions.php
file of the BP REST plugin.
This ticket was mentioned in Slack in #buddypress by imath. View the logs.
5 years ago
This ticket was mentioned in Slack in #buddypress by imath. View the logs.
5 years ago
#20
@
5 years ago
Hi!
In 7156.4.patch I'm suggesting to introduce a filter to allow site owners to eventually disable a specific BP REST Controller to load.
#22
@
5 years ago
- Milestone changed from 5.0.0 to Up Next
Moving this ticket to up/next milestone so we can use this ticket to carry on working on the remaining endpoints.
#23
@
5 years ago
- Milestone changed from Up Next to 6.0.0
Move the first tickets to next major release.
#24
@
5 years ago
- Keywords needs-patch added; has-patch removed
TODO: We need to update the bp_rest
grunt task to take in account new endpoints.
This ticket was mentioned in Slack in #buddypress by imath. View the logs.
5 years ago
#26
@
5 years ago
- Keywords has-patch added; needs-patch removed
7156.5.patch is preparing the inclusion of the remaining endpoints. As I've explained into this PR on the BP REST API GH repository, it brings some "reorganization" to make sure controllers are landing into the right BP Component classes subfolder?
Please make sure to have a look at the patch before March 30 so that we can release 6.0.0-beta1 before the end of march as announced :)
@DJPaul Good!
Question, do you have usage information about the current version so far? Is there companies/sites using? #justcurious