In addition to the UI-enabled migration (export/import), Arcadia Enterprise provides REST APIs that give more flexibility in choosing what objects to migrate.
While migration with UI allows the user to directly specify export of visuals, dashboards, and apps, REST APIs enable you to specify a wider range of migratable objects. Note that we do not migrate events and segments separately, but as part of dataset migration. Similarly, we migrate thumbnails along with dashboards or visuals that they represent.
The artifacts that may be migrated through REST APIs follow:
appgroups
object type.Dashboards use the dashboards
object type.
For information of UI-based migration, see Exporting Dashboards and Importing Dashboards.
Visuals use the visuals
object type.
We recommend UI-based migration whenever possible; see Exporting Linked Visuals and Importing Linked Visuals for working linked visuals. The non-linked visuals are part of dashboard export and import.
datasets
object type.daterange
object type.staticasset
object
type.customcss
object type.colorpalette
object type.Migration with REST APIs involves these tasks:
Enable and create the relevant data API keys, both for the source and destination machines; see Managing API Keys. The examples in this article use the Secret API Key that appears when you generate the keys for the first time, as in Creating New API Keys.
GET
request on the source machine. See Exporting with REST APIs,POST
request on the target machine. Importing with REST APIs.Authenticate the user using the Data API.
After authenticating, the user has to submit a GET
request to the
following address for a source machine:
source_arcviz_ip/arc/migration/api/export/
Here is a sample Python code snippet for authenticating and submitting the
GET
request that exports dashboards with IDs 2115 and 2110, and then
writing the response to a file my_app.json
.
import requests
headers = {'AUTHORIZATION':'apikey secret_api_key'}
payload = {'dashboards': '[2115, 2110]', 'filename': 'apitestmigration', 'dry_run':'False'}
r = requests.get('source_arcviz_ip/arc/migration/api/export/', headers=headers, params=payload)
with open('my_app.json', 'w') as f:
f.write(r.text)
The *.json
file with information about exported visual artifacts must be
on the destination machine.
Just as with export, authenticate the user using the data API.
After authenticating, submit a POST
request to the following address for a
destination machine:
destination_arcviz_ip/arc/migration/api/import/
Here is a sample Python code snippet for authenticating and submitting the
POST
request that imports dashboards with IDs 2115 and 2110, which were
earlier saved (from a metadata perspective) as my_app.json
. This
file is uploaded to the ArcViz server during the import.
import requests
headers = {'AUTHORIZATION':'apikey secret_api_key'}
payload = {'dry_run': False, "dataconnection_name":"data_connection"}
files = {'import_file': open('/Users/my_name/Downloads/my_app.json','r')}
r = requests.post('destination_arcviz_ip/arc/migration/api/import/',files=files, data=payload, headers=headers)
print r.status_code # 200 is success