Support » Networking WordPress » Invalid Parameter 400 Error When Creating New User in Multisite Environment

  • lowertownmedia

    (@lowertownmedia)


    I’ve successfully used make.com’s (Integromat) WordPress REST API function to create a user on a single WordPress site by passing these parameters in the PUT function at the v2/users endpoint:

    {
            "url": "'https://lowertownmedia.com",
            "name": "Ian",
            "email": "ian@mydomain.com",
            "roles": "subscriber",
            "nickname": "Ian",
            "password": "mypassword",
            "username": "ian"
        }

    However, when I pass the same PUT function to a multisite WordPress installation the Rest API generates the error “[400] Invalid user parameter(s). (error code: rest_invalid_param”

    Am I missing a required parameter for adding a multisite user? I also tried passing a “wp_capabilities” string as metadata to no avail.

    Thanks,

    Ian D. Campbell

    • This topic was modified 1 month ago by James Huff. Reason: moved to Networking WordPress since this is a multisite issue
Viewing 2 replies - 1 through 2 (of 2 total)
  • sarayourfriend

    (@sarayourfriend)

    Hi Ian,

    The error you’re seeing comes during the multisite username verification in the REST API. Usernames must be at least 4 characters long.

    You can see the code for this (and all the other conditions for usernames) here, in the wpmu_validate_user_signup function:

    https://core.trac.wordpress.org/browser/tags/6.0.2/src/wp-includes/ms-functions.php#L496

    Based on the code it seems that the error should have included the specific issue in the response. If that wasn’t the case it may be worth opening a Trac ticket for that so that these errors are clearer for folks who aren’t reading the codebase.

    threadi

    (@threadi)

    You must send the request to the specific page within the multisite. If you have example.com and example2.com as pages within your multisite and you want to create the user in example.com, then you must also use its domain.

    Here is a ticket where an answer nicely describes the API endpoints that are and could be possible: https://core.trac.wordpress.org/ticket/39544

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.