#60895 closed enhancement (fixed)
Add batch support to users REST API WP_REST_Users_Controller
| Reported by: | alexminza | Owned by: | TimothyBlynJacobs |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.6 |
| Component: | REST API | Version: | 6.6 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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.
3 years ago
#1
- Keywords has-patch added
#2
@
3 years 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:
3 years 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
@
3 years ago
@TimothyBlynJacobs you added the main support for batching #53063 - what do you think about this change?
#5
@
3 years ago
- Milestone Awaiting Review → 6.6
- Owner set to
- Status new → assigned
Thanks for the patch! I’ve marked this for inclusion in 6.6.
#6
@
2 years 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.
2 years ago
@TimothyBlynJacobs commented on PR #6364:
2 years ago
#9
Merged in r58283.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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_Controllersinceallow_batchis not explicitly set totrueinregister_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