cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve a content of a workflow?

arak
Confirmed Champ
Confirmed Champ
Hi everyone,

I have a workflow where I have audio content. I need to access for this content in other application (with javascript). I am trying with a GET method to this URL:

http://localhost:8086/alfresco/service/cmis/s/SpacesStore/i/1a7be6f8-0c50-4995-a211-1736642db06a/chi...

(In this URL, the id "1a7be6f8-0c50-4995-a211-1736642db06a" is the identificator of the package of the workflow task.)

But, the response is the next XML:


<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:cmisra="http://docs.oasis-open.org/ns/cmis/restatom/200908/" xmlns:cmis="http://docs.oasis-open.org/ns/cmis/core/200908/" xmlns:alf="http://www.alfresco.org" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
<author><name>admin</name></author>
<generator version="4.2.0 (r56674-b4848)">Alfresco (Community)</generator>
<icon>http://localhost:8086/alfresco/images/logo/AlfrescoLogo16.ico</icon>
<id>urn:uuid:1a7be6f8-0c50-4995-a211-1736642db06a-children</id>
<link rel="service" href="http://localhost:8086/alfresco/service/cmis'/>
<link rel="self" href="http://localhost:8086/alfresco/service/cmis/s/SpacesStore/i/1a7be6f8-0c50-4995-a211-1736642db06a/chi...>
<link rel="via" href="http://localhost:8086/alfresco/service/cmis/s/workspace:SpacesStore/i/1a7be6f8-0c50-4995-a211-173664...>
<link rel="up" href="http://localhost:8086/alfresco/service/cmis/s/workspace:SpacesStore/i/13dd8d00-4ccd-4894-87fc-0b055c..." type="application/atom+xml;type=feed"/>
<link rel="down" href="http://localhost:8086/alfresco/service/cmis/s/workspace:SpacesStore/i/1a7be6f8-0c50-4995-a211-173664..." type="application/cmistree+xml"/>
<link rel="http://docs.oasis-open.org/ns/cmis/link/200908/foldertree" href="http://localhost:8086/alfresco/service/cmis/s/workspace:SpacesStore/i/1a7be6f8-0c50-4995-a211-173664..." type="application/atom+xml;type=feed"/>
<title>1a7be6f8-0c50-4995-a211-1736642db06a Children</title>
<updated>2015-05-27T11:18:13.600-04:00</updated>
<opensearch:totalResults>0</opensearch:totalResults>
<opensearch:startIndex>0</opensearch:startIndex>
<opensearch:itemsPerPage>-1</opensearch:itemsPerPage>
<cmisra:numItems>0</cmisra:numItems>
</feed>


I don't know how to use this XML for my purpose.

How to retrieve a content of a workflow? There is some RESTful URL for this ?

Thanks for any help.

Greetings,
Pablo.
1 REPLY 1

arak
Confirmed Champ
Confirmed Champ
Finally, I resolve my questions using other RESTful URL. So, the steps to retrieve a content of a workflow is the next:

1. I get the package ID (this is a folder node) of the task of workflow:

GET /alfresco/service/api/task-instances/activiti$taskID


    {
       "data":
          {
             "id": "activiti$taskID",
             "url": "api\/task-instances\/activiti$taskID",
             "name": "wf:taskName",
             "title": "Task for this",
             "description": "Hello World !",
             "state": "IN_PROGRESS",
             "path": "api\/workflow-paths\/activiti$workflowID",
             "isPooled": false,
             "isEditable": true,
             "isReassignable": true,
             "isClaimable": false,
             "isReleasable": false,
             "outcome": null,
             "owner":
             {
                "userName": "admin",
                "firstName": "Admin",
                "lastName": "istrator"
             },
             "properties":
             {
                "bpm_percentComplete": 0,
                "bpm_description": "Hello World !",
                "bpm_hiddenTransitions": [],
                "bpm_package":"workspace:\/\/SpacesStore\/1a7be6f8-0c50-4995-a211-1736642db06a",
           …………………………………………………..
    }


So, the package ID is: 1a7be6f8-0c50-4995-a211-1736642db06a

2. With the package ID, I get the content which I need of this package:

GET /alfresco/service/slingshot/node/workspace/SpacesStore/1a7be6f8-0c50-4995-a211-1736642db06a


    ………………………………………   
    "children": [
          {
             "name": {
                "name": "{http:\/\/www.alfresco.org\/model\/content\/1.0}grabacion1.mp3",
                "prefixedName": "cm:grabacion1.mp3"
             },
             "nodeRef": "workspace://SpacesStore/9ed7905d-7017-40e9-9514-93244b0a9a6a",
             "type": {
                "name": "{http:\/\/www.alfresco.org\/model\/content\/1.0}content",
                "prefixedName": "cm:content"
             },
             "assocType": {
                "name": "{http:\/\/www.alfresco.org\/model\/bpm\/1.0}packageContains",
                "prefixedName": "bpm:packageContains"
             },
             "primary": false,
             "index": 0
          }
       ],
    ………………………………………


So, the content ID is: 9ed7905d-7017-40e9-9514-93244b0a9a6a

3. Finally, I get the content which I need:

GET /alfresco/service/api/node/content/workspace/SpacesStore/9ed7905d-7017-40e9-9514-93244b0a9a6a

If you need access to the properties of the content, you can use the URL of the step two with the content ID (in this example: 9ed7905d-7017-40e9-9514-93244b0a9a6a).

Greetings Smiley Happy