Assignee endpoints

The following REST endpoints are available to manage the assignees (users and groups) of tasks:

Get Assignees of Task: GET /project/{prj_uid}/activity/{act_uid}/assignee

Lists the users and groups assigned to a task.

GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee?filter={string}&start={number}&limit={number}

URL Parameters:

NameDescriptionExample
workspaceWorkspace name, which is workflow by default. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/assignee
prj_uidUnique ID of the project (process), which can be found by looking at the @@PROCESS variable in the Debugger while running a case. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/assignee
act_uidUnique ID of the task, which can be found by looking at the @@TASK variable in the Debugger while running a case. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/assignee
start={number}Optional. The initial position of the assignees in the list, where 0 is the first assignee, 1 is the second, etc. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/assignee?start=1&limit=10
limit={number}Optional. The maximum number of assignees returned./api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/assignee?start=11&limit=10
filter={string}Optional. A search term to filter the list of assignees. It is a case-insensitive search inside the first name, last name and username of users and the names of groups. Make sure to URL encode the searched text in UTF-8, with a function like urlencode() in PHP or encodeURIComponent() in JavaScript, so that characters like " " (space) becomes %20 and "?" becomes %F3./api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/assignee?filter=product%20manager

Result:

If successful, returns an HTTP status code of 200 (OK) and returns a JSON string containing an array of assignee objects, such as:
ElementDescription
[ Start array.
{ Start first assignee object.
"aas_uid": "8f30daa78a440ab308727ca33381a545",Unique ID of the user or group assigned to the task.
"aas_name": "James",First name of the user or the name of a group, with its number of members in parentheses.
"aas_lastname": "Johnson",Last name of a user. If a group, then "" (empty string).
"aas_username": "james",Username of the user or the name of a group, with its number of members in parentheses.
"aas_type": "user"Type of assignee, which can be "user" or "group".
} End first assignee object.
... Any additional assignee objects.
] End array.

Note: This endpoint can also be called for subprocesses, but it will always return an empty array, because users and groups can not be assigned to subprocesses.

Example:

Response

200 (OK)
Content-Type: application/json
[
  {
    "aas_uid": "4e2745a3fdbd977d1339862ae390ad13",
    "aas_name": "Mark",
    "aas_lastname": "Smith",
    "aas_username": "mark",
    "aas_type": "user"
  },
  {
    "aas_uid": "60108982451ae53bc5786b3013937849",
    "aas_name": "John",
    "aas_lastname": "Doe",
    "aas_username": "jdoe",
    "aas_type": "user"
  },
  {
    "aas_uid": "157493645523b4c00067b67020029802",
    "aas_name": "Managers (3 Users)",
    "aas_lastname": "",
    "aas_username": "Managers (3 Users)",
    "aas_type": "group"
  }
]

PHP Example:
Print out a list of the users and groups assigned to a task:

$processId = '3818779375772ec1f183320075303646';
$taskId = '6537449955772ec4b9705a4019286874';

