Import & Export API provides users the ability to transfer Mission Portal data between hubs.

Get available items to export

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:

Export

URI: https://hub.example/data_transfer/api/export

Method: GET

Parameters:

Example 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:

Download export file

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:

Analyze import file

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"
}

Import

URI: https://hub.example/data_transfer/api/import

Method: POST

Parameters:

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