When a ask for some task definition, through the REST API (like http://localhost:8080/engine-rest/process-instance/166bee75-256a-11e3-8f83-c90b0dec1df8) it retrieve information about the task I asked for. But, if I want to assign that task to a user using following parameters
POST /engine-rest/task/166bee75-256a-11e3-8f83-c90b0dec1df8/assignee HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Cache-Control: no-cache
{"id":"anne.grant"}
it returns an error code ( 404 - Not found ) whit this description:
The requested resource (Could not find resource for relative : /task/166bee75-256a-11e3-8f83-c90b0dec1df8/assignee of full path: http://localhost:8080/engine-rest/task/166bee75-256a-11e3-8f83-c90b0dec1df8/assignee) is not available
So, now I'm wonder what goes wrong ... ? According with documentation, it's possible to assign a task to a user doing what I did but I don't know if there are something missing. So, if anyone can help me through this I will appreciate. Thanks!
And yes, I'm using embedding REST API on my own JAX-RS application and I do have included the TaskRestServiceImpl class on it as well as some other classes as explained in http://doc.camunda.org/latest/api-references/rest#overview-embedding-the-api reference. As a matter of facts, it was when I tried to probe my application that I detected that error. But then, I tried directly from deployed Camunda REST API (http://localhost:8080/engine-rest) and the same error was thrown.
You're right about process instance id isn't the same task id; but then, first I got the task list and the server returned something like this
Task Definition
{
"id": "166f49e3-256a-11e3-8f83-c90b0dec1df8",
"name": "Invoice",
"assignee": null,
"created": "2013-09-24T17:38:52",
"due": null,
"delegationState": null,
"description": null,
"executionId": "166bee75-256a-11e3-8f83-c90b0dec1df8",
"owner": null,
"parentTaskId": null,
"priority": 50,
"processDefinitionId": "process:1:6f1b59a3-2558-11e3-8f83-c90b0dec1df8",
"processInstanceId": "166bee75-256a-11e3-8f83-c90b0dec1df8",
"taskDefinitionKey": "invoice"
}
So, if I try to use the task id and assign the task to an user
POST /engine-rest/task/166f49e3-256a-11e3-8f83-c90b0dec1df8/assignee HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Cache-Control: no-cache
{"id":"anne.grant"}
the server response with the same error ( 404 - Not found
The requested resource (Could not find resource for relative : /task/166f49e3-256a-11e3-8f83-c90b0dec1df8/assignee of full
path: http://localhost:8080/engine-rest/task/166f49e3-256a-11e3-8f83-c90b0dec1df8/assignee) is not available ) but there isn't any server side exception.
It is weird because I performed some other actions like add a group, update group profile, delete a group, create an user, update his profile information, start a process and all of them using deployed Camunda REST API and with no errors but when I try to assign some task is when the API doesn't work.
Here are my answers to your questions:
1. Do you see the same error when you issue GET /task/166f49e3-256a-11e3-8f83-c90b0dec1df8 ?
Nope, when I request task information by id it return the correct information I was expecting for.
2. What version of the camunda classes jar are you using?
7.0.0-alpha9
3. What JAX-RS implementation are you using your application with and what container is it running in?
I'm not quite sure about the implementation but I guess it's RESTEasy since I'm working with JBoss to build my application. As container I also use JBoss ( 7.1.3 )
4. What do you mean with "I tried directly from deployed Camunda REST API"?
Did you try to deploy the camunda rest war file in your environment or
did you try one of the prepackaged distributions from camunda.org?
I meant one of the prepackaged distributions from camunda.org. As a matter of facts, I downloaded prepackaged JBoss from camunda.org so now I have two servers (one for my own app and the other for camunda projects). I know that I can run both my own application and camunda project onto the same JBoss Server but I prefer to have them separated from each other.
Hope this can help. And thank you for taking some time to see this. Best regards!