Import & Export API provides users the ability to transfer Mission Portal data between hubs.
This API call provides a list of items available for export. Please note that the role of the user that authenticates to this API will affect what items are available. For example: the API user must have admin role in order to export settings.
URI: https://hub.example/data_transfer/api/exportItems
Method: GET
Example request (curl):
curl -k --user <username>:<password> \
-X GET \
https://hub.example/data_transfer/api/exportItems
Example response:
HTTP 200 Ok
[
{
"id": "categorizations",
"name": "Host categorizations"
},
{
"id": "dashboards",
"name": "Dashboards"
},
{
"id": "reports",
"name": "Reports"
},
{
"id": "settingsScripts",
"name": "Custom notification scripts"
},
{
"id": "users",
"name": "Users"
},
{
"id": "settingsRoles",
"name": "Roles"
},
{
"id": "settingsPreferences",
"name": "Preferences"
},
{
"id": "settingsAuthentication",
"name": "LDAP authentication settings"
},
{
"id": "settingsMail",
"name": "Mail settings"
},
{
"id": "settingsVCS",
"name": "Version control repository"
}
]
Output:
URI: https://hub.example/data_transfer/api/export
Method: GET
Parameters:
item_id (array) Item id to be exported. List of item ids you can obtain through [List of items to export][Import & Export API#Get available items to export] call described below.
true
- export only user items. false
- export whole system dataExample request (curl):
curl -k -g --user <username>:<password> \
-X GET \
'https://hub.example/index.php/data_transfer/api/export?encryptionKey=key&exportOnlyUserItems=true&items[]=categorizations&items[]=dashboards&items[]=settingsAuthentication&items[]=settingsMail'
Example response:
HTTP 200 Ok
{
"name": "export_12-14-2018_15:19:40.381400.phar",
}
Output:
URI: https://hub.example/data_transfer/api/download/:file_name:
Method: GET
Parameters:
Example request (curl):
curl -k -g --user <username>:<password> \
-X GET \
--output /save/file/here/export_12-14-2018_15:19:40.381400.phar \
'https://hub.example/index.php/data_transfer/api/download/export_12-14-2018_15:19:40.381400.phar'
Example response:
HTTP 200 Ok
Raw file contetnt
Output headers:
This API call allows you to see short summary of file content.
URI: https://hub.example/data_transfer/api/analyzeImportFile
Method: POST
Parameters:
Example request (curl):
curl -k --user <username>:<password> \
-X POST \
-F file=@/path/to/file.phar \
'https://hub.example/index.php/data_transfer/api/analyzeImportFile'
Example response:
HTTP 200 Ok
{
"categorizations": 3,
"dashboards": "4, Widgets: 21 , Alerts: 31, Rules: 7",
"settingsAuthentication": "yes",
"settingsMail": "yes"
}
URI: https://hub.example/data_transfer/api/import
Method: POST
Parameters:
1
- skip duplicate items.
0
- overwrite duplicate items.Example request (curl):
curl -k --user <username>:<password> \
-X POST \
-F file=@/path/to/file.phar \
-F encryptionKey=key \
-F skipDuplicates=1 \
'https://hub.example/index.php/data_transfer/api/analyzeImportFile'
Example response:
HTTP 200 Ok