Please rate how useful you found this document: 
Average: 2.3 (3 votes)

Groups

The following REST endpoints are used to manage groups, as well as their member users in ProcessMaker.


Available methods:

Get Groups List: GET /groups

Get a list of all the groups in the workspace (including groups with "INACTIVE" status). The groups are returned in alphabetical order.

GET /api/1.0/{workspace}/groups?filter={filter}&start={start}&limit={limit}

URL Parameters:

Name Type Description
workspace String Workspace name

Optional GET Parameters:

Name Type Description
filter string Case insensitive string to search for in the group name.
For example, "api/1.0/workspace/groups?filter=sal" would return the groups "Sales" and "Condiments & salts".
start integer The number of groups where the list begins. The counting starts from the number 0.
For example, "api/1.0/workspace/groups?start=3" would start the list of groups with the fourth group.
limit integer The maximum number of groups which are returned in the list.
For example if wanting to return 10 groups at a time and there are 25 groups in total, then call this endpoint 3 times:
"api/1.0/workspace/groups?limit=10" (returns groups 0-9)
"api/1.0/workspace/groups?start=10&limit=10" (returns groups 10-19)
"api/1.0/workspace/groups?start=20&limit=10" (returns groups 20-24)

Result:

Returns an HTTP status code of 200 and the following array of group objects:

Element Description
[ Start array
{ Start group object
grp_uid The group's unique ID.
grp_title The group's title.
grp_status The group's status, which can be "ACTIVE" or "INACTIVE".
grp_users The number of users who are members of the group, including users who have "INACTIVE" and "VACATION" status.
grp_tasks The number of tasks to which the group is assigned. Note that this number includes tasks which are in deactivated processes, but it does not include ad hoc assignment to tasks.
}, End group object.
... Additional group objects.
] End array.

For example:

[
  {
    grp_uid:    "47113834154e4a6c5cd1f11014216675",
    grp_title:  "European Sales",
    grp_status: "ACTIVE",
    grp_users:  3,
    grp_tasks:  1
  },
  {
    grp_uid:    "23251789354e4a6d6812cb4062218479",
    grp_title:  "Factory Workers",
    grp_status: "INACTIVE"
    grp_users:  20,
    grp_tasks:  7
  },
  {
    grp_uid:    "92331939154e4a6b3d46cc3062046323",
    grp_title:  "Managers"
    grp_status: "ACTIVE"
    grp_users:  4,
    grp_tasks:  2
  }
]

If there is are no groups, then an empty array is returned. If an error occurs, then

PHP Example: The following example creates an array of the active groups which are assigned to one or more tasks.

$apiServer = "https://example.com"; //set to your ProcessMaker address
$accessToken = isset($_COOKIE['access_token']) ? $_COOKIE['access_token'] : getAccessToken();

$ch = curl_init($apiServer . "/api/1.0/workflow/groups");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer " . $accessToken));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$aGroups = json_decode(curl_exec($ch));
curl_close($ch);

$aActiveGroups = array();

foreach ($aGroups as $oGroup) {
   if ($oGroup->grp_status == "ACTIVE" and $oGroup->grp_tasks >= 1) {
      $aActiveGroups[] = array("uid" => $oGroup->grp_uid, "title" => $oGroup->grp_title);
   }
}

Get Group Information: GET /group/{grp_uid}

Get information about a specified group.

GET /api/1.0/{workspace}/group/{grp_uid}

URL Parameters:

Name Type Description
workspace String Workspace name
grp_uid String Group UID

Result:

Returns the HTTP status code 200 and the same group object as the GET /groups endpoint. For example:

{
  grp_uid:    "47113834154e4a6c5cd1f11014216675",
  grp_title:  "European Sales",
  grp_status: "ACTIVE",
  grp_users": 5,
  grp_tasks"
: 2
}

If a bad request, then it returns the HTTP status code 400 and an error object like this:

{
  error: {
    code: 400,
    message: "Bad Request: The group with grp_uid: 66065213554dd1feb48fe79020620851 does not exist."
  }
}

