cancel
Showing results for 
Search instead for 
Did you mean: 

CMIS getContent Example

jmaher
Champ in-the-making
Champ in-the-making
I'm trying to use CMIS's getContent REST service to retrieve a document (let's say it's at /Company Home/content/stuff/file.txt). I'm having trouble finding examples of how to populate parameters for the call. Can anyone either provide an example or point me to one on the web?

Via the Alfresco Service Explorer (/alfresco/service/index/family/CMIS), I see the following for the getContent service:

GET /alfresco/service/cmis/i/{id}/content{property}?a={attach?}&streamId={streamId?}
GET /alfresco/service/cmis/s/{store}/i/{id}/content{property}?a={attach?}&streamId={streamId?}
GET /alfresco/service/cmis/p{path}/content{property}?a={attach?}&streamId={streamId?}
GET /alfresco/service/cmis/s/{store}/p{path}/content{property}?a={attach?}&streamId={streamId?}
GET /alfresco/service/api/node/content{property}/{store_type}/{store_id}/{id}?a={attach?}&streamId={streamId?}
GET /alfresco/service/api/path/content{property}/{store_type}/{store_id}/{nodepath}?a={attach?}&streamId={streamId?}
GET /alfresco/service/api/avmpath/content{property}/{store_id}/{avmpath}?a={attach?}&streamId={streamId?}
GET /alfresco/service/api/node/{store_type}/{store_id}/{id}/content{property}?a={attach?}&streamId={streamId?}
GET /alfresco/service/api/path/{store_type}/{store_id}/{nodepath}/content{property}?a={attach?}&streamId={streamId?}

Not sure how to populate some of these parameters and that's why an example would be helpful.
5 REPLIES 5

jpotts
World-Class Innovator
World-Class Innovator
If you are using Alfresco 4.x, please do not use the web script URLs for CMIS. Those are deprecated. Instead, use the OpenCMIS implementation. The end-point for the AtomPub binding is http://localhost:8080/alfresco/s/cmisatom.

Do you need to make your calls via raw REST or can you use a client-side library like OpenCMIS?

If you need to do it via raw REST calls, the call to get the content stream looks like this:
http://localhost:8080/alfresco/cmisatom/b1e2f7f4-2e66-4741-9bea-3df01f9d491f/content/Project%20Contr...

where:
b1e2f7f4-2e66-4741-9bea-3df01f9d491f: Your repository ID
Project%20Contract.pdf: Your file name
workspace%3A%2F%2FSpacesStore%2F723a4950-ccaa-4d5c-b180-0f63cbbc010d%3B1.0: The object ID of the object you are retrieving

Jeff

wabson
Star Contributor
Star Contributor
Small correction to to Jeff's post - the OpenCMIS endpoint is http://localhost:8080/alfresco/cmisatom (i.e. no 's' prefix).

Cheers,
Will

So where can I get the object ID from?
Why do I need to use CMIS, all I want is to retrieve content, is the simple REST api enough?

Thanks
-Anthony

The Alfresco guys will know better but, as I understand, as CMIS is becoming the "standard" API for all types of ECM implementations, your client code will be more portable.  Since the CMIS APIs are designed to be brand/product agnostic, using the "Alfresco" REST API, locks your client application to only work with Alfresco repositories.  You can get more information from here http://www.manning.com/mueller/ (the best reference you'll find on CMIS and no I don't work for Alfresco or Manning).  We are, however, heavy users of Alfresco with CMIS (Apache Chemistry OpenCMIS libraries).

kaynezhang
World-Class Innovator
World-Class Innovator
Why not just use object path ?
You have serveral options to  get a node's Id:
Option 1. In alfresco explorer node list click 'View details' and then click 'Alfresco Node Reference'
Option 2. login as administrator In alfresco explorer.open the admin console, and then click node browser.