REST API Job Commands

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.

Job Status

Request method - GET

Description

Returns the id and current status of a specified job.

URI syntax

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

Example response

For a running job:

{
    "id": 49,
    "jobStatus": "RUNNING"
} 


For a completed job:

{
    "id": 30,
    "jobStatus": "COMPLETED"
}


For a job completed with warnings:

 {
    "id": 32,
    "jobStatus": "COMPLETED_WITH_Warnings"
}


For a job completed with errors:

 {
    "id": 36,
    "jobStatus": "ERROR"
}


For a cancelled job:

 {
    "id": 39,
    "jobStatus": "CANCELED"
}


For a job that hasn't been triggered:

{}

Job Status V2

Available as of Datameer 7.2.5

Request method - GET

Description

Returns the id and current status of a specified job.

URI syntax

curl -u <username>:<password> -X GET 'http://<Datameer-serverIP>:<port-number>/api/job-execution/<file-id>|<uuid>|<path>/status'

Example response

For a job that has never been run:

{
  "status": "success",
  "job-status": "_NONE"
}


For a running job:

{
  "status": "success",
  "file-id": 48,
  "job-execution-id": 3,
  "job-status": "RUNNING",
  "start-time": "Sep 28, 2018 6:44:56 PM",
  "estimate-time":"11s",
  "job-progress":"0"
}


For a completed job:

{
  "status": "success",
  "file-id": 48,
  "job-execution-id": 3,
  "job-status": "COMPLETED",
  "start-time": "Sep 28, 2018 6:44:56 PM",
  "stop-time": "Sep 28, 2018 6:44:58 PM"
}


For a completed job with errors:

{
  "status": "success",
  "file-id": 46,
  "job-execution-id": 4,
  "job-status": "COMPLETED_WITH_WARNINGS",
  "start-time": "Sep 28, 2018 10:09:47 AM",
  "stop-time": "Sep 28, 2018 10:09:52 AM"
}


For a queued job:

{
  "status": "success",
  "file-id": 48,
  "job-execution-id": 4,
  "job-status": "QUEUED",
  "start-time": null
}


For a canceled job:

{
  "status": "success",
  "file-id": 48,
  "job-execution-id": 4,
  "job-status": "CANCELED",
  "start-time": null,
  "stop-time": "Sep 28, 2018 6:58:41 PM"
}

If the example job had been running and was then canceled, a "start-time" would also be displayed.


For a triggered job:

{
  "status": "success",
  "job-execution-id": 3,
  "job-execution-user": "analyst",
  "job-execution-trigger": "RESTAPI"
}


For a job that has been stopped:

There isn't a response if the job was successfully stopped.


Error:

{
  "status": "failure",
  "reason": "File doesn't exist or isn't accessible with current permissions"
}

Job History

Request method - GET

Description

Returns a specified number of job status results for a job.

URI syntax

curl -u <username>:<password> -X GET 'http://<Datameer-serverIP>:<port-number>/rest/job-configuration/job-history/<job-configuration-id>?start=0&length=10'

Example response

[
    {
        "id": 30,
        "jobStatus": "COMPLETED"
    },
    {
        "id": 27,
        "jobStatus": "COMPLETED"
    },
    {
        "id": 23,
        "jobStatus": "COMPLETED"
    }
]

Job Details

Request method - GET

Description

Returns data about a job including the job counters, failure count, status, start/stop time, and successful record count. 

URI syntax

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

Example response

{
    "counters": {
        "IMPORT_RECORDS": 494400,
        "IMPORT_BYTES": 23911522,
        "IMPORT_DROPPED_RECORDS": 0,
        "IMPORT_PREVIEW_RECORDS": 5000,
        "IMPORT_OUTPUT_BYTES": 24444883,
        "IMPORT_DROPPED_SPLITS": 0,
        "IMPORT_OUTPUT_PARTITIONS": 0
    },
    "failureCount": 0,
    "jobStatus": "COMPLETED",
    "startTime": "2012-07-06 18:19:09.0",
    "stopTime": "2012-07-06 18:21:07.0",
    "successCount": 494400
} 