PHP Example:

This example prints out how many users are in a group with the ID "47113834154e4a6c5cd1f11014216675":

$apiServer = "https://example.com";           //set to your ProcessMaker address
$userId = '47113834154e4a6c5cd1f11014216675'; //set to the unique ID of a group

$accessToken = isset($_COOKIE['access_token']) ? $_COOKIE['access_token'] : getAccessToken();

$ch = curl_init($apiServer . '/api/1.0/workflow/group/' . $userId);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer " . $accessToken));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$oGroup = json_decode(curl_exec($ch));

if (isset($oGroup->error)) {
   print "Error in $apiServer: \nCode: {$oGroup->error->code}\nMessage: {$oGroup->error->message}\n";
}
else {
   print "Group '{$oGroup->grp_title}' has {$oGroup->grp_users} members.\n";
}
curl_close($ch);

Create Group: POST /group

Create a new group.

Permission:

The logged-in user needs to have the PM_USERS permission in his/her role in order to be able to perform this action.

Structure:

POST /api/1.0/{workspace}/group

URL Parameters:

Name Type Description
workspace String Workspace name

POST Fields:

Name Type Description
grp_title String The name of the group.
grp_status String The group's status, which can be "ACTIVE" or "INACTIVE". If the group is assigned to a task and its status is "INACTIVE", then members of the group will NOT be assigned to the task when cases are run.

Result:

If a new group was created, then the HTTP status code is 201 and a JSON object with information about the new group is returned. For example:

{
  grp_uid:    "95436327554e4c87a5bd201063097966",
  grp_title:  "Accounting",
  grp_status: "ACTIVE"
}

If a bad request, then the HTTP status code is 400 or greater and a JSON object like the following is returned:

{
  error: {
    code:    400,
    message: "Bad Request: The group title with grp_title: \"Accounting\" already exists."
  }
}

PHP Example:

$apiServer = "https://example.com"; //set to your ProcessMaker address

$accessToken = isset($_COOKIE['access_token']) ? $_COOKIE['access_token'] : getAccessToken();

$postParams = array(
   'grp_title'   => "Accounting",
   'grp_status'  => "ACTIVE"
);

$ch = curl_init($apiServer . "/api/1.0/workflow/group");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer $accessToken"));
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postParams);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$oGroup = json_decode(curl_exec($ch));

if (!isset($oGroup)) {
   print "Error accessing $apiServer: \n" . curl_error($ch);
}
elseif (isset($oGroup->error)) {
   print "Error in $apiServer: \nCode: {$oGroup->error->code}\nMessage: {$oGroup->error->message}\n";
}
else {
   print "Group '{$oGroup->grp_title}' created with UID: {$oGroup->grp_uid}\n";
}
curl_close($ch);

Update Group: PUT /group/{grp_uid}

Update information about a specified group.

Permission:

The logged-in user needs to have the PM_USERS permission in his/her role in order to be able to perform this action.

Structure:

PUT /api/1.0/{workspace}/group/{grp_uid}

URL Parameters:

Name Type Description
workspace String Workspace name
grp_uid String Group unique ID.

Optional Fields:

Name Type Description
grp_title String The group's title.
grp_status String Group status, which can be "ACTIVE" or "INACTIVE". If the group is assigned to a task and its status is "INACTIVE", then members of the group will NOT be assigned to the task when cases are run.

Result:

If the group was successfully updated, the HTTP status code is 200 and there is nothing returned.

If it is a bad request, then the HTTP status code is set to 400 or greater, and a JSON object like the following is returned:

{
  error: {
    code:    400,
    message: "Bad Request: The group with grp_uid: 47113834154e4a6c5cd1f11014216674 does not exist."
  }
}

PHP Example:
The following example changes the group title to "Accounting" and sets its status to "INACTIVE":

$apiServer = "https://example.com";            //set to your ProcessMaker address
$userId = "75740355754dd28ba73d7d6082172937";  //set to the unique ID of a group

