Make WordPress Core

Opened 7 months ago

Last modified 4 months ago

#41459 new task (blessed)

Introduce a REST API endpoint for networks / network options

Reported by: flixos90 Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: REST API Keywords: ms-roadmap needs-unit-tests has-patch
Focuses: multisite Cc:


Similar to sites in #40365, there should be a networks endpoint as part of the REST API.

Through recent multisite discussions, we have come to the conclusion that, while multi-network should never be part of core, there should be basic and unopinionated APIs present that can be used by whoever wants to implement it.

A basic networks API in these terms implies that it's a simple CRUD API for the wp_site database table. #29411 will introduce the internal core functions that this endpoint will be able to use.

The endpoint should be able to do the following:

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

Once the changes in #25344 is in place, a network meta endpoint should be created as well. For now this will be part of this ticket too.

Note that this ticket is an early one and will lay around for a while. The other non-network-related roadmap items have a higher priority.

Attachments (2)

41459.diff (16.4 KB) - added by spacedmonkey 6 months ago.
41459.2.diff (15.8 KB) - added by spacedmonkey 5 months ago.

Download all attachments as: .zip

Change History (8)

#1 @spacedmonkey
6 months ago

If #37181 is put in core, we can also make this endpoint an interface for network options, using the meta api.

If we use the meta api, we can also use the register_meta function to display some fields in the network endpoint. A quick review shows the following fields as possibly useful in the network endpoint.

  • siteurl
  • admin_email
  • site_name

A number of other fields that might be useful are

  • user_count
  • blog_count

#2 @spacedmonkey
6 months ago

  • Keywords needs-patch needs-unit-tests added
  • Summary changed from Introduce a REST API endpoint for networks to Introduce a REST API endpoint for networks / network options

6 months ago

#3 @spacedmonkey
6 months ago

  • Keywords has-patch added; needs-patch removed

Added first patch. This first patch is very simple, just introducing the endpoint without that ability to edit / delete / create networks, this is because these functions do not exist in core.

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

6 months ago

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

5 months ago

#6 @flixos90
4 months ago

  • Component changed from Networks and Sites to REST API
Note: See TracTickets for help on using tickets.