REST API Export Job


For each call, you can add the following command:

-w"\n%{http_code}\n"

After the username and password in order to receive more meaningful HTTP errors.

Read Export Job

Request method - GET

Description

Returns information on a specified export job within Datameer including version number, class name, file information (uuid, path, description, name), run schedule, iterations set to keep, properties information, custom properties, sheet data, and export configuration data.

URI syntax

curl -u '<username>:<password>' -X GET 'http://<Datameer-serverIP>:<port-number>/rest/export-job/<export-job-configuration-id>'

Example response

{ 
     "version": "2.0.0.4",
     "className":"datameer.dap.common.entity.FileDataSinkImpl",
     "file": {
        "path": "/Admin/REST_API_TestExportJob.exp",
        "description": "Test Export Job"
     },
     "pullType": "MANUALLY",
     "minKeepCount": 1,
     "properties": {},
     "hadoopProperties": "",
     "connection": "/Admin/DFS_DataStore",
     "sheet": {
        "name": "Sheet1",
        "workbook": "/Admin/ExplodeRange.wbk"
     },
     "mappings": [
        {
            "name": "A",
            "srcColumnIndex": 0,
            "nullable": true
        }
     ],
     "errorHandlingMode": "DROP_RECORD",
     "fullDataPermission": 63,
     "notificationAddresses": "",
     "notificationSuccessAddresses": "",
     "fileName": "/TestExport",
     "confirmOverwrite": false,
     "clearTargetDirectory": false,
     "includeHeader": true,
     "delimiterString": ",",
     "quoteString": "\"",
     "escapeString": "\\",
     "characterEncoding": "ISO-8859-1"
} 

Create Export Job 

Request method - POST

Description

Adds an export job in Datameer.

URI syntax

curl -u '<username>:<password>' -X POST -d @<job-payload>.json 'http://<Datameer-serverIP>:<port-number>/rest/export-job'

Example response

{
    "configuration-id": 480,
	"status": "success"
}  

Additional notes

<job-payload>.json

  • The payload is a JSON representation of all information entered during the creation process using the web interface.
  • An easy method of creating a payload is to use REST to read an import job, data link, or workbook and change the JSON that is returned.

Update Export Job

Request method - PUT

Description

Edits an existing export job in Datameer.

URI syntax

curl -u '<username>:<password>' -X PUT -d @<job-payload>.json 'http://<Datameer-serverIP>:<port-number>/rest/export-job/<export-job-configuration-id>'

Example response

{"status": "success"}

Additional sotes

<job-payload>.json

  • The payload is a JSON representation of all information entered during the creation process using the web interface.
  • An easy method of creating a payload is to use REST to read an import job, data link, or workbook and change the JSON that is returned.

Delete Export Job

Request method - DELETE

Description

Removes an export job from Datameer.

URI syntax

curl -u '<username>:<password>' -X DELETE 'http://<Datameer-serverIP>:<port-number>/rest/export-job/<export-job-configuration-id>'

Example response

{"status": "success"}

List All Export Jobs

Request method - GET

Description

Returns a list of all the export jobs in Datameer. This list displays the description, ID, name, and the path of the file. 

URI syntax

curl -u '<username>:<password>' -X GET 'http://<Datameer-serverIP>:<port-number>/rest/export-job'

Example response

[
    {
        "description": "",
        "id": 272,
        "name": "exp_kp0705_oracle",
        "path": "/ExportJobs/exp_kp0705_oracle.exp"
    },
    {
        "description": "",
        "id": 427,
        "name": "exp hdfs",
        "path": "/ExportJobs/tester/exp hdfs.exp"
    },
    {
        "description": "",
        "id": 428,
        "name": "exp hdfs 2",
        "path": "/ExportJobs/tester/exp hdfs 2.exp"
    },
    {
        "description": "",
        "id": 429,
        "name": "exp mysql",
        "path": "/ExportJobs/exp mysql.exp"
    }
]

Start Export Job

Request method - POST

Description

Runs an export job.

URI syntax

curl -u '<username>:<password>' -X POST 'http://<Datameer-serverIP>:<port-number>/rest/job-execution?configuration=<export-job-configuration-id>'

Example response

{
    "job-execution-id": 1,
    "job-execution-trigger": "RESTAPI",
    "job-execution-user": "admin",
    "status": "success"
}   

Cancel Export Job

Request method - POST

Description

Cancels the run order of an export job.

URI syntax

curl -u '<username>:<password>' -X POST 'http://<Datameer-serverIP>:<port-number>/rest/job-execution/job-kill/<export-job-execution-id>'

Example response

This command doesn't return a response.

If your file name includes " " (empty spaces), replace those spaces with "+".

Export Job Dependencies

This API requires enabling Datameer's Advanced Governance plug-in.

Request method - GET

Description

Returns the hierarchy of up- and downstream dependencies for a given export job.

URI syntax

curl -u '<username>:<password>' -X GET 'http://<server>:<port>/api/export-job/[configurationID]/dependencies[?direction=<upstream | downstream>][&level=<number>]'

Example response

{
  "dependencies": [
    {
      "id": 23,
      "file": {
        "path": "/Users/admin/Workbook",
        "name": "Workbook",
        "type": "wbk",
        "description": "",
        "uuid": "db942d97-4785-436d-938b-45053e12bb75"
      }
    },
    {
      "id": 22,
      "file": {
        "path": "/Users/admin/ImportJob",
        "name": "ImportJob",
        "type": "imp",
        "description": "",
        "uuid": "b8f258f5-90c9-451d-9058-9d3a8c9b2c5d"
      }
    },
    {
      "id": 2,
      "file": {
        "path": "/Data/Connections/Datameer server filesystem",
        "name": "Datameer server filesystem",
        "type": "dst",
        "description": "A data store for the local filesystem where Datameer is running.  Note, this works ONLY for Datameer Personal, Workgroup, and Trial editions.\n",
        "uuid": "78a2fb59-375e-4eae-b338-956ef806f7b1"
      }
    }
  ],
  "fileCountWithNoReadPermission": 0,
  "_links": {
    "self": {
      "href": "http://localhost:8088/api/export-job/24/dependencies"
    }
  }

Additional notes

Path parameters:

  • configurationId:
    • Data type must be a number
    • Use the configuration ID

Query parameters:

  • Direction:
    • Data type must be a string
    • Optional
    • Shows either upstream or downstream
    • If left blank, shows both
  • Level:
    • Data type must be a number
    • Optional
    • If left blank, shows all levels