Alfresco RESTful API Web Script URL examples
October 20, 2011 16:52:33 Last update: October 20, 2011 16:54:17
Alfresco RESTful URLs provided by Web Scripts are extensively documented, but examples are hard to come by. This makes it hard to ramp up for beginners. Here are some examples I tested on 3.4.4 enterprise edition and 4.0a community edition, with the results documented.
- To list the available scripts:
http://localhost:8081/alfresco/service/index
There's a Refresh Web Scripts button at the bottom of the page. If you add a Web Script, you need to click that button in order for the system to know about your addition.
- To get information about the root folder (
Company Home):http://localhost:8081/alfresco/service/cmis/p
- To get information about the folder
Data Dictionary:http://localhost:8081/alfresco/service/cmis/p/Data%20Dictionary
- To get information about the folder
Data Dictionary/Space Templates:http://localhost:8081/alfresco/service/cmis/p/Data%20Dictionary/Space%20Templates
You get the idea.
- To list the children of
Data Dictionary:http://localhost:8081/alfresco/service/cmis/p/Data%20Dictionary/children
This works for 3.4.4 enterprise edition but not 4.01 community edition. The number of children returned is always 0 for the latter.
- Another documented way to list the children of root folder
Company Home. I was not able to make it work in either 3.4.4 enterprise or 4.0a community. These are the variations I tried:http://localhost:8080/alfresco/s/api/path/workspace/SpacesStore/Company%20Home/children http://localhost:8080/alfresco/s/api/path/Workspace/SpacesStore/Company%20Home/children http://localhost:8080/alfresco/service/api/path/Workspace/SpacesStore/Company%20Home/children http://localhost:8080/alfresco/service/api/path/workspace/SpacesStore/Company%20Home/children http://localhost:8080/alfresco/service/api/path/workspace/SpacesStore/children http://localhost:8080/alfresco/service/api/path/workspace/SpacesStore//children
All of them returned Web Script Status 404 - Not Found.
- To get the contents of a file:
http://localhost:8080/alfresco/service/cmis/p/<path>/<to>/<file>/<file_name>/content
Remember "Company Home" is root, sopath/to/filedoes not need to include "Company Home".
- To get the contents of a file without logging in:
http://localhost:8080/alfresco/service/cmis/p/<path>/<to>/<file>/<file_name>/content?guest=true
This works if read access to the file is granted to guest (such as adding guest as a consumer to the containing Space).