cancel
Showing results for 
Search instead for 
Did you mean: 

REST API > link between nodes and processes

JC83
Confirmed Champ
Confirmed Champ

Hello,

Thanks to the API I'm now able to list all the nodes and all the processes .. 

but I can't find any link between those 2 entities ..

How could I find the processes associated with a given node ?

How could I find the associated node of a given process ?

Thanks !

4 REPLIES 4

angelborroy
Community Manager Community Manager
Community Manager

Processes are composed of Tasks. Tasks are associated to documents.

You need to find a task on a process and to use the "items" REST API.

For instance, for task 79...

http://127.0.0.1:8080/alfresco/api/-default-/public/workflow/versions/1/tasks/79/items

        "entry": {
          "createdAt": "2022-01-12T13:42:55.268+0000",
          "size": 107376,
          "createdBy": "admin",
          "modifiedAt": "2022-01-12T13:42:56.389+0000",
          "name": "from-ecm-to-content-services.pdf",
          "modifiedBy": "admin",
          "id": "2e53740f-5bef-442b-8319-1e7150341318",
          "mimeType": "application/pdf"
        }

... there is one document associated with located in workspace://SpacesStore/2e53740f-5bef-442b-8319-1e7150341318

Hyland Developer Evangelist

thanks !

I cannot find any tasks of completed processes ..

I don't see any filter in ../processes/id/tasks allowing to show "completed" tasks ..

Another question : what if we have several version of the document. How can I see the version which was concerned but a given process ?

# curl -s  "http://server/alfresco/api/-default-/public/workflow/versions/1/processes/1088180" |  jq ''
{
  "entry": {
    "processDefinitionId": "validationHierarchique:159:1072212",
    "durationInMs": 256863,
    "startUserId": "JC205236",
    "startActivityId": "alfrescoStartevent1",
    "endedAt": "2022-01-07T09:07:23.000+0000",
    "startedAt": "2022-01-07T09:03:06.000+0000",
    "id": "1088180",
    "completed": true,
    "endActivityId": "terminateendevent1",
    "processDefinitionKey": "validationHierarchique"
  }
}
# curl -s "http://server/alfresco/api/-default-/public/workflow/versions/1/processes/1088180/tasks" |  jq ''
{
  "list": {
    "pagination": {
      "count": 0,
      "hasMoreItems": false,
      "totalItems": 0,
      "skipCount": 0,
      "maxItems": 100
    },
    "entries": []
  }
}

angelborroy
Community Manager Community Manager
Community Manager

Once a process has been completed, you need to use the process API, since there is no "live" task.

For instance, for process 33:

http://127.0.0.1:8080/alfresco/api/-default-/public/workflow/versions/1/processes/33/items

I guess there is no direct invocation to get the version used for that task / process. You need to calculate that from dates and version REST API.

Hyland Developer Evangelist

thanks ..

Ok .. it's nearly done ..

I try to compare process endedDate with version "modifiedAt" date ... 

Is this the right comparison to do ?

It seems not

Here 3 versions .. I cannot know the one to choose ..

Completed #1084545 on value: Progress Report # 12 v1.2.docx (nodeRef=679a519e-3cc4-481d-8e87-c1d8638034b8) by JB221813 type=validationHierarchique:159:1072212
process end date = 2022-01-10T09:45:09.000+0000
v1.2 @ 2022-01-04T08:55:10.559+0000 diff=-521399(s)
v1.1 @ 2022-01-03T10:14:18.144+0000 diff=-603051(s)
v1.0 @ 2021-11-16T15:05:11.080+0000 diff=-4732798(s)

When there is only one version, thoses date are not the same..

Completed #1082664 on   value: blabla.docx (nodeRef=74a503c8-0074-4ed3-9bf5-38be710db8f8) by HR124135 type=validationHierarchique:159:1072212
  process end date = 2022-01-10T14:38:58.000+0000
   v1.0 @ 2021-12-22T15:35:33.971+0000 diff=-1638205(s)