Jobs

Get jobs

Retrieves a list of jobs.

Request
Security:
ApiKeyAuth
Responses
200

OK

get/job/list
Request samples
curl -i -X GET \
  https://api.treasuredata.com/v3/job/list \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'
Response samples
application/json
{
  • "jobs": [
    ],
  • "count": 0,
  • "from": 0,
  • "to": 0
}

Get job

Retrieves a list of jobs with specified job id.

Request
Security:
ApiKeyAuth
path Parameters
job_id
required
integer (JobId)

the job id

Example: 19
Responses
200

OK

get/job/show/{job_id}
Request samples
curl -i -X GET \
  'https://api.treasuredata.com/v3/job/show/{job_id}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'
Response samples
application/json
{
  • "cpu_time": 0,
  • "created_at": "2020-12-31 11:22:33 UTC",
  • "database": "string",
  • "duration": 10,
  • "end_at": "2020-12-31 11:22:33 UTC",
  • "hive_result_schema": "string",
  • "job_id": "19",
  • "linked_result_export_job_id": 19,
  • "num_records": 100,
  • "organization": "string",
  • "priority": 0,
  • "query": { },
  • "result": "string",
  • "result_export_target_job_id": 19,
  • "result_size": 1048576,
  • "retry_limit": 3,
  • "start_at": "2020-12-31 11:22:33 UTC",
  • "status": "success",
  • "type": "presto",
  • "updated_at": "2020-12-31 11:22:33 UTC",
  • "url": "string",
  • "user_name": "Treasure Data",
  • "debug": {
    }
}

Get job status by id

Show the status information of the given job id at last execution as well as other related information.

Request
Security:
ApiKeyAuth
path Parameters
job_id
required
integer (JobId)

the job id

Example: 19
Responses
200

OK

get/job/status/{job_id}
Request samples
curl -i -X GET \
  'https://api.treasuredata.com/v3/job/status/{job_id}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'
Response samples
application/json
{
  • "job_id": "19",
  • "cpu_time": 0,
  • "created_at": "2020-12-31 11:22:33 UTC",
  • "end_at": "2020-12-31 11:22:33 UTC",
  • "duration": 10,
  • "num_records": 100,
  • "result_size": 1048576,
  • "start_at": "2020-12-31 11:22:33 UTC",
  • "status": "success",
  • "updated_at": "2020-12-31 11:22:33 UTC"
}

Get job status by domain_key

Checks the status of a job using the domain key.

Request
Security:
ApiKeyAuth
path Parameters
domain_key
required
string (DomainKey)
Example: domain_key_123
Responses
200

OK

get/job/status_by_domain_key/{domain_key}
Request samples
curl -i -X GET \
  'https://api.treasuredata.com/v3/job/status_by_domain_key/{domain_key}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'
Response samples
application/json
{
  • "job_id": "19",
  • "cpu_time": 0,
  • "created_at": "2020-12-31 11:22:33 UTC",
  • "end_at": "2020-12-31 11:22:33 UTC",
  • "duration": 10,
  • "num_records": 100,
  • "result_size": 1048576,
  • "start_at": "2020-12-31 11:22:33 UTC",
  • "status": "success",
  • "updated_at": "2020-12-31 11:22:33 UTC"
}

Create job

Creates a job of a given type under a specified database.

Request
Security:
ApiKeyAuth
path Parameters
job_type
required
string

the job type

Example: presto
database_name
required
string

database name

Example: Alpha
Responses
200

OK

post/job/issue/{job_type}/{database_name}
Request samples
curl -i -X POST \
  'https://api.treasuredata.com/v3/job/issue/{job_type}/{database_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'
Response samples
application/json
{
  • "job": "19",
  • "job_id": "19",
  • "database": "Alpha"
}

kill job by id

Stops a specified job ID.

Request
Security:
ApiKeyAuth
path Parameters
job_id
required
integer (JobId)

the job id

Example: 19
Responses
200

OK

post/job/kill/{job_id}
Request samples
curl -i -X POST \
  'https://api.treasuredata.com/v3/job/kill/{job_id}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'
Response samples
application/json
{ }

Set result export

Sets the results of a specified job ID.

Request
Security:
ApiKeyAuth
path Parameters
job_id
required
integer (JobId)

the job id

