WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 13 months 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:
PR Number:

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 2 years ago.

Download all attachments as: .zip

Change History (15)

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


3 years ago

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


3 years ago

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


3 years ago

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


2 years ago

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


2 years ago

#6 @flixos90
2 years 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
2 years 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.


2 years ago

#9 @flixos90
2 years 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
2 years ago

#10 @spacedmonkey
2 years 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.


2 years ago

#12 @joehoyle
2 years ago

This looks like a good start! I wonder if we could perhaps add this to a github PR on the existing repo) and do feedback there, as doing so on a patch this size is really no fund!

https://github.com/WP-API/wp-api-site-endpoints is the repo, on the PR it might be to write down why / if this is different than what exists there already.

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


18 months ago

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


13 months ago

Note: See TracTickets for help on using tickets.