Importing visual artifacts with REST APIs

Make sure that the *.json file with information about exported visual artifacts must be on the destination machine.
  1. Authenticate the user using the data API.
  2. After authenticating, submit a POST request to the following address for a destination machine: destination_arcviz_ip/arc/migration/api/import/
    For instructions on export, see Exporting visual artifacts with REST APIs.
This 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 Data Visualization 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