Add User(s) to a Group

You can use this API request to add a user or users to a group.

/services/v2/group/[groupId]/add.json?users=[userId]

You can use the following parameters in your add user(s) to a group request:

specific: users
Other options: wrap

🚧

Permissions & Notes:

  • You must have the Edit users and groups permission under Site Administration Roles in the Advanced Editor.

  • The mandatory users parameter specifies, in a comma-separated format, the identifiers of the users to add to the group.

  • We added this request in version 1.6.3.

Sample Request

A PUT add user(s) to a group request to https://apidocs.cloud.answerhub.com using a human-readable username and password (answerhub/test123) to add users (userId: 96, 97, and 107) to a group (groupId: 99), would look like this:

curl 
-u "answerhub:test123" 
-H "Accept: application/json" 
-H "Content-type: application/json" 
-X PUT "https://apidocs.cloud.answerhub.com/services/v2/group/99/add.json?users=96,97, 107" -v

In the example above, we added demo2 (user 96), demo3 (user 97), and guyS (user 107) to the Group called "Add Users to this Group" (group 99). The change can be seen in the admin console.

Sample Response

Successful Response:

  • HTTP Status 204 - No Content

Error Response:
If you don't have the correct permissions, you will get this response.

  • HTTP Status 401 Unauthorized
{
    "errors": {
        "message": "You don't have permission to do this action.
Please login as another user"
    }
}

Error Response:
If the users are already in the Group, then you will get this response.

  • HTTP Status 401 Unauthorized
<html>
    <head>
        <title>Apache Tomcat/7.0.81 - Error report</title>
        <style>
            <!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}-->
        </style>
    </head>
    <body>
        <h1>HTTP Status 401 - Bad credentials</h1>
        <HR size="1" noshade="noshade">
        <p>
            <b>type</b> Status report
        </p>
        <p>
            <b>message</b>
            <u>Bad credentials</u>
        </p>
        <p>
            <b>description</b>
            <u>This request requires HTTP authentication.</u>
        </p>
        <HR size="1" noshade="noshade">
        <h3>Apache Tomcat/7.0.81</h3>
    </body>
</html>
Language
Authorization
Basic
base64
:
Click Try It! to start a request and see the response here!