#60895 closed enhancement (fixed)
Add batch support to users REST API WP_REST_Users_Controller
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.6 | Priority: | normal |
Severity: | normal | Version: | 6.6 |
Component: | REST API | Keywords: | has-patch |
Focuses: | Cc: |
Description
Following the development discussions in #53063 and #50244 for some reason batch support was not added to users.
We were working on importing a large number of users as part of a migration project to WordPress / WooCommerce to discover that WP REST API does not support batching for Users in WP_REST_Users_Controller
since allow_batch
is not explicitly set to true
in register_rest_route
.
Is there a particular reason batching was not enabled for users?
Would it make sense to add this similarly to WP_REST_Posts_Controller
?
Change History (10)
This ticket was mentioned in PR #6364 on WordPress/wordpress-develop by @alexminza.
10 months ago
#1
- Keywords has-patch added
#2
@
10 months ago
This PR https://github.com/WordPress/wordpress-develop/pull/6364 enables batch users operations like for example creating multiple users in a single batch request:
curl --location 'http://localhost:8080/wp-json/batch/v1' \ --header 'Content-Type: application/json' \ --header 'Authorization: Basic ##REDACTED##' \ --data-raw '{ "requests": [ { "method": "POST", "path": "/wp/v2/users", "body": { "username": "testuser1", "email": "testuser1@localhost.local", "password": "##REDACTED##" } }, { "method": "POST", "path": "/wp/v2/users", "body": { "username": "testuser2", "email": "testuser2@localhost.local", "password": "##REDACTED##" } } ] }'
@alexminza commented on PR #6364:
10 months ago
#3
@TimothyBJacobs you added the main support for batching https://core.trac.wordpress.org/ticket/53063 - what do you think about this change?
#4
@
10 months ago
@TimothyBlynJacobs you added the main support for batching #53063 - what do you think about this change?
#5
@
10 months ago
- Milestone changed from Awaiting Review to 6.6
- Owner set to TimothyBlynJacobs
- Status changed from new to assigned
Thanks for the patch! I’ve marked this for inclusion in 6.6.
#6
@
9 months ago
@TimothyBlynJacobs can you proceed with this patch? There are fallen Unit tests, but possibly they just need to be restarted. We have 2 weeks until Beta 1.
This ticket was mentioned in Slack in #core by nhrrob. View the logs.
9 months ago
@TimothyBlynJacobs commented on PR #6364:
8 months ago
#9
Merged in r58283.
Following the development discussions in #53063 and #50244 for some reason batch support was not added to users.
We were working on importing a large number of users as part of a migration project to WordPress / WooCommerce to discover that WP REST API does not support batching for Users in
WP_REST_Users_Controller
sinceallow_batch
is not explicitly set totrue
inregister_rest_route
.This PR adds batch support for users in
WP_REST_Users_Controller
.Trac ticket: https://core.trac.wordpress.org/ticket/60895
Reference: https://core.trac.wordpress.org/ticket/53063