Developing a simple JavaScript client using the Alfresco REST API

Showing results for 
Search instead for 
Did you mean: 

Developing a simple JavaScript client using the Alfresco REST API

Alfresco Employee
2 1 5,452

AlfrescoAlfresco platform, since 5.2. version, introduces a new set of REST APIs that you can use to easily build custom applications or REST clients on top of it.


The new REST APIs take a new approach on both development and consistency. We've moved to a “Contract First” model where we define OpenAPI Specification (formerly known as Swagger) for all endpoints, which then goes through extensive reviews before implementation starts. This ensures that we have consistency across all our APIs, making them easier to consume.


The new APIs are also versioned and we have strict policies in place on not breaking backwards compatibility, while still allowing additive changes without changing the version number. The first version of the APIs is Version 1, and therefore you will see the APIs being referenced as the “v1 REST APIs” moving forward.


A side effect of wrapping the v1 REST APIs in OpenAPI Specification is that we can leverage Swagger UI to generate interactive documentation. We call this the REST API Explorer and it is a great tool to explore our APIs.

We have introduced a new set of REST APIs in 5.2 and we're very excited to share them with you. Start watching the video below for more details.


Video Link : 1103

Basis and references about the Alfresco REST API

To understand the basis and find a lot of useful references about the Alfresco 5.2 REST APIs, there is a nice page (written and maintained by Gavin Cornwell‌ and Jan Vonka‌) collecting a lot of resources, including documentation, examples, presentations, etc. Our suggestion is to look at this content first, and then move to this example describing an practical exercise using the REST services over the Alfresco Content Services.

Developing a JavaScript client on top of the Alfresco REST API

The goal of this practical example is to share how to develop a very simple JavaScript client on top of the Alfresco Content Services, of course, using the REST API. We all agree that in most cases would be preferable to use a framework instead of a "low level development", but this example has the purpose to share the basis of the interaction between a client and the REST services.

To better describe the tasks, we are going to use “a step by step“ approach, more practical and easy to follow for our goal. Below the complete list of tasks to follow to create your first Javascript client on top of the Alfresco Content Services.

  1. Defining the development environment.
  2. Authenticating over Alfresco using the Alfresco REST API.
  3. Introducing the JavaScript client to list nodes.
  4. How to upload new content.
  5. How to preview the content.


All the content available in this tutorial has been developed and tested using Alfresco Content Services 5.2. Below the full list of platforms, languages, frameworks and tools.

  • Linux Ubuntu 16.04.01 LTS as Operating System.
  • Alfresco Community Edition 201611-EA release for Linux (running on port 8080).


Each variation to the listed versions and tools could affect the success of the tutorial, even if the involved technologies and tasks have been defined to be as more general as possible, not related to any specific context or platform. Please let us know for any issue or problem, requesting for support into the Community Portal dedicated to the Alfresco ECM.

1 Comment