Post

2 followers Follow
0
Avatar

How to assign (and unassign) a resource to a task

I've seen this thread (https://success.clarizen.com/hc/en-us/community/posts/203993568-Assigning-a-Resource-to-a-task-with-api-) but it uses SOAP.

I want to know how to assign and unassign resources from a task using REST API.

Couldn't find any examples.

Joberto Diniz Answered

Please sign in to leave a comment.

1 comment

1
Avatar

Hi Joberto,

Here is a CURL sample for that.

The first command insert a project first, creates a task under it and attaches a resource. I used the bulk service to issue 3 commands at once.

Notice I used the parent field with the id of the parent (with the Clarizen format of object ids. The ids here are arbitrary. ). Similarly, I used the recently created task id and a resource ID to create the link between them.

The second CURL command deletes the resource (using the ID I specified on the first command).

Hope this helps,

Ophir

Curl https://api2.clarizen.com/v2.0/services/bulk/execute -X POST -d {
"requests": [{
"url": "data/objects/Project",
"method": "put",
"body": {
"Name": "Hi",
"id": "/project/31c031d07e7c4ab08dda6410feed75ab"
}
},
{
"url": "data/objects/Task",
"method": "put",
"body": {
"Name": "Hi son",
"Parent": "/project/31c031d07e7c4ab08dda6410feed75ab",
"id": "/task/907698e7-126a-4e66-bec5-13de5c7b829b"
}
},
{
"url": "data/objects/RegularResourceLink",
"method": "put",
"body": {
"workitem": "/task/907698e7-126a-4e66-bec5-13de5c7b829b",
"resource": "/user/1s5ncdbyt4lzxgwahl4eeyta37404",
"id": "/regularResourceLink/3d40812b-90f3-4d55-9953-5bb8a3ebc000"
}
}]
}


Curl https://api2.clarizen.com/v2.0/services/data/objects/regularResourceLink/3d40812b-90f3-4d55-9953-5bb8a3ebc000 -X DELETE -d null

 

Ophir Kenig 1 vote
Comment actions Permalink