WordPress.org

Make WordPress Core

Opened 7 months ago

Last modified 5 weeks ago

#40365 new task (blessed)

Introduce a REST API endpoint for sites

Reported by: jeremyfelt Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: REST API Keywords: dev-feedback needs-unit-tests ms-roadmap has-patch
Focuses: multisite, rest-api Cc:

Description

It should be possible to manage sites in a multisite configuration through the REST API.

  • List sites: GET wp/v2/sites/
  • Retrieve a site: GET wp/v2/sites/<id>
  • Create a site: POST wp/v2/sites/
  • Update a site: PUT wp/v2/sites/<id>
  • Delete a site: DELETE wp/v2/sites/<id>

Data included in a site object should at least mirror the data available for the site in wp_blogs. Additional ideal pieces of data for a site include blogname, blogdescription, home, and siteurl. It's possible that creating a new meta table for sites can help developers register meta for inclusion with a site object (See #37923).

Sites should be accessible by default for authenticated users only. Network (global) admins should have access to all sites. Site users should have access to the sites they are members of. The "My Sites" list is a great candidate for exploring how this will work. See #15317.

As of the introduction of get_sites() in 4.6.0, retrieving sites is a much better experience. The methods used to create, update, and delete sites in multisite are not as pleasant right now. We should investigate each of these and determine what can be done to streamline the process. The first improvement is probably in creating a site. See #40364.

Attachments (1)

40365.diff (31.7 KB) - added by spacedmonkey 6 weeks ago.

Download all attachments as: .zip

Change History (12)

This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.


6 months ago

This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.


6 months ago

This ticket was mentioned in Slack in #core-restapi by flixos90. View the logs.


6 months ago

This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.


5 months ago

This ticket was mentioned in Slack in #core-restapi by jnylen. View the logs.


3 months ago

#6 @flixos90
3 months ago

  • Keywords ms-roadmap added

These tickets belong to our planned roadmap (a few of them not per final decision), so flagging with a keyword for better overview.

#7 @flixos90
3 months ago

  • Component changed from Networks and Sites to REST API
  • Keywords changed from needs-patch, dev-feedback, needs-unit-tests, ms-roadmap to needs-patch dev-feedback needs-unit-tests ms-roadmap

This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.


3 months ago

#9 @flixos90
3 months ago

For reference: Once #37923 and #38025 are finished, an additional part of this ticket will also be to implement a site meta endpoint.

@spacedmonkey
6 weeks ago

#10 @spacedmonkey
6 weeks ago

  • Keywords has-patch added; needs-patch removed

First pass at patch. 40365.diff

It uses wpmu_create_blog, wpmu_delete_blog and update_blog_details for now, as other crud functions are not available.

This ticket was mentioned in Slack in #core-restapi by laygen. View the logs.


5 weeks ago

Note: See TracTickets for help on using tickets.