7.4 Example response

As of Datameer 7.4, the response now includes the jobConfigurationId, file-id, and uuid. 

{
  "startTime": "Jul 18, 2018 1:46:38 PM",
  "stopTime": "Jul 18, 2018 1:47:03 PM",
  "jobStatus": "COMPLETED",
  "jobConfigurationId": 4,
  "file": {
    "id": 6,
    "uuid": "f8d450cd-f065-4abb-a232-27cd20c48c2b"
  },
  "successCount": 7,
  "failureCount": 0,
  "counters": {
    "IMPORT_RECORDS": 7,
    "IMPORT_PREVIEW_RECORDS": 7,
    "IMPORT_OUTPUT_BYTES": 4167,
    "IMPORT_DROPPED_SPLITS": 0,
    "IMPORT_DROPPED_RECORDS": 0
  }
} 


List Active Jobs

Request method - GET

Description

Returns a list of all the active jobs in Datameer. This list displays the configuration ID, estimated time until completion, execution ID, current status, percent finished, and start time.

URI syntax

curl -u <username>:<password> -X GET 'http://<Datameer-serverIP>:<port-number>/rest/jobs/list-running'

Example response

[
    {
        "dapJobConfigurationId": 17,
        "estimateTime": "11 sec",
        "jobExecutionId": 37,
        "jobStatus": "RUNNING",
        "progress": 0,
        "startTime": "2011-05-19 22:35:39.0"
    },
    {
        "dapJobConfigurationId": 20,
        "jobExecutionId": 38,
 		"jobStatus": "RUNNING",
        "progress": 0,
        "startTime": "2011-05-19 22:35:39.0"
    },
    {
        "dapJobConfigurationId": 19,
        "jobExecutionId": 39,
 		"jobStatus": "RUNNING",
        "progress": 0,
        "startTime": "2011-05-19 22:35:39.0"
    },
    {
        "dapJobConfigurationId": 18,
 		"jobStatus": "RUNNING",
        "progress": 0,
        "startTime": "2011-05-19 22:35:39.0"
    }
]

Trigger Job

Available as of Datameer 7.2.5

Request method - POST

Description

Triggers a job to run.

URI syntax

curl -u <username>:<password> -X POST 'http://<Datameer-serverIP>:<port-number>/api/job-execution/<file-id>|<uuid>|<path>/trigger'

Example response

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

Sequential Trigger Job

Available as of Datameer 7.5.2

Request method - POST

Description

Triggers multiple Datameer jobs to run in a defined sequence. For this to happen, the workbooks within this dependency chain all have to be data-driven (which can be set in workbook configuration). The request triggers the provided artifacts, as well as all downstream dependencies. The new API version supports the setting of Workbook variables.

URI syntax

curl -X POST -u user:password 'http://localhost:8088/rest/job-execution?sequence=<IDS>'

-u admin:admin
-d '{ variables : { "foo": "fooValue" }, "fileIds" : [4, ]}'
-H "Content-Type: application/json"

Example response

{
  "status": "success",
  "execution-plan": [
    {
      "job-configuration-name": "apache_log",
      "job-configuration-id": 3,
      "trigger": true,
      "job-execution-id": 16
    },
    {
      "job-configuration-name": "categorization",
      "job-configuration-id": 4,
      "trigger": true,
      "job-execution-id": 17
    }
  ]
}

Stop Job

Available as of Datameer 7.2.5

Request method - POST

Description

Stops a job that is running.

URI syntax

curl -u <username>:<password> -X POST 'http://<Datameer-serverIP>:<port-number>/api/job-execution/<file-id>|<uuid>|<path>/stop'

Example response

This command doesn't return a response.

Delete Job

Request method - DELETE

Description

Removes a job from Datameer.

URI syntax

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

Example response

No job or data available:

{
  "status": "failure",
  "reason": "Entity of type 'Data' with id '272' not found."
}

Job and data are available, but data has already been deleted or marked for deletion:

{
  "status": false
}

Job and data have been marked for deletion:

 {
  "status": true
}

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