$accessToken = isset($_COOKIE['access_token']) ? $_COOKIE['access_token'] : getAccessToken();

$postParams = array(
  'grp_title'  => "Accounting",
  'grp_status' => "INACTIVE",
);

$ch = curl_init($apiServer . "/api/1.0/workflow/group/" . $groupId);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer $accessToken"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postParams));
$oResult = json_decode(curl_exec($ch));
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if ($statusCode != 200) {
   if (isset($oResult) and isset($oResult->error))
      print "Error Code: {$oResult->error->code}\nMessage: {$oResult->error->message}\n";
   else
      print "Error: HTTP status code: $statusCode\n";
}
curl_close($ch);

Note that the following line sets the request to be a PUT request:

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");

Also note that the POST parameters need to be passed to http_build_query() to generate a URL-encoded query string which can be used with PUT requests.

Delete Group: DELETE /group/{grp_uid}

Delete a specified group. Note that this endpoint deletes the group's record from the GROUPWF table and its title from the CONTENT table in the database, but it doesn't delete the group's membership list from the GROUP_USER table.

Permission:

The logged-in user needs to have the PM_USERS permission in his/her role in order to be able to perform this action.

Structure:

DELETE /api/1.0/{workspace}/group/{grp_uid}

URL Parameters:

Name Type Description
workspace String Workspace name
grp_uid String Group unique ID.

Result:

If the group was deleted, then the HTTP status code is 200. Otherwise, the HTTP status code is 400 or greater and a JSON object is returned like the following:

{
  error: {
    code:    400,
    message: "Bad Request: The group with grp_uid: 23251789354e4a6d6812cb4062218479 does not exist."
  }
}

PHP Example:

$apiServer = "https://example.com";              //set to your ProcessMaker address
$groupId   = "75740355754dd28ba73d7d6082172937"; //set to a group's ID to delete it

$accessToken = isset($_COOKIE['access_token']) ? $_COOKIE['access_token'] : getAccessToken();

$ch = curl_init($apiServer . "/api/1.0/workflow/group/" . $groupId);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer $accessToken"));
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
$oResult = json_decode(curl_exec($ch));
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if ($statusCode != 200) {
   if (isset($oResult) and isset($oResult->error)) {
      print "Error in $apiServer: \nCode: {$oResult->error->code}\nMessage: {$oResult->error->message}\n";
   }
   else {
      print "Error: HTTP status code: $statusCode\n";
   }
}
curl_close($ch);

GROUPS - USERS

Get Group Members: GET /group/{grp_uid}/users

List the assigned users to a specified group.

GET /api/1.0/{workspace}/group/{grp_uid}/users?filter={filter}&start={start}&limit={limit}

URL Parameters:

Name Type Description
workspace String Workspace name
grp_uid String Group UID


Optional GET Parameters:

Name Type Description
filter string Case insensitive string to search for in the user's first name, last name or username.
For example, "api/1.0/workspace/group/47113834154e4a6c5cd1f11014216675/users?filter=mit" would return the users "smith", "Mitter" and "solmit".
start integer The number of users where the list begins. The counting starts from number 0.
For example, "api/1.0/workspace/group/47113834154e4a6c5cd1f11014216675/users?start=3" would start the list of users with the fourth user.
limit integer The maximum number of users which are returned in the list.
For example if wanting to return 10 users at a time and there are 25 users in total, then call this endpoint 3 times:
"api/1.0/workspace/group/47113834154e4a6c5cd1f11014216675/users?limit=10" (returns users 0-9)
"api/1.0/workspace/group/47113834154e4a6c5cd1f11014216675/users?start=10&limit=10" (returns users 10-19)
"api/1.0/workspace/group/47113834154e4a6c5cd1f11014216675/users?start=20&limit=10" (returns users 20-24)

Result:

If a successful request, the HTTP status code is set to 200 and a JSON array of user objects is returned, like the following one:

