Developing a simple JavaScript client using the Alfresco REST API - Development environment setup

Document created by alfresco Employee on Mar 16, 2017Last modified by alfresco Employee on Mar 27, 2017
Version 5Show Document
  • View in full screen mode

This content is part of the tutorial describing how to develop a very simple JavaScript client using the Alfresco 5.2 REST APIs. In this document is described how to setup the development environment. To better describe the tasks, we are going to use “a step by step“ approach, more practical and easy to follow for our goal.

 

Prerequisites

 

Before starting the description of the development environment setup, let's share some prerequisites. First of all we assume that you have available Alfresco Content Services 5.2 and the Alfresco API Explorer, up and running. There are no specific requirements and setup for both the softwares.

 

We suggest to have the Alfresco instance installed into the same server/machine of the development environment. It's not mandatory in general, but be aware the provided source code assumes this as a prerequisite. If you decide to use two different servers/machines please remember to change the localhost in every URL.

   

 

In this task we're going to use an environment based on Ubuntu 16.04 LTS, though all the described tasks are valid for all Linux based, Windows based, and Mac OS X platforms. Tests and screenshots are based on tests developed on this specific environment.

 

Installing Microsoft Visual Studio

 

Once Alfresco Content Services 5.2 is up an running, together with the Alfresco API Explorer, it's time to setup the IDE for the development. In this specific case we're going to use Microsoft Visual Studio. It's free in its Community version, it is supported for the most common platforms (Linux-based platforms included) and it works well with JavaScript based projects. It's not mandatory to use this IDE in particular, but be aware it has been used in all the following content.

 

Installing the Microsoft Visual Studio Community is very straightforward. Below the steps to follow, to complete the task.

 

  1. Download Visual Studio for Linux here. A tar.gz file will be downloaded.
  2. Extract the tar.gz file to the target path (in our case ~ or /home/<user> path). A folder called VSCode-linux-x64 will be extracted.
  3. Run the code executable to open Visual Studio Code. You should see a black window appearing into you desktop.
  4. (Optional) Create a symbolic link to conveniently run code from the terminal:
    sudo ln -s ~/VSCode-linux-x64/code /usr/local/bin/code

 

Installing Postman

 

Now that Microsoft Visual Studio for Linux is installed into your development environment, we're going to setup Postman REST client. Postman is released as a Chrome App which means that Postman can only run on the Chrome browser. So to use Postman, you'll first need to install Google Chrome.

 

If you already have Chrome installed, head over to Postman’s page on the Chrome Webstore, and click Add to Chrome. The download should take few minutes, depending on your internet connection. Once you’ve downloaded the app, launch Postman. Here the description on how to launch it in all the available platforms.

 

Checking the environment

 

How can we be sure everything is working properly? Let's test it with the tasks described below. 

 

This test is a first access to Alfresco REST APIs using Postman. To try it into your environment, open Postman and select Basic Auth in the Type field in the Authorization tab. In the URL input (on top of the panel) enter the following link:

http://<alfresco IP>:<alfresco port>/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children

Then click Send and you should see something similar to the following screenshot.

 

 

If this is confirmed, then congratulations! You've successfully installed everything needed to test the new Alfresco REST APIs.

 

Next task - Authenticating over Alfresco using the Alfresco REST API >>

Attachments

    Outcomes