Import API

The general approach is:

  • Consumer makes a ZIP file available for import operation. See details below for the 2 flavors of the API.
  • The API if successful, will return the results of the operation.
  • Error will be returned on failure of the call.

Import ZIP File Using POST

Title Import API
Example See Examples sections below.
Description Provide the contents of the file to be imported in the request body.
URL api/atlas/admin/import
Method POST
URL Parameters None
Data Parameters None
Success Response AtlasImporResult is returned as JSON. See details below.
Error Response Errors that are handled within the system will be returned as AtlasBaseException.

Import ZIP File Available on Server

Title Import API
Example See Examples sections below.
Description Provide the path of the file to be imported.
URL api/atlas/admin/importfile
Method POST
URL Parameters None
Data Parameters None
Success Response AtlasImporResult is returned as JSON. See details below.
Error Response Errors that are handled within the system will be returned as AtlasBaseException.
Notes The file to be imported needs to be present on the server at the location specified by the FILENAME parameter.
Method Signature for Import
@POST
@Path("/import")
@Produces("application/json; charset=UTF-8")
@Consumes("multipart/form-data")

Method Signature for Import File

@POST
@Path("/importfile")
@Produces("application/json; charset=UTF-8")
@Consumes("application/json")

Import Options Please see here for the available options during import process.

AtlasImportResult Response The API will return the results of the import operation in the format defined by the AtlasImportResult:

  • AtlasImportParameters: This contains a collection of name value pair of the options that are applied during the import operation.
  • Metrics: Operation metrics. These include details on the number of types imported, number of entities imported, etc.
  • Processed Entities: Contains list of GUIDs for the entities that were processed.
  • Operation Status: Overall status of the operation. Values are SUCCESS, PARTIAL_SUCCESS, FAIL.

Examples Using CURL Calls

The call below performs Import of QuickStart database using POST.

curl -g -X POST -u adminuser:password -H "Content-Type: multipart/form-data"
            -H "Cache-Control: no-cache"
            -F request=@importOptions.json
            -F data=@quickStartDB.zip
            "http://localhost:21000/api/atlas/admin/import"

The request parameter is optional. If import has to be run without any options use:

curl -g -X POST -u adminuser:password -H "Content-Type: multipart/form-data"
            -H "Cache-Control: no-cache"
            -F data=@quickStartDB.zip
            "http://localhost:21000/api/atlas/admin/import"

The call below performs Import of QuickStart database using a ZIP file available on server.

curl -X POST -u adminuser:password -H "Cache-Control: no-cache" -d ./importOptions.json
"http://localhost:21000/api/atlas/admin/importFile" > quickStartDB-import-result.json

Below is the AtlasImportResult JSON for an import that contains hivedb_.

The processedEntities contains the guids of all the entities imported.

The metrics contain a breakdown of the types and entities imported along with the operation performed on them viz. created or updated.

{
    "request": {
        "options": {}
    },
    "userName": "admin",
    "clientIpAddress": "10.0.2.2",
    "hostName": "10.0.2.15",
    "timeStamp": 1491285622823,
    "metrics": {
        "duration": 9143,
        "typedef:enum": 0,
        "typedef:struct": 0,
        "entity:hive_column:created": 461,
        "entity:hive_storagedesc:created": 20,
        "entity:hive_process:created": 12,
        "entity:hive_db:created": 5,
        "entity:hive_table:created": 20,
        "entity:hdfs_path:created": 2,
        "typedef:entitydef": 0,
        "typedef:classification": 3
    },
    "processedEntities": [
        "2c4aa713-030b-4fb3-98b1-1cab23d9ac81",
        "e4aa71ed-70fd-4fa7-9dfb-8250a573e293",

       ...

        "ea0f9bdb-1dfc-4e48-9848-a006129929f9",
        "b5e2cb41-3e7d-4468-84e1-d87c320e75f9"
    ],
    "operationStatus": "SUCCESS"
}