[
  {
    usr_uid:       "55324179754ca442baeb994077387342",
    usr_username:  "jane",
    usr_firstname: "Jane",
    usr_lastname:  "Doe",
    usr_email:     "janedoe@example.com",
    usr_status:    "ACTIVE"
  },
  {
    usr_uid:       "66065213554dd1feb48fe79020620851",
    usr_username:  "sam",
    usr_firstname: "Sam",
    usr_lastname:  "Sloe",
    usr_email:     "samsloe@example.com",
    usr_status:    "INACTIVE"
  },
]

If a bad request, then the HTTP status code is 400 or greater and a JSON error object is returned, like this one:

{
  error: {
    code:    400,
    message: "Bad Request: The group with grp_uid: 47113834154e4a6c5cd1f11014216674 does not exist."
  }
}

PHP Example:
This PHP example creates a list of active users who are members of a group with the unique ID of "47113834154e4a6c5cd1f11014216675" and places them in the array $aActiveUsers.

$apiServer = "https://example.com";              //set to your ProcessMaker address
$groupId   = "47113834154e4a6c5cd1f11014216675", //set to the unique ID of a group

$accessToken = isset($_COOKIE['access_token']) ? $_COOKIE['access_token'] : getAccessToken();

$ch = curl_init($apiServer . "api/1.0/workspace/group/$groupId/users");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer " . $accessToken));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$aUsers = json_decode(curl_exec($ch));
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$aActiveUsers = array();

if ($statusCode != 200) {
   if (isset ($aUsers) and isset($aUsers->error))
      print "Error code: {$aUsers->error->code}\nMessage: {$aUsers->error->message}\n";
   else
      print "Error: HTTP status code: $statusCode\n";
}
else {
   foreach ($aUsers as $oUser) {
      if ($oUser->usr_status == "ACTIVE") {
         $aActiveUsers[] = array("uid" => $oUser->usr_uid, "username" => $oUser->usr_username);
      }
   }
}

Get Available Users: GET /group/{grp_uid}/available-users

Get a list of available users, which can be assigned to a specified group. All users which aren't yet assigned to the group will be listed, including users with "INACTIVE" and "VACATION" status.

GET /api/1.0/{workspace}/group/{grp_uid}/available-users?filter={filter}&start={start}&limit={limit}

URL Parameters:

Name Type Description
workspace String Workspace name
grp_uid String Group unique ID.

Optional GET Parameters:

Name Type Description
filter string Case insensitive string to search for in the user's first name, last name or username.
For example, "api/1.0/workspace/group/47113834154e4a6c5cd1f11014216675/users?filter=mit" would return the users "smith", "Mitter" and "solmit".
start integer The number of users where the list begins. The counting starts from number 0.
For example, "api/1.0/workspace/group/47113834154e4a6c5cd1f11014216675/users?start=3" would start the list of users with the fourth user.
limit integer The maximum number of users which are returned in the list.
For example if wanting to return 10 users at a time and there are 25 users in total, then call this endpoint 3 times:
"api/1.0/workspace/group/47113834154e4a6c5cd1f11014216675/users?limit=10" (returns users 0-9)
"api/1.0/workspace/group/47113834154e4a6c5cd1f11014216675/users?start=10&limit=10" (returns users 10-19)
"api/1.0/workspace/group/47113834154e4a6c5cd1f11014216675/users?start=20&limit=10" (returns users 20-24)

Result:

If a successful request, the HTTP status code is set to 200 and a JSON array of user objects is returned, like the following one:

[
  {
    usr_uid:       "55324179754ca442baeb994077387342",
    usr_username:  "jane",
    usr_firstname: "Jane",
    usr_lastname:  "Doe",
    usr_email:     "janedoe@example.com",
    usr_status:    "ACTIVE"
  },
  {
    usr_uid:       "66065213554dd1feb48fe79020620851",
    usr_username:  "sam",
    usr_firstname: "Sam",
    usr_lastname:  "Sloe",
    usr_email:     "samsloe@example.com",
    usr_status:    "INACTIVE"
  },
]

