REST API Export Job

INFO

Add the following command after the username and password to receive more meaningful HTTP errors:

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

This command can be added to each call.

Create an 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 an 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 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.

Read an Export Job

Request Method GET
Description

Returns information on a specified export job within Datameer X 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"
} 

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 an 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 an Export Job

Request Method POST
Description

Cancels the run order of an export job.

URI Syntax

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

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.

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

Export Job Dependencies

Request Method GET
Description

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

Prerequisites

INFO

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

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 X server filesystem",
        "name": "Datameer X server filesystem",
        "type": "dst",
        "description": "A data store for the local filesystem where Datameer X is running.  Note, this works ONLY for Datameer X 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