Anand Rajagopal
Anand Rajagopal

Reputation: 1633

Is it possible to retrieve content with API from Alfresco

I want to retrieve the content details with API from Alfresco.

From alfresco document I got the following rest url. But I don't know how to get all the content id's from alfresco.

GET alfresco/api/-default-/public/cmis/versions/1.1/atom/content?id={content_id}

It would be grateful if someone explains me.

Upvotes: 0

Views: 3111

Answers (4)

Naman
Naman

Reputation: 2203

You can take reference of this Recursively get all content file names under a folder in Alfresco 5.0 (by WebScripts)

Just change getChildren.get.json.ftl to

{
    "totalItems": "${totalItems}",
    "nodes":
    [<#list results as node>
        {
            "id" : "${node.id}"
        }<#if (node_index + 1 < results?size)>,</#if>
     </#list>
    ]
}

You will get content id's of all document of specific folder.

Upvotes: 0

Krutik Jayswal
Krutik Jayswal

Reputation: 3175

you can use nodeservice and searchservice to retrieve all node's id in alfresco.you can find usefull method in below links.

http://dev.alfresco.com/resource/docs/java/org/alfresco/service/cmr/repository/NodeService.html

If you are using rest api than you may need to create your custom webscript(alfresco provides rest api using webscript) in alfresco to retrieve all node from alfresco document repository and than using that response you can call above.

Upvotes: 0

henrik
henrik

Reputation: 1618

Each node (node = document or folder) with alfresco has a "NodeRef" property. That's the unique id to use.

You can obtain the NodeRef in many different ways:

  • When searching for objects in a tree, you get back an array with objects as result (including NodeRef properties)
  • When creating an object with the API, the return is an object reference
  • By using the web admin GUI, you can look at the details of a file or folder and see the different properties for that file/folder. NodeRef should be one of the properties listed in the GUI.

Once you know the NodeRef you can access your content with the url like this (example)

/alfresco/api/-default-/public/cmis/versions/1.1/atom/content?id=824ba7cd-dcee-4908-8917-7b6ac0611c97

The returned object should be the node content.

Upvotes: 2

Related Questions