Assignments
Work with personal Assignments in Targetprocess with REST API
Retrieve Assigned Users for Entity
Let's have a look at a sample User Story. Assignments area is shown in the right column.
The following query allows to retrieve all users assigned to a user story, including their names and roles:
GET /api/v1/UserStories/1234?include=[Assignments[GeneralUser,Role]]
Set Assignments to an Entity
Post Role
and User
references to Assignments
section.
POST /api/v1/UserStories/
Content-Type: application/json
{
"Id": 1234,
"Assignments":{"Items": [
{"GeneralUser":{"Id":1},"Role":{"Id":1}},
{"GeneralUser":{"Id":15},"Role":{"Id":8}}
]}
}
An alternative way to create an Assignment is to make a POST
to Assignments
collection. In addition to Role
and User
, reference an Assignable
.
POST /api/v1/Assignments/
Content-Type: application/json
{
"GeneralUser":{"Id":15},
"Role":{"Id":1},
"Assignable":{"Id":1234}
}
Delete Assignment from an Entity
To unassign a User from an Entity, find the Id
of the Assignment.
GET /api/v1/assignments?where=(Assignable.Id eq 1234)
Send a DELETE
request to unassign a User.
DELETE /api/v1/assignments/2926
To unassign several users, send POST
request with X-HTTP-Method-Override: DELETE
.
POST /api/v1/assignments/bulk
X-HTTP-Method-Override: DELETE
Content-Type: application/json
[
{"Id":2924},
{"Id":2925}
]
Updated 10 months ago