In this procedure, we walk through the necessary setup to configure your local system and the Aspera on Cloud Platform (AoC) so that you can make API calls to the Activity application.

There are two main procedures:

To download the source code used in this tutorial, click here.

md5: 4ed52cb297cdc5669b11ff5624749387 sha1: 6396f0e5f25fcc42560c858b841507a7dceb9e9f

I. Obtain the Necessary Elements for Authorization

  1. In terminal, create a directory called analytics-api-demo, move into that directory, and create the files that will contain the source code for this procedure.
    mkdir analytics-api-demo
    cd analytics-api-demo
    touch get_analytics_data.rb authentication.rb get_organization.rb constants.rb Gemfile
  2. Generate private and public keys.
    Note: To maintain security, Aspera recommends that you do not use version control to track files that contain security information. This includes the private and public keys that you create in this step. Example keys shown in this tutorial are included for purposes of demonstration only and are no longer valid.

    ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key

    The following prompt appears:

    Enter passphrase (empty for no passphrase)

    To create a key without a passphrase, press Enter twice.


    If the process is successful, you have two new files in analytics-api-demo:

    • jwtRS256.key (private)
    • jwtRS256.key.public (public)

    The contents of the jwtRS256.key file now contains something like the following:

    ----BEGIN RSA PRIVATE KEY----
     MIIJKAIBAAKCAgEAruUNXup4eDrlb0+VfhM7r+PYOd8ca8sLYPTSI5TOyZ0yqS1/
     /zUvVRnSSE+ueHme9U7voaT3dxWQ6iQ0iLyHX/6qhiqGIRXmVRM646P+smpIiGZd
     . . .
     5Q/wfd/V+ZMCQSWa3sFX5LaReBhdY8+vZPoexqhRv/hnOYDRSUWr4NKUhJTf5hOM
     /AXjlDxVrTv7f76SKRQDWVu8bobntWqU4wZYM/Q0NRxm7Wlk3nv+YCkX4yVgEWJT
     Iz6wEq7CbpiFdRUFVDnWnaWnQaJXWbFqXwhHZqY/YfzJhod929Sry2n3UD0=
     ----END RSA PRIVATE KEY----

    The contents of the jwtRS256.key.public file now contains something like the following:

    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCu5Q1e6nh4OuVvT5V+Ezuv49g53xxrywtg9NIjlM7JnTK
    /qqGKoYhFeZVEzrjo/6yakiIZl0ReRfD9JMtS6o5d3ElniX6fCd6eg/12//dEVUlPbslUJ1OLcJfMnEOnmwJ
    . . .
    uiQGt5HZ/y11o3V9wBpbrq+lHdcReV14+QwiqysvzzbeQFYxjOKe1IoxfdY8540gxjC7stpzohMpEUYj/JsCr
    QBvjB+ZjCsYQZJoreKRZ2W9p4ce81vKtCuAdl0PM4dlZcwkzs74QAqQ==name@users-MacBook-Pro.local
  3. Configure the public key to work with Open SSL:
    openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub</code class="ibm-padding-top-1">

    The jwtRS256.key.pub file will now contains something like the following:

    -----BEGIN PUBLIC KEY-----
    MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAruUNXup4eDrlb0+VfhM7
    r+PYOd8ca8sLYPTSI5TOyZ0yqS1//zUvVRnSSE+ueHme9U7voaT3dxWQ6iQ0iLyH
    . . .
    uJ4lCNiwzLHsEAb4wfmYwrGEGSaK3ikWdlvaeHHvNbyrQrgHZdDzOHZUAYqmXMFO
    LaPtGc4xNsOOpk5M7O+EAKkCAwEAAQ==
    -----END PUBLIC KEY-----

II. Create an Integration with AoC

  1. Go to *.ibmaspera.com, where * represents your subdomain. Your subdomain is unique to your organization in Aspera on Cloud. In this tutorial, turbo is used as an example subdomain.
  2. Organization menu category and click Integrations, then click Create New. A new integration form opens.
  3. Fill out the form with appropriate values for your integration.
      • Enter a name for your integration.
      • Enter values for Redirect URIs and Origins. If you do not already have a designated value for each, enter a placeholder value, such as www.company.com. (These values are not needed for using the API, but they are required fields in the current template.) After you enter each value, it appears under a Name header.

  4. When done, click Save.You now see a newly created Profile for your integration.
    • Click the submenu JSON Web Token Auth (next to Profile).
    • Select the check-box for Enable JWT grant type.
    • From the Allowed keys dropdown, select User-specific keys and global key.
  5. In the pop-up that appears, click Yes to confirm that you want to permit global keys.A field called Public Key (PEM Format) appears.
  6. Copy the complete contents of analytics-api-demo/*.key.public—which you created in the previous section on this page—into this field, then click Save.

    Keep this page in the Admin App open.

  7. Add the constants listed below to the file constants.rb.The values in this list are example values, only. To locate the correct values for your configuration, consult the table below.

    You will find some of the values you need on your Integrations page.

    Where to find the constant values:

    Key Value Example Value
    CLIENT_ID Found in the “Client info” section on your Integrations page BNMWnBP3Sg
    CLIENT_SECRET Found in the “Client info” section on your Integrations page ‘RpRQHCCzLOMsFo7pyCegd2W58FxmRSep’
    USER_EMAIL Your email address ‘nedflanders26@gmail.com’
    ORGANIZATION_ID The ID for your organization in Aspera on Cloud. If you do
    not know your organization ID, see the Files API call in the
    sample code file, get_organization.rb (see the link at the top of this page).
    23355
    ORGANIZATION_SUBDOMAIN The subdomain in your organization’s URL turbo
  8. Now that you have completed the setup process, go to Installing Dependencies for the Activity API.