Documentation deprecated: This documentation is no longer being updated as of 3.8.0. For up-to-date information, see the guide information in the IBM Developer Community and the endpoint reference in IBM API Explorer.

Node+Connect Example

Node and Connect allows you to offer file operations to your clients through a web application.  A server is used to communicate between the client and the Node server.  This server simply receives a request from the client (using POST data) and returns the JSON from the Node server for the client to process.  

This document covers two possible setups.  The first setup assumes you have a web server and will simply host a normal web application on that server that will communicate with your client-side JavaScript.  The second setup gives you the ability to create a single application that provides all aspects of the system (client side GUI, server side logic, and web server).  Both use the same general concept for communicating and loading the page, however, the single application includes extra code for handling the server side operations and rendering the HTML.  You can simply switch between types in the server side section below.  It should also be noted that if you use the all-in-one approach you will not need to use the Client Side setup section below since the frontend is implemented in the server side code.

With the first setup (web application) all of the HTML is handled client side and the server is only receiving requests and returning the Node JSON to the client.  Essentially:

  1. Client initiates session (visits webpage)
  2. JavaScript sends POST data to server side web application
  3. Server side web application requests data from Node
  4. Server side web application sends Node data back to JavaScript
  5. JavaScript parses data accordingly
  6. JavaScript changes the HTML accordingly