Example: 19
Request Body schema: application/x-www-form-urlencoded
domain_key
string (DomainKey)
pool_name
string

resource pool name

priority
integer [ -2 .. 2 ]

job execution priority

query
string (QueryAsString)

the raw SQL query

retry_limit
integer [ 0 .. 32 ]
Default: 0

automatically retry this many times on failure

scheduled_time
string (DateTimeISO8601) \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(([+-]\d{2...

Datetime in ISO 8601 format (2020-12-31T11:22:33-05:00 or 2020-12-31T11:22:33Z for UTC)

target_job_id
integer (JobId)

unique identifier of job

result_connection_id
integer (ConnectionId)

the connection id

result
string

...?

database
string

database name

table
string
Responses
200

OK

post/job/result_export/{job_id}
Request samples
curl --request POST \
  --url 'https://console-development.treasuredata.com/v3/job/result_export/22616062?=' \
  --header 'authorization: TD1 {APIKEY}' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data 'result=td://console-development.treasuredata.com/test_db/test_table?legacy=true&mode=null&time=0&apikey={APIKEY}&mode=append'
Response samples
application/json
{
  • "cpu_time": 0,
  • "created_at": "2020-12-31 11:22:33 UTC",
  • "database": "string",
  • "duration": 10,
  • "end_at": "2020-12-31 11:22:33 UTC",
  • "hive_result_schema": "string",
  • "job_id": "19",
  • "linked_result_export_job_id": 19,
  • "num_records": 100,
  • "organization": "string",
  • "priority": 0,
  • "query": { },
  • "result": "string",
  • "result_export_target_job_id": 19,
  • "result_size": 1048576,
  • "retry_limit": 3,
  • "start_at": "2020-12-31 11:22:33 UTC",
  • "status": "success",
  • "type": "presto",
  • "updated_at": "2020-12-31 11:22:33 UTC",
  • "url": "string",
  • "user_name": "Treasure Data",
  • "debug": {
    }
}

Create export job

Creates an export job.

Request
Security:
ApiKeyAuth
path Parameters
database_name
required
string

database name

Example: Alpha
table_name
required
string
Example: Bravo
Request Body schema: application/x-www-form-urlencoded
access_key_id
string
assume_role
string
bucket
string
domain_key
string (DomainKey)
encryption
string
file_format
string
Enum: "jsonl.gz" "tsv.gz" "json.gz" "line-json.gz"
file_prefix
string
from
integer (Timestamp)
pool_name
string
secret_access_key
string
storage_type
string
Value: "s3"
to
integer (Timestamp)
Responses
200

OK

post/export/run/{database_name}/{table_name}
Request samples
curl -i -X POST \
  'https://api.treasuredata.com/v3/export/run/{database_name}/{table_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/x-www-form-urlencoded'
Response samples
application/json
{
  • "job": "19",
  • "job_id": "19",
  • "database": "Alpha"
}

Create partial delete job

Creates a partial delete job.

Request
Security:
ApiKeyAuth
path Parameters
database_name
required
string

database name

Example: Alpha
table_name
required
string
Example: Bravo
Request Body schema: application/x-www-form-urlencoded
domain_key
string (DomainKey)
Timestamp (integer) or DateTimeAsString (string) or DateTimeISO8601 (string)
pool_name
string
Timestamp (integer) or DateTimeAsString (string) or DateTimeISO8601 (string)
Responses
200

OK

post/table/partialdelete/{database_name}/{table_name}
Request samples
curl -i -X POST \
  'https://api.treasuredata.com/v3/table/partialdelete/{database_name}/{table_name}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/x-www-form-urlencoded'
Response samples
application/json
{
  • "job_id": 19,
  • "database": "Alpha",
  • "table": "Bravo",
  • "from": 1356998400,
  • "to": 1356998400
}

Get job results

Retrieves job results.

Request
Security:
ApiKeyAuth
path Parameters
job_id
required
integer (JobId)

the job id

Example: 19
query Parameters
header
boolean

wheter to show the headers or not

nullify_special
boolean

wheter to show the headers or not

Responses
200

OK

get/job/result/{job_id}
Request samples
curl -i -X GET \
  'https://api.treasuredata.com/v3/job/result/{job_id}' \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>'
Support
Copyright © 2021 Treasure Data, Inc. (or its affiliates). All rights reserved.