Arcadia Visualization Server REST API interfaces, authentication methods, and settings

Today we provide 3 main REST API interface’s for programmatically working with Arcadia:

  • Admin API
    An interface to access ArcViz server objects, such as users , groups , roles , datasets , segments , filter associations , connections , and visuals.

  • Import/Export (Migration) API
    A REST API interface to migrate ArcViz visual objects, such as apps, dashboards, visuals, datasets, date ranges, static assets, custom styles, custom date ranges, and custom color palettes

  • Data API
    A REST API interface to fetch data from Arcadia datasets.

API Authentication Methods

With each of our REST API interfaces, you can also choose between two forms of authentication:

  • API Key
  • Session

API Key Example:

import requests

### SETUP #####
## Provide Arcadia Configuration

arcadia_url = "http://<my hostname>:38888"
arcadia_apikey_secret = "<my api key secret>"
arcadia_dataconnection_name = "Arcengine"
json_file_path = "/path/to/file/dashboard.json"


### IMPORT DASHBOARDS ###
## Setup Import Request (via API Key)

headers= {"AUTHORIZATION":"apikey " + arcadia_apikey_secret}
payload = {"dry_run": True, "dataconnection_name": arcadia_dataconnection_name}
files = {"import_file": open(json_file_path,"r")}
response = requests.post(arcadia_url + "/arc/migration/api/import/",files=files, data=payload, headers=headers)

print(response.status_code) # status code 200 is good

Session based example:

import requests


### SETUP #####
## Provide Arcadia Configuration

arcadia_url = "http://<my hostname>:38888"
username = "myusername"
password = "mypassword"
arcadia_dataconnection_name = "Production Arcengine"
json_file_path = "path/to/file/dashboard.json"

### IMPORT DASHBOARDS ###
## Setup Session Request

session = requests.session()
referrer_response = session.get(arcadia_url + "/arc/apps/login")
session.headers["referrer"] = referrer_response.url
payload = {"username": username,
           "password": password,
           "csrfmiddlewaretoken": session.cookies["arccsrftoken"]}
session.post(arcadia_url + "/arc/apps/login", data=payload)

## Setup Import Request

payload["dry_run"] = True, 
payload["dataconnection_name"] = arcadia_dataconnection_name
files = {"import_file": open(json_file_path,"r")}
response = session.post(arcadia_url + "/arc/migration/api/import/",files=files, data=payload)

print(response.status_code) # status code 200 is good

Enabling REST API settings

In Cloudera Manager (CDH) you can enable REST API settings by adding them to the Arcadia Visualization Server Advanced Configuration Snippet (Safety Valve) settings_cm.py box:

In Ambari (HDP) you can REST API settings by adding them to the Arcviz Settings box:

Turning on API Keys

To turn on the administration page for creating API keys in Arcadia, you will need to add this setting:

ENABLE_API_KEYS = True

Enabling the Admin API and Apidemo interface

The Admin API is accessible by either Session based authentication (using username and password) or API key if enabled. The Admin API gives you the choice to access all endpoints (’*’) or a list of endpoints for you to choose.

ADMIN_API_URL_LIST = ['*']

You can also choose to enable our friendly Demo interface for testing and using the Admin REST API by adding the setting below, along with the endpoints you wish to enable on that page:

ADMIN_API_DEMO_LIST = ['*']

The Apidemo page can be accessed at http://<hostname>:38888/arc/apps/apidemo:

If you want to disable Session based authentication with the Admin API, you can also add this setting:

ADMINAPI_REQUIRE_APIKEY = False # If True disable session access to adminapi

Enabling the Import / Export (Migration) API

There are no special settings that are needed to enable the Import and Export REST API. However if you plan to use API Keys you will need to enable them first.

Enabling the Data API

To turn on the Data API REST interface, you will need to add this setting:

DATA_API_ENABLED = True

1 Like