The example below shows how to implement either a PHP, .NET (C#), Java or Ruby version of this server side web application.  In this example the server side code is very minimalistic since the bulk of the work is handled in JavaScript.  The server is mainly for authorizing against Node, you could think of it as a 'middle-man' between Node and JavaScript.  This example uses AJAX to get the data and perform operations without needing to reload the page and uses jQuery for targeting elements and creating a clean, user friendly interface.

With this approach we can offer the ability to download multiple files by clicking each file or the "Download All" button under the cog (simultaneous downloads), as well as uploading multiple files.  When download/uploads take place the area behind them turns into their progress bars to provide a clean, minimalistic design.

For the web application the JavaScript code remains the same regardless of the server side language.  To implement this example on your own machine you simply need to copy the code for your preferred server language and change the global variables. JavaScript handles most of the work including parsing the JSON using JSON.parse() which is supported in all modern browsers and includes support for Internet Explorer 8+ and Firefox 3.5+.  If you need to support earlier versions we recommend using jQuery.parseJSON() which can be found in jQuery 1.4.1+, which supports Internet Explorer 6+.

Server Side Setup

Depending on your needs you can either use a full server approach or a regular web application. The full server approach is a single application that serves as its own web server and the one application provides everything for delivering the site. The HTML, JavaScript and CSS are embedded in the application code and this does not require the server being used to have any web server service (IIS or Apache) running. If you choose the regular web application you can simply run the server side web application like any other web application in your environment (this does not provide any HTML, JavaScript or CSS and needs the code found in the Client Site Setup Section.

Once you know what type of web server you are going to use you need to simply copy and paste the code below for your setup into your web server and compile it (if needed).  Simply choose your language below to get the code.  Remember to change the global variables to match your Node setup.  Since some languages require you to run on a different port or your setup may have your server side web application on a different domain you need to consider CORS (Cross Origin Resource Sharing).  As part of the server side web application a "Access-Control-Allow-Origin" header is returned stating what domains can pull resources from this server.  In the example we have it setup to "*" which means any, however, for security you should change this to the list of specific domains that are allowed to pull resources from your server side web application.

To begin, choose your preferred language and then choose whether you want the full server application (self serving, all-in-one application) or just the Web Application (basic web application for talking to Node and JavaScript).


  • In addition to a normal PHP 5 Server you need the php-curl extension
    • If using a WAMP bundle php-curl was already installed
    • In Linux install php5-curl using your preferred package manager
    • Remember to restart your web server service after installing php-curl




  • In addition to a normal PHP 5 Server you need the php-curl extension
    • If using a WAMP bundle php-curl was already installed
    • In Linux install php5-curl using your preferred package manager
    • Remember to restart your web server service after installing php-curl




  • In addition to a normal Ruby install, you need the following gems
    • Sinatra (sudo gem install sinatra)
    • JSON/Pure (sudo gem install json_pure)


  • In addition to a normal Ruby install, you need the following gems
    • Sinatra (sudo gem install sinatra)
    • JSON/Pure (sudo gem install json_pure


To use this you will need to simply create an ASPX single file page and host it on a Windows machine with IIS. For more information on setting up IIS in Windows please see the IIS Installation Guide.



This C# program does not use any third party dependencies and instead uses the HttpListener Class. This class can run on any Windows machine since Windows Server 2003 or Windows XP Service Pack 2. To use this program simply compile the Command Line application and run it as an Administrator in Command Prompt. To stop the program type STOP in the command prompt.



This Java Servlet can be ran as a regular Servlet in any Java web server (like Tomcat or Glassfish). It can also be converted into a JSP file if you would prefer to use a JSP file instead of a Servlet.



This Java Server application runs as a standalone Java application. Simply compile it (javac -g [name].java) and run it on your server (java [name]). When started it will simply state what port (defined in the code) it is using and you can then go to the page in any web browser by going to [serveraddress]:[port].


Client Side Setup

Most likely you will use the same web server to host your server side web application as you do for the client side files.  However, you can use any server for the server side web application and any server for your client side website; you can also use any CMS or markup.

The client side example is made up of three parts, the JavaScript, HTML markup, and CSS.  The CSS in the example is not important as it is just for the style of the page and you will use your own CSS in your product.  The HTML markup is also not that important and as long as you can easily target a few items with jQuery you can design it any way.  For example, we use a table for listing the files, however, you could use an unordered list or any other structure that allows you to iterate its content (including custom divs).

The example below uses Bootstrap for its design, however, this is not required and pure HTML or any framework can be used.  We have also includes some extra functions for creating a more 'user friendly' experience; like cleanSize and cleanDate which takes the raw information and turns it into a more friendly format (if you wish to use this in your code you may need to alter the output to match your locale. This example uses US English), we have also includes functions that allow you to sort by columns as well as search the content of the current directory; these are optional and can be removed if not desired.

To understand what the JavaScript does we have includes detailed comments above each function that explains its purpose.  We recommend reading over these functions to understand their purpose.  However, if you plan to use the code as is you should remove the comments before releasing to a live environment or minifying the file to help with performance.

To view the source for the JavaScript or HTML click the tabs below.  We have also includes a tab that contains the CSS, however, this has no affect on the use of the example it is just styling and is provided for copy and pasting purposes only.  It is important to note that the HTML is relatively basic and there are only a few areas that hold data from the JavaScript and must have proper IDs that match the JavaScript code.  Please see the comments in the HTML for more information.



Using Node API with Azure

This guide will show you how to use Connect and the Aspera Node API with Azure Storage and Aspera Server on Demand for Azure.  This guide assumes you already have a Windows Azure account and have access to create storage accounts and purchase add-ons from the Azure Store. For a full Azure example with Connect please see the Azure Connect Sample.

Setup an Azure Storage Account

  1. From the Azure Management Portal select the "STORAGE" link on the left hand side of the navigation pane
  2. Click the "New (+)" link at the bottom of the page. 
  3. Click "Quick Create" and give the storage account a name and choose a region.
  4. Once the storage account has been created you can select it within the management portal. With your storage account selected, click "Manage Keys" at the bottom of the page. A dialog will come up showing you 2 important pieces of information that you should note:
    • AZURE_STORAGE_ACCOUNT_NAME: The name you gave the Storage account
  5. Close the Access Key Management dialog, select your newly-created storage from the list and click on "CONTAINERS" in the upper-middle of the screen.  Click on "New" again in the lower left, and name a BLOB container for your storage.

Purchase the Aspera on Demand Add-On From the Azure Store

  1. From the Azure Management Portal select the "ADD-ONS" link on the left hand side of the navigation pane 
  2. Click the "New (+)" button at the bottom of the page
  3. Select the "STORE" link on the left hand side of the page
  4. Select "Aspera on Demand"  from the list of add-ons
  5. Click the "next" arrow, give the service a name and complete the purchase of the Aspera on Demand Service.  Once the Aspera on Demand service is purchased it will show up in your list of purchased ad-ons.
  6. Select the service you just created from the list of purchased services and then click the "MANAGE" link at the bottom of the page.
  7. You will be at a page that allows you to create one or more sets of credentials. Click the "New User Credential" button. Give the new credential set a description and select your desired availability zone from the drop-down list. You will be presented with 4 important pieces of information that you need to note:
    • ASPERA_ON_DEMAND_HOST_NAME: (Host) host name of the Aspera on Demand Server to use 
    • ASPERA_ON_DEMAND_USERNAME: (User) A long string
    • ASPERA_ON_DEMAND_PRIMARY_ACCESS_KEY:  (Password) a long string
    • AZURE_BLOB_CONTAINER:  (Container ID) a long string
  8. Click the Save button

Coding/Configuration for Using Azure Services with Aspera Connect

For demonstrations we use the Aspera-Node-Connect example below to illustrate this. There are just a few changes that need to be made for this example to work with Azure Services.

  1. Change the Node username to the ASPERA_ON_DEMAND_USERNAME you obtained from the Aspera On Demand add-on you purchased above
  2. Change the Node password to the ASPERA_ON_DEMAND_PRIMARY_ACCESS_KEY you obtained from the Aspera On Demand add-on you purchased above
  3. Change the Node Server Name to the ASPERA_ON_DEMAND_HOST_NAME you obtained from the Aspera On Demand add-on you purchased above
  4. Formulate an Azure storage account URL from the Azure Storage Account you created above. This URL has the following format:
    1. azu:// /BLOB_CONTAINER
      • AZURE_STORAGE_ACCOUNT_NAME is replaced by the value of the Azure Storage Account Name retrieved above
      • AZURE_STORAGE_PRIMARY_ACCESS_KEY is replaced by the value of the Azure Storage Primary Access Key retrieved above (value below should be URL Encoded)
      • BLOB_CONTAINER is replaced by the value of the Azure Blob Container retrieved above
  5. In your code: set the destination_root in your Node API requests to the Azure URL from above
  6. For uploads, In your Aspera Connect transfer specification definition replace the destination_root with the Azure URL from above
  7. For downloads, In your Aspera Connect transfer specification definition replace the source_root with the Azure URL from above

Below is the Azure Service compatible Node-Connect Demo code with placeholders for the changes mentioned above

 Customize Code


Code Generation

To generate the code on this page to your needs, please fill out the fields below.

Powered by ChronoForms -


Getting Node Transfer Statistics from Azure

This page shows you how to perform a server to server transfer using the Node API.  You can download the sample code by clicking here.  

It is important to note that the Azure Stats API is not the same as the Reliable Query API and that Azure Stats API is only guaranteed to retrieve data from the point in time that the process starts running. You should start with a starting (0000000000000000) iteration token and continue to use the returned iteration tokens for continued monitoring for each API call.

You are able to query the Azure cluster to get the transfer status using a REST API resource (/services/rest/transfers/v1/info) which will return a JSON object with the transfer's info (if any). The response also contains an "iteration_token" which should be used for subsequent queries. For example, if the cluster is, then the endpoint to query for stats will be The first thing to do is to request an iteration token (HTTP GET /services/rest/transfers/v1/info) and use the the iteration token in subsequent queries (/services/rest/transfers/v1/info) with a payload containing the iteration token. 

Retreiving stats from an endpoint


Getting statistics and printing them to console

Video player