Make WordPress Core

Opened 7 years ago

Last modified 4 years ago

#41459 new task (blessed)

Introduce a REST API endpoint for networks / network options

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

Description

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 7 years ago.
41459.2.diff (15.8 KB) - added by spacedmonkey 7 years ago.

Download all attachments as: .zip

Change History (11)

#1 @spacedmonkey
7 years 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
7 years 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

@spacedmonkey
7 years ago

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


7 years ago

@spacedmonkey
7 years ago

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


7 years ago

#6 @flixos90
6 years ago

  • Component changed from Networks and Sites to REST API

#7 @sorenbronsted
4 years ago

I will work on unit-tests

This ticket was mentioned in PR #210 on WordPress/wordpress-develop by sorenbronsted.


4 years ago
#8

I have added the patch from the ticket and written a testunit for it.

Trac ticket:https://core.trac.wordpress.org/ticket/41459

#9 @sorenbronsted
4 years ago

  • Keywords has-unit-tests added; needs-unit-tests removed
Note: See TracTickets for help on using tickets.