Is it possible to fetch task assign to user and also the document which is related to that task in a single query or in one call

0 votes

1 answers

1700 views

ANSWER



You can use the targetDocumentIds fetch property on the task endpoint like this:

curl -X GET 'https://yourServer/nuxeo/api/v1/task?userId=userId' -H 'accept: text/plain,application/json, application/json'  -H 'Connection: keep-alive' -H 'X-NXfetch.task: targetDocumentIds,actors' -u user:password

I thought it was documented in https://doc.nuxeo.com/ but I can't find it anymore. I created https://jira.nuxeo.com/browse/NXDOC-1313 to update the doc.

0 votes



Note that you can also fetch the actors
09/08/2017

Is it possible with javaScript client??
09/09/2017

Yes, please refer to https://doc.nuxeo.com/nxdoc/javascript-client/. Note that the http headers go in the options:

var options = {
      method: "get",
      headers: {
         "X-NXfetch.task": "targetDocumentIds,actors"
      }
 };
request
        .path("task")
        .queryParams({"userId": "yourUserId"})
        .execute(options)
        .then(function(response) { ... }.bind(this));
09/11/2017

Thanks
09/11/2017