If a bad request, then the HTTP status code is 400 or greater and a JSON error object is returned, like this one:

{
  error: {
    code:    400,
    message: "Bad Request: The group with grp_uid: 47113834154e4a6c5cd1f11014216674 does not exist."
  }
}

PHP Example:

This example gets a list of the first 10 available users to be assigned to a group with the ID ""47113834154e4a6c5cd1f11014216675":

$apiServer = "https://example.com";              //set to your ProcessMaker address
$groupId   = "47113834154e4a6c5cd1f11014216675", //set to the unique ID of a group

$accessToken = isset($_COOKIE['access_token']) ? $_COOKIE['access_token'] : getAccessToken();

$ch = curl_init($apiServer . "api/1.0/workspace/group/$groupId/users");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer " . $accessToken));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$aUsers = json_decode(curl_exec($ch));
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

$aAvailableUsers = array();

if ($statusCode != 200) {
   if (isset ($aUsers) and isset($aUsers->error))
      print "Error code: {$aUsers->error->code}\nMessage: {$aUsers->error->message}\n";
   else
      print "Error: HTTP status code: $statusCode\n";
}
else {
   for ($i = 0; $i < 10 and $i < count($aUsers; $i++) {
      $aAvailableUsers[] = array(
         "uid" => $aUsers[$i]->usr_uid,
         "name"=> "{$aUsers[$i]->usr_firstname} {$aUsers[$i]->usr_lastname} ({$aUsers[$i]->usr_username})"
      );
   }
}

Assign User to Group: POST /group/{grp_uid}/user

Assign a user to a specified group.

Permission:

The logged-in user needs to have the PM_USERS permission in his/her role in order to be able to perform this action.

Structure:

POST /api/1.0/{workspace}/group/{grp_uid}/user

URL Parameters:

Name Type Description
workspace String Workspace name
grp_uid String The group's unique ID

POST Fields:

Name Type Description
usr_uid String The unique ID of the user who will be added to the group as a member. Note that it is possible to add a user with "INACTIVE" or "VACATION" status to a group, but that user will not be assigned to any cases until his/her status changes to "ACTIVE" status.

Optional Fields:

These fields may be included, but they will be ignored by the REST endpoint.

Name Type Description
usr_username String Username
usr_firstname String User first name
usr_lastname String User last name
usr_email String User email
usr_status String User status

Result:

If the user was assigned to the group, then the HTTP status code is 201 (Created) and there is no return object. Otherwise, it is 400 or greater and returns a JSON error object like:

{
  error: {
    code:    400,
    message: "Bad Request: The user with usr_uid: 55324179754ca442baeb994077387342 is already assigned to the group."
  }
}

PHP Example:

$apiServer = "https://example.com";            //set to your ProcessMaker address
$groupId = "75740355754dd28ba73d7d6082172937"; //set to the unique ID of a group
$userId  = "14680180454ca4477335a27034362107"; //set to unique ID of user to add to group

$accessToken = isset($_COOKIE['access_token']) ? $_COOKIE['access_token'] : getAccessToken();

$postParams = array('usr_uid' => $userId);

$ch = curl_init($apiServer . "/api/1.0/workflow/group/$groupId/user");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer $accessToken"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postParams);
$oResult = json_decode(curl_exec($ch));
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if ($statusCode != 201) {
   if isset($oResult) and isset($oResult->error)) {
      print "Error in $apiServer:\nCode: {$oResult->error->code}\nMessage: {$oResult->error->message}\n";
   }
   else {
      print "Error: HTTP status code $statusCode\n";
   }
}
curl_close($ch);

Batch assignment of users to a group: POST /group/batch-users

Assign a group of users to a specified group or groups.

Permission:

The logged-in user needs to have the PM_USERS permission in his/her role in order to be able to perform this action. As of ProcessMaker 3.7.6, there is no need to have the PM_USERS in the role.

Structure:

POST /api/1.0/{workspace}/group/batch-users

URL Parameters:

Name Type Description
workspace String Workspace name

