Setting Up a Session

The Arcadia Enterprise Admin API supports two alternatives for setting up a session: standard login access and APIKey access.

You have two options for setting up a session in Arcadia Data:

Standard Login Access

To establish a session with username/password login, use the following code:
username = (user name as obtained from external source)
password = (password as obtained from external source)

session = requests.session()
response = session.get(login_url)
session.headers['referer'] = response.url
payload = {'username':username,
           'csrfmiddlewaretoken':session.cookies['arccsrftoken']}, data=payload)

Note that the login URL has the form [http|https]:/host:port/arc/apps/login. For syntax of other parameters, see Admin API Syntax Parameters.

APIKey Access

To establish a session through the Arcadia API Key system and avoid the login process, use the following code:

apikey = (apikey string)

session = requests.session()
session.headers['AUTHORIZATION'] = 'apikey %s' % apikey
In this approach, the client code must obtain the ArcViz access key through a client-controlled mechanism, then add the APIKey to the request header and avoid explicit login.

Fetch Data from All Datasets in the System

After setting up a session, you can fetch the entire data from all datasets in the system, by using the following code:

response = session.get(api_url + 'datasets?detail=1')
datasets = response.json()

Note that the API URL has the form [http|htttps]://host:port/arc/adminapi/version. Use the URL option 'detail=true' to fetch all information in the GET call.