cancel
Showing results for 
Search instead for 
Did you mean: 

REST APIs and documentation

b_victor
Champ in-the-making
Champ in-the-making
Hello,
I'm integrating with a standalone Alfresco 4.2 from an external client app written in Java.  I've had great luck with the CMIS API using OpenCMIS with extensions.  I'm having more difficulty figuring out if I'm doing things right for some of my needs, though.

Specifically, my app needs to two more things, and I'm not really sure where to begin:
1) Get user and group info, to include membership in certain groups.
2) Kick off advanced workflows (that I've written), and get the status of these workflows via an API


For item (1), I'm able to do these things, but am not sure if I'm doing them right.  I'm using the Google HTTP API, and parsing JSON into objects using a tutorial I found by Jeff Potts - good stuff, thanks.  But, I think I'm mixing APIs/URLs, and am basically just fumbling around because I haven't found Alfresco documentation on which URLs I should be using.  For example, I can get user info from both of these URLs:

a) http://<hostname:port>/alfresco/service/api/people/<user>
b) http://<hostname:port>/alfresco/api/-default-/public/alfresco/versions/1/people/<user>
aside) http://<hostname:port>alfresco/api/people <— I can't authenticate to this one… are these the old ones?

But the JSON objects returned are different formats.  Which should I be using?  What is the difference between these urls, so I have my terminology correct?  It also seems like those urls in the form of (b) are less powerful, in that I haven't figured out how to do things like get members of a group using the 'api' urls.

For item (2), I'm not really sure where to begin.  I need to, for example, kick off a workflow passing in some parameters from my application into the workflow (i.e. email addresses for users outside of Alfresco, etc.) Can these things be done through a REST API?  Is there some documentation that shows how to tackle a task like this?

I'm sure I'm missing something here, I'm pretty new to Alfresco dev, so I appreciate any nudges in the right direction.
Thanks much,
BV
1 REPLY 1

jpotts
World-Class Innovator
World-Class Innovator
Thanks for reading the tutorial.

When you see a URL that includes "public" that is part of the Public API. You can find documentation on that here:
https://www.alfresco.com/cmis/browser?id=workspace%3A//SpacesStore/b09d212a-00c6-4ec3-9764-0eca67bb8...

When possible, you should use the public API.

As you are finding out, it isn't always possible. So you can go to http://localhost:8080/alfresco/service/index and browse out-of-the-box web scripts. The caution here is that many of those web scripts are not public. They are subject to change without notice.

You can browse web scripts by lifecycle at this URL: http://localhost:8080/alfresco/service/index/lifecycle/

You need to stick to "public_api" and "draft_public_api" if at all possible.

Another approach to consider, and this would work for your people/groups requirement as well as your workflows requirement, is to create your own custom web scripts. Those web script controllers can then use the Alfresco JavaScript API or Alfresco Java API to do what you need to do. The nice thing about that is that you are in full control of the HTTP part of the API and your controllers are using standard API to do what needs to be done.

For this reason, it is recommended that you use the Public API first, custom web scripts second, and then the out-of-the-box web scripts.

Jeff