POST Fields:

Name Type Description
group_uid String The unique ID of the group.
usr_uid String The unique ID of the user who will be added to the group as a member. Note that it is possible to add a user with "INACTIVE" or "VACATION" status to a group, but that user will not be assigned to any cases until his/her status changes to "ACTIVE" status.

Example:
Request

[
    {   "groupUid": "736859293580694224723e4044919733",
        "users": [
            "53394423757e2b2b0ad67f8037960288",
            "46659397457e2b247449e47034509320",
            "76081561857e2b295df50e8089175787",
            "53394423757e2b2b0ad67f8037960277"
        ]
    },
    {   "groupUid": "40282513256e338ca2244a0065846602",
        "users": [
            "53394423757e2b2b0ad67f8037960288",
            "46659397457e2b247449e47034509320",
            "76081561857e2b295df50e8089175787",
            "53394423757e2b2b0ad67f8037960277"
        ]
    }
]

Response

If the users were assigned to the groups, then the HTTP status code is 201 (Created) and there is a return object with the state of the assignment of each user.

[
  {
    "groupUid": {
      "736859293580694224723e4044919733": "GROUP_EXISTS"
    },
    "users": {
      "53394423757e2b2b0ad67f8037960288": "USER_NOT_EXISTS",
      "46659397457e2b247449e47034509320": "USER_SUCCESSFULLY_ASSIGNED",
      "76081561857e2b295df50e8089175787": "USER_SUCCESSFULLY_ASSIGNED",
      "53394423757e2b2b0ad67f8037960277": "USER_ALREADY_ASSIGNED"
    }
  },
  {
    "groupUid": {
      "40282513256e338ca2244a0065846602": "GROUP_EXISTS"
    },
    "users": {
      "53394423757e2b2b0ad67f8037960288": "USER_NOT_EXISTS",
      "46659397457e2b247449e47034509320": "USER_ALREADY_ASSIGNED",
      "76081561857e2b295df50e8089175787": "USER_SUCCESSFULLY_ASSIGNED",
      "53394423757e2b2b0ad67f8037960277": "USER_ALREADY_ASSIGNED"
    }
  }
]

Otherwise, it is 400 or greater and returns a JSON error object like:

{
    "error": {
       "code": 404,
       "message": "Not Found"
    }
}

Unassign User from Group: DELETE /group/{grp_uid}/user/{usr_uid}

Unassign (remove) a user from a group so no longer a member of the group.

Permission:

The logged-in user needs to have the PM_USERS permission in his/her role in order to be able to perform this action.

Structure:

DELETE /api/1.0/{workspace}/group/{grp_uid}/user/{usr_uid}

URL Parameters:

Name Type Description
workspace String Workspace name
grp_uid String Group UID
usr_uid String Group UID

Result:

If the user was removed from the group, then the HTTP status code is 200 and there is no return object. Otherwise, the HTTP status code is 400 or greater and a JSON error object is returned, such as:

{
  error: {
    code:    400,
    message: "Bad Request: The user with usr_uid: 98883020754dd1f052ee1f1034403381 is not assigned to the group."
  }
}

PHP Example:

$apiServer = "https://example.com";              //set to your ProcessMaker address
$groupId   = "75740355754dd28ba73d7d6082172937"; //set to a group's ID
$userId    = "98883020754dd1f052ee1f1034403381"; //set to the ID of the user to be removed from the group

$accessToken = isset($_COOKIE['access_token']) ? $_COOKIE['access_token'] : getAccessToken();

$ch = curl_init($apiServer . "/api/1.0/workflow/group/$groupId/user/$userId");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer $accessToken"));
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
$oResult = json_decode(curl_exec($ch));
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if ($statusCode != 200) {
   if (isset($oResult) and isset($oResult->error)) {
      print "Error in $apiServer: \nCode: {$oResult->error->code}\nMessage: {$oResult->error->message}\n";
   }
   else {
      print "Error: HTTP status code: $statusCode\n";
   }
}
curl_close($ch);