$url = "/api/1.0/workflow/project/$processId/activity/$taskId/assignee";
$oRet = pmRestRequest("GET", $url);
if (if (isset($oRet->status) and $oRet->status == 200) {
   print "<p>Users assigned:</p>\n<ol>";
   foreach ($oRet->response as $oUser) {
     if ($oUser->aas_type == "group")
        print "<li>" .$oUser->aas_name. "</li>\n"; else //if a user: print "<li>" .$oUser->aas_name.' '.$oUser->aas_lastname."</li>\n";
    } print "</ol>\n"; }

Get Page of Assignees to Task: GET /project/{prj_uid}/activity/{act_uid}/assignee/paged

Gets a page of the users and groups assigned to a task.

GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged?filter={string}&start={number}&limit={number}

URL Parameters:

Name Description Example
workspace Workspace name, which is workflow by default. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/assignee/paged
prj_uid Unique ID of the project (process), which can be found by looking at the @@PROCESS variable in the Debugger while running a case. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/assignee/paged
act_uid Unique ID of the task, which can be found by looking at the @@TASK variable in the Debugger while running a case. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/ 679814870573f92e6509f59003354333/assignee/paged
start={number} Optional. The initial position of the assignees in the list, where 0 is the first assignee, 1 is the second, etc. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/assignee/paged? start=1&limit=10
limit={number} Optional. The maximum number of assignees returned. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/assignee/paged?start=11& limit=10
filter={string} Optional. A search term to filter the list of assignees. It is a case-insensitive search inside the first name, last name and username of users and the names of groups. Make sure to URL encode the searched text in UTF-8, with a function like urlencode() in PHP or encodeURIComponent() in JavaScript, so that characters like " " (space) becomes %20 and "?" becomes %F3. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/assignee/paged? filter=product%20manager

Result:

If successful, returns an HTTP status code of 200 (OK) and returns a JSON string containing a page of assignee objects.

Note: This endpoint can also be called for subprocesses, but it will always return an empty array, because users and groups can not be assigned to subprocesses.

Example:

Response

200 (OK)
Content-Type: application/json
{
  "total":  3,
  "start":  0,
  "limit":  0,
  "filter": "",
  "data":   [
    {
      "aas_uid": "4e2745a3fdbd977d1339862ae390ad13",
      "aas_name": "Mark",
      "aas_lastname": "Smith",
      "aas_username": "mark",
      "aas_type": "user"
    },
    {
      "aas_uid": "60108982451ae53bc5786b3013937849",
      "aas_name": "John",
      "aas_lastname": "Doe",
      "aas_username": "jdoe",
      "aas_type": "user"
    },
    {
      "aas_uid": "157493645523b4c00067b67020029802",
      "aas_name": "Managers (4 Users)",
      "aas_lastname": "",
      "aas_username": "Managers (4 Users)",
      "aas_type": "group"
    }
  ]
}

PHP Example:
Get the number of assignees to a task:

$processId = '3818779375772ec1f183320075303646';
$taskId = '6537449955772ec4b9705a4019286874';

$url = "/api/1.0/workflow/project/$processId/activity/$taskId/assignee?limit=0";
$oRet = pmRestRequest("GET", $url);
if (if (isset($oRet->status) and $oRet->status == 200) {
   $totalAssignees = $oRet->response->total;
   print "<p>$totalAssignees users assigned to task.</p>\n";
}

Get Available Assignees for Task: GET /project/{prj_uid}/activity/{act_uid}/available-assignee

Gets the list of available users and groups that may be assigned to a task.

GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-assignee?filter={string}&start={number}&limit={number}

URL Parameters:

Name Description Example
workspace Workspace name, which is workflow by default. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/available-assignee
prj_uid Unique ID of the project (process), which can be found by looking at the @@PROCESS variable in the Debugger while running a case. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/available-assignee
act_uid Unique ID of the task, which can be found by looking at the @@TASK variable in the Debugger while running a case. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/ 679814870573f92e6509f59003354333/available-assignee
start={number} Optional. The initial position of the assignees in the list, where 0 is the first assignee, 1 is the second, etc. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/available-assignee? start=1&limit=10
limit={number} Optional. The maximum number of assignees returned. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/available-assignee?start=11& limit=10
filter={string} Optional. A search term to filter the list of assignees. It is a case-insensitive search inside the first name, last name and username of users and the names of groups. Make sure to URL encode the searched text in UTF-8, with a function like urlencode() in PHP or encodeURIComponent() in JavaScript, so that characters like " " (space) becomes %20 and "?" becomes %F3. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/available-assignee? filter=product%20manager

Result:

If successful, returns an HTTP status code of 200 and returns a JSON string containing an array of assignee objects, such as:

Element Description
[ Start array.
{ Start first assignee object.
"aas_uid": "8f30daa78a440ab308727ca33381a545", Unique ID of the user or group assigned to the task.
"aas_name": "James", First name of the user or group, with the number of its members in parentheses.
"aas_lastname": "Johnson", Assignee's last name. If a group, then "" (empty string).
"aas_username": "james", Username of the user or the name of a group, with its number of members in parentheses.
"aas_type": "user" Type of assignee, which can be "user" or "group".
} End first assignee object.
... Any additional assignee objects.
] End array.

Note: If this endpoint is called for a subprocess, it will return all the users and groups in the workspace.

Example:

Response

200 (OK)
Content-Type: application/json
[
  {
    "aas_uid":      "8f30daa78a440ab308727ca33381a545",
    "aas_name":     "James",
    "aas_lastname": "Johnson",
    "aas_username": "james",
    "aas_type":     "user"
  },
  {
    "aas_uid":      "184131195492c7a04cba5f9056989964",
    "aas_name":     "Mary",
    "aas_lastname": "Rose",
    "aas_username": "mary",
    "aas_type":     "user"
  },
  {
    "aas_uid":      "1846526764c8905435c74e2028286704",
    "aas_name":     "Employees (4 Users)",
    "aas_lastname": "",
    "aas_username": "Employees (4 Users)",
    "aas_type":     "group"
  }
]

PHP Example:
Get the list of users of a task and then choose one of them at random to assign to the task:

$processId = '3818779375772ec1f183320075303646';
$taskId = '6537449955772ec4b9705a4019286874';
$userId = '679814870573f92e6509f59003354333';

$url = "/api/1.0/workflow/project/$processId/activity/$taskId/available-assignee";
$oRet = pmRestRequest("GET", $url);
if (isset($oRet->status) and $oRet->status == 200) {
   $aUsers = array();
   //only copy users into the array:
   for ($i = 0; $i < count($oRet->response); $i++) {
      if ($oRet->response[$i]->aas_type == 'user')
         $aUsers[] = $oRet->response[$i]->aas_uid;
   }
   if (count($aUsers) == 0)
      die("No users to assign to task");

   $randNo = rand(0, count($aUsers)-1);
   $url = "/api/1.0/workflow/project/$processId/activity/$taskId/assignee";
   $aParams = array(
      'aas_uid' => $aUsers[$randNo],
      'aas_type'=> 'user'
   );
   $oRet = pmRestRequest("POST", $url, $aParams);
}

Get Page of Available Assignees for Task: GET /project/{prj_uid}/activity/{act_uid}/available-assignee/paged

Gets a page of the available users and groups that may be assigned to a task.

GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-assignee/paged?filter={string}&start={number}&limit={number}

URL Parameters:

Name Description Example
workspace Workspace name, which is workflow by default. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/available-assignee/paged
prj_uid Unique ID of the project (process), which can be found by looking at the @@PROCESS variable in the Debugger while running a case. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/available-assignee/paged
act_uid Unique ID of the task, which can be found by looking at the @@TASK variable in the Debugger while running a case. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/ 679814870573f92e6509f59003354333/available-assignee/paged
start={number} Optional. The initial position of the assignees in the list, where 0 is the first assignee, 1 is the second, etc. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/available-assignee/ paged? start=1&limit=10
limit={number} Optional. The maximum number of assignees returned. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/available-assignee/ paged?start=11& limit=10
filter={string} Optional. A search term to filter the list of assignees. It is a case-insensitive search inside the first name, last name and username of users and the names of groups. Make sure to URL encode the searched text in UTF-8, with a function like urlencode() in PHP or encodeURIComponent() in JavaScript, so that characters like " " (space) becomes %20 and "?" becomes %F3. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/available-assignee/ paged? filter=product%20manager

Result:

If successful, returns an HTTP status code of 200 and returns a JSON string containing an array of assignee objects, such as:

Element Description
{ Start page object.
"total": 3, Total number of available assignees of the task.
"start": 0, Index number of the first assignee returned.
"limit": 0, The maximum number of assignees that will be returned.
"filter": "", A search string that filters assignees who are returned.
"data": [ An array of the available assignees.
{ Start first assignee object.
"aas_uid": "8f30daa78a440ab308727ca33381a545", Unique ID of the user or group assigned to the task.
"aas_name": "James", First name of the user or group, with its number of its members in parentheses.
"aas_lastname": "Johnson", Last name of a user. If a group, then "" (empty string).
"aas_username": "james", Username of the user or the name of a group, with the number of its members in parentheses.
"aas_type": "user" Type of assignee, which can be "user" or "group".
} End first assignee object.
... Any additional assignee objects.
] End array.
} End page object.

Note: If this endpoint is called for a subprocess, it will return all the users and groups in the workspace.

Example:

Response

200 (OK)
Content-Type: application/json
{
  "total":  3,
  "start":  0,
  "limit":  0,
  "filter": "",
  "data":   [
    {
      "aas_uid":      "8f30daa78a440ab308727ca33381a545",
      "aas_name":     "James",
      "aas_lastname": "Johnson",
      "aas_username": "james",
      "aas_type":     "user"
    },
    {
      "aas_uid":      "184131195492c7a04cba5f9056989964",
      "aas_name":     "Mary",
      "aas_lastname": "Rose",
      "aas_username": "mary",
      "aas_type":     "user"
    },
    {
      "aas_uid":      "1846526764c8905435c74e2028286704",
      "aas_name":     "Employees (3 Users)",
      "aas_lastname": "",
      "aas_username": "Employees (3 Users)",
      "aas_type":     "group"
    }
  ]
}

PHP Example:
Get the list of users of a task and then choose one of them at random to assign to the task:

$processId = '3818779375772ec1f183320075303646';
$taskId = '6537449955772ec4b9705a4019286874';

$url = "/api/1.0/workflow/project/$processId/activity/$taskId/available-assignee/paged";
$oRet = pmRestRequest("GET", $url);
if (isset($oRet->status) and $oRet->status == 200) {
   $aUsers = array();
   //only copy users into the array:
   for ($i = 0; $i < count($oRet->response); $i++) {
      if ($oRet->response->data[$i]->aas_type == 'user')
         $aUsers[] = $oRet->response->data[$i]->aas_uid;
   }
   if (count($aUsers) == 0)
      die("No users to assign to task");

   $randNo = rand(0, count($aUsers)-1);
   $url = "/api/1.0/workflow/project/$processId/activity/$taskId/assignee";
   $aParams = array(
      'aas_uid' => $aUsers[$randNo],
      'aas_type'=> 'user'
   );
   $oRet = pmRestRequest("POST", $url, $aParams);
}

Get Assignee to Task: GET /project/{prj_uid}/activity/{act_uid}/assignee/{aas_uid}

Gets a single user or group assigned to a task.

GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/{aas_uid}

URL Parameters:

Name Description Example
workspace Workspace name, which is workflow by default. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/ assignee/11609821854ca4355344560009542371
prj_uid Unique ID of the project (process), which can be found by looking at the @@PROCESS variable in the Debugger while running a case. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/ assignee/11609821854ca4355344560009542371
act_uid Unique ID of the task, which can be found by looking at the @@TASK variable in the Debugger while running a case. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/ 679814870573f92e6509f59003354333/ assignee/11609821854ca4355344560009542371
aas_uid Unique ID of the assignee (user or group). /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/ assignee/ 11609821854ca4355344560009542371

Result:

If successful, returns an HTTP status code of 200 and returns a JSON string containing an assignee object, such as:

Element Description
{ Start assignee object.
"aas_uid": "8f30daa78a440ab308727ca33381a545", The unique ID of the user or group assigned to the task.
"aas_name": "James", First name of the user or group, with its number of members in parentheses.
"aas_lastname": "Johnson", Last name of a user. If a group, then "" (empty string).
"aas_username": "james", Username of the user or the name of a group, with the number of its members in parentheses.
"aas_type": "user" Type of assignee, which can be "user" or "group".
} End assignee object.

If unsuccessful, returns an error object such as:

{
  "error": {
    "code":    400,
    "message": "Bad Request: Record not found for id: 4716284485775a22f911111008384981"
  }
}

Example:

Response

200 (OK)
Content-Type: application/json
{
  "aas_uid":      "4e2745a3fdbd977d1339862ae390ad13",
  "aas_name":     "Mark",
  "aas_lastname": "Smith",
  "aas_username": "mark",
  "aas_type":     "user"
}

PHP Example:
Check if a user with the ID "4716284485775a22f911111008384981" is assigned to a task:

$processId = '3818779375772ec1f183320075303646';
$taskId = '6537449955772ec4b9705a4019286874';
$userId = '4716284485775a22f911111008384981';

$url = "/api/1.0/workflow/project/$processId/activity/$taskId/assignee/$userId";
$oRet = pmRestRequest("GET", $url);
if (if (isset($oRet->status) and $oRet->status == 200) {
   $name = $oRet->response->aas_username;
   print "User $name already assigned to task.\n";
}

Get All Users Assigned to Task: GET /project/{prj_uid}/activity/{act_uid}/assignee/all

Gets the list of all the users who are assigned to a task (including users that are within groups).

GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/all?filter={string}&start={number}&limit={number}

URL Parameters:

Name Description Example
workspace Workspace name, which is workflow by default. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/assignee/all
prj_uid Unique ID of the project (process), which can be found by looking at the @@PROCESS variable in the Debugger while running a case. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/assignee/all
act_uid Unique ID of the task, which can be found by looking at the @@TASK variable in the Debugger while running a case. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/ 679814870573f92e6509f59003354333/assignee/all
start={number} Optional. The initial position of the assignees in the list, where 0 is the first assignee, 1 is the second, etc. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/assignee/ all? start=1&limit=10
limit={number} Optional. The maximum number of assignees returned. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/assignee/ all?start=11& limit=10
filter={string} Optional. A search term to filter the list of assignees. It is a case-insensitive search inside the first name, last name and username of users and the names of groups. Make sure to URL encode the searched text in UTF-8, with a function like urlencode() in PHP or encodeURIComponent() in JavaScript, so that characters like " " (space) becomes %20 and "?" becomes %F3. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/assignee/ all? filter=product%20manager

Result:

If successful, returns an HTTP status code of 200 and returns a JSON string containing an array of assignee objects, such as:

Element Description
[ Start array.
{ Start first assignee object.
"aas_uid": "8f30daa78a440ab308727ca33381a545", Start array.
"aas_name": "James", First name of the user or group, with its number of members in parentheses.
"aas_lastname": "Johnson", Last name of a user. If a group, then "" (empty string).
"aas_username": "james", Username of the user or the name of a group, with the number of members in parentheses.
"aas_type": "user" Type of assignee, which can be "user" or "group".
} End first assignee object.
... Any additional assignee objects.
] End array.

Warning: This endpoint has an outstanding bug and always returns a response of NULL.

Example:

Response

200 (OK)
Content-Type: application/json
[
  {
    "aas_uid":      "4e2745a3fdbd977d1339862ae390ad13",
    "aas_name":     "Mark",
    "aas_lastname": "Smith",
    "aas_username": "mark",
    "aas_type":     "user"
  },
  {
    "aas_uid":      "60108982451ae53bc5786b3013937849",
    "aas_name":     "Jane",
    "aas_lastname": "Doe",
    "aas_username": "jdoe",
    "aas_type":     "user"
  },
  {
    "aas_uid":      "157493645523b4c00067b67020029802",
    "aas_name":     "Managers (2 Users)",
    "aas_lastname": "",
    "aas_username": "Managers (2 Users)",
    "aas_type":     "group"
  }
]

Assign to Task: POST /project/{prj_uid}/activity/{act_uid}/assignee

Assigns a user or group to a task.

Permission:

Users must have the PM_FACTORY permission assigned to their role to perform this action.

Structure:

POST /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee

URL Parameters:

Name Description Example
workspace Workspace name, which is workflow by default. /api/1.0/workflow/project/276544696573f9457cd0983094962709/activity/679814870573f92e6509f59003354333/assignee
prj_uid Unique ID of the project (process), which can be found by looking at the @@PROCESS variable in the Debugger while running a case. /api/1.0/workflow/project/276544696573f9457cd0983094962709/activity/679814870573f92e6509f59003354333/assignee
act_uid Unique ID of the task, which can be found by looking at the @@TASK variable in the Debugger while running a case. /api/1.0/workflow/project/276544696573f9457cd0983094962709/activity/679814870573f92e6509f59003354333/assignee

POST Parameters:

Element Description
{
"aas_uid": "8f30daa78a440ab308727ca33381a545", The unique ID of the user or group to assign.
"aas_type": "user", Type of assignee, which can be "user" or "group".
"aas_name": "James", Optional. First name of the user or the name of the group.
"aas_lastname": "Johnson", Optional. Assignee's last name. If a group, then "" (empty string).
"aas_username": "james" Optional. Assignee's username. If a group, then "" (empty string).
}

Result:

If successful, returns an HTTP status code of 201 (Created) and there is no response; otherwise, the HTTP status code is set to 400 and an error object is returned, such as:

{
  "error": {
    "code":    400,
    "message": "Bad Request: This ID: 4716284485775a22f911111008384981 is already assigned to task: 6537449955772ec4b9705a4019286874"
  }
}

Example:

Request

Content-Type: application/json
{
  "aas_uid":  "977d1339862ae390ad134e2745a3fdbd",
  "aas_type": "user"
}

Response

201 (Created)

PHP Example:

$processId = '3818779375772ec1f183320075303646';
$taskId = '6537449955772ec4b9705a4019286874';
$userId = '4716284485775a22f911111008384981';

$aParams = array(
      "aas_uid" => $userId,
     "aas_type"=> "user"
);
$url = "/api/1.0/workflow/project/$processId/activity/$taskId/assignee";
$oRet = pmRestRequest("POST", $url, $aParams);
if (!isset($oRet->status) or $oRet->status != 201) {
   die("Error: Unable to assign user to task.");
}

Remove Assignee from Task: DELETE /project/{prj_uid}/activity/{act_uid}/assignee/{aas_uid}

Removes an assignee (user or group) from a task.

Permission:

Users must have the PM_FACTORY permission assigned to their role to perform this action.

Structure:

DELETE /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/{aas_uid}

URL Parameters:

Name Description Example
workspace Workspace name, which is workflow by default. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/ assignee/11609821854ca4355344560009542371
prj_uid Unique ID of the project (process), which can be found by looking at the @@PROCESS variable in the Debugger while running a case. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/ assignee/11609821854ca4355344560009542371
act_uid Unique ID of the task, which can be found by looking at the @@TASK variable in the Debugger while running a case. /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/ 679814870573f92e6509f59003354333/ assignee/11609821854ca4355344560009542371
ass_uid Unique ID of the assignee (user or group). /api/1.0/workflow/project/276544696573f9457cd0983094962709/ activity/679814870573f92e6509f59003354333/ assignee/ 11609821854ca4355344560009542371

Result:

If successful, returns an HTTP status code of 200 (OK) and there is no response. If the user/group is not assigned to the task, then the HTTP status code is set to 400 and the following response is returned:

{
  "error": {
    "code":    400,
    "message": "Bad Request: This row does not exist!"
  }
}

Example:

Response

200 (OK)

PHP Example:

$processId = '3818779375772ec1f183320075303646';
$taskId = '6537449955772ec4b9705a4019286874';
$userId = '4716284485775a22f911111008384981';

$url = "/api/1.0/workflow/project/$processId/activity/$taskId/assignee/$userId";
$oRet = pmRestRequest("DELETE", $url);
if (!isset($oRet->status) or $oRet->status != 200) {
   print "Error: Unable to remove user from task.\n";
   print_r($oRet);
   die;
}