Treasure Data Bulk Loads API

The samples shown here are used to access your data through the Treasure Data REST API.

Description API call (or REST call)
returns the list of available bulk loads bulk_loads(.:format)
gets the bulk load session information with the given name bulk_loads/:find_by_name(.:format)
lists the executed jobs information for executing the bulk load bulk_loads/:find_by_name/jobs(.:format)

v3/bulk_loads

This operation returns the list of available bulk loads

Verb URI
GET /v3/bulk_loads(.:format)

Sample Request Status 200 OK

Sample Request

Copy
Copied
curl -X GET https://api.treasuredata.com/v3/bulk_loads/

Sample Response image

Expand for complete code
Copy
Copied
[
    {
        "id": 1000,
        "name": "connector_01",
        "cron": null,
        "timezone": "UTC",
        "delay": 0,
        "start_at": null,
        "database": "db_01",
        "table": "abc_01",
        "config": {
            "in": {
                api_key": "***",
                "secret_key": "***",
                "start_time": "20160901T22",
                "incremental": true,
                "type": "amplitude"
            },
            "filters": [
                {
                    "type": "rename",
                    "columns": {
                        "$schema": "_schema",
                        "$insert_id": "_insert_id"
                    }
                },
                {
                    "type": "add_time",
                    "to_column": {
                        "name": "time"
                    },
                    "from_value": {
                        "mode": "upload_time"
                    }
                }
            ],
            "exec": {},
            "out": {
                "type": "td_internal",
                "plazma_dataset": "1/db_01/abc_01_20160901",
                "mode": "append",
                "time_column": "createddate"
            }
        },
        "config_diff": {
            "in": {
                "start_time": "20160927T07"
            }
        }
    },
    :
    :
]

Sample Request Status 404 Not Found

Sample RequestSample Response
Copy
Copied
curl -X GET https://api-api.treasuredata.com/v3/bulk_loads/connector_01
Copy
Copied
{
    "error": "Resource not found",
    "message": "Resource not found",
    "text": "Resource not found",
    "severity": "error",
    "status_code": 404
}

v3/bulk_loads/:find_by_name

This operation gets the bulk load session information with the given name

Verb URI
GET /v3/bulk_loads/:find_by_name(.:format)

URI Parameters

Parameter Name Description
find_by_name Name of the bulk load session

Sample Request Status 200 OK

Copy
Copied
curl -X GET https://api.treasuredata.com/v3/bulk_loads/connector_01

Sample Response image

Expand for complete code
Copy
Copied
{
    "id": 1000,
    "name": "connector_01",
    "cron": null,
    "timezone": "UTC",
    "delay": 0,
    "start_at": null,
    "database": "db_01",
    "table": "abc_01",
    "config": {
        "in": {
            api_key": "***",
            "secret_key": "***",
            "start_time": "20160901T22",
            "incremental": true,
            "type": "amplitude"
        },
        "filters": [
            {
                "type": "rename",
                "columns": {
                    "$schema": "_schema",
                    "$insert_id": "_insert_id"
                }
            },
            {
                "type": "add_time",
                "to_column": {
                    "name": "time"
                },
                "from_value": {
                   "mode": "upload_time"
                }
            }
        ],
        "exec": {},
        "out": {
            "type": "td_internal",
            "plazma_dataset": "1/db_01/abc_01_20160901",
            "mode": "append",
            "time_column": "createddate"
        }
    },
    "config_diff": {
        "in": {
            "start_time": "20160927T07"
        }
    }
}

Sample Request Status 404 Not Found

Sample RequestSample Response
Copy
Copied
curl -X GET https://api.treasuredata.com/v3/bulk_loads/abcd 
Copy
Copied
{
    "error": "Resource not found",
    "message": "Resource not found",
    "text": "Resource not found",
    "severity": "error",
    "status_code": 404
}

v3/bulk_loads/:find_by_name/jobs

This operation lists the executed jobs information for executing the bulk load.

Verb URI
GET /v3/bulk_loads/:find_by_name/jobs(.:format)

URI Parameters

Parameter Name Description
name Name of the bulk import

Sample Request Status 200 OK

Sample Request

Copy
Copied
curl -X GET https://api.treasuredata.com/v3/bulk_loads/connector_01/jobs

Sample Response image

Expand for complete code
Copy
Copied
[
    {
        "account_id": 1,
        "status": "success",
        "cpu_time": null,
        "records": 1000,
        "schema": [
            [
                "app",
                "long",
                ""
            ],
            [
                "amplitude_id",
                "long",
                ""
            ],
            [
                "user_id",
                "string",
                ""
            ],
            [
                "device_id",
                "string",
                ""
            ],
            [
                "event_time",
                "string",
                ""
            ],
            [
                "server_upload_time",
                "string",
                ""
            ],
            [
                "client_event_time",
                "string",
                ""
            ],
            [
                "client_upload_time",
                "string",
                ""
            ],
            [
                "event_id",
                "long",
                ""
            ],
            [
                "session_id",
                "long",
                ""
            ],
            [
                "event_type",
                "string",
                ""
            ],
            [
                "amplitude_event_type",
                "string",
                ""
            ],
            [
                "version_name",
                "string",
                ""
            ],
            [
                "_schema",
                "long",
                ""
            ],
            [
                "adid",
                "string",
                ""
            ],
            [
                "groups",
                "string",
                ""
            ],
            [
                "idfa",
                "string",
                ""
            ],
            [
                "library",
                "string",
                ""
            ],
            [
                "processed_time",
                "string",
                ""
            ],
            [
                "user_creation_time",
                "string",
                ""
            ],
            [
                "platform",
                "string",
                ""
            ],
            [
                "os_name",
                "string",
                ""
            ],
            [
                "os_version",
                "string",
                ""
            ],
            [
                "device_brand",
                "string",
                ""
            ],
            [
                "device_manufacturer",
                "string",
                ""
            ],
            [
                "device_model",
                "string",
                ""
            ],
            [
                "device_carrier",
                "string",
                ""
            ],
            [
                "device_type",
                "string",
                ""
            ],
            [
                "device_family",
                "string",
                ""
            ],
            [
                "location_lat",
                "double",
                ""
            ],
            [
                "location_lng",
                "double",
                ""
            ],
            [
                "country",
                "string",
                ""
            ],
            [
                "language",
                "string",
                ""
            ],
            [
                "city",
                "string",
                ""
            ],
            [
                "region",
                "string",
                ""
            ],
            [
                "dma",
                "string",
                ""
            ],
            [
                "revenue",
                "double",
                ""
            ],
            [
                "ip_address",
                "string",
                ""
            ],
            [
                "paying",
                "long",
                ""
            ],
            [
                "start_version",
                "string",
                ""
            ],
            [
                "event_properties",
                "string",
                ""
            ],
            [
                "user_properties",
                "string",
                ""
            ],
            [
                "data",
                "string",
                ""
            ],
            [
                "uuid",
                "string",
                ""
            ],
            [
                "_insert_id",
                "string",
                ""
            ]
        ],
        "priority": 0,
        "job_id": 7654321,
        "type": "bulkload",
        "config": {
            "embulk_config": {
                "in": {
                    "api_key": "***",
                    "secret_key": "***",
                    "start_time": "20160901T22",
                    "incremental": true,
                    "type": "amplitude"
                },
                "filters": [
                    {
                        "type": "rename",
                        "columns": {
                            "$schema": "_schema",
                            "$insert_id": "_insert_id"
                        }
                    },
                    {
                        "type": "add_time",
                        "to_column": {
                            "name": "time"
                        },
                        "from_value": {
                            "mode": "upload_time"
                        }
                    }
                ],
                "exec": {},
                "out": {
                    "type": "td_internal",
                    "time_column": "time",
                    "mode": "replace",
                    "plazma_dataset": "1/db_01/abc_01_20160901"
                }
            },
            "config_diff": {
                "exec": {
                    "transaction_time": "2016-12-05 05:45:29 UTC",
                    "transaction_time_zone": "Asia/Tokyo"
                },
                "out": {
                    "unique_transaction_name": "bulkload.7477315",
                    "encrypt_start_at": 1459408037
                }
            }
        },
        "database": {
            "id": 123456,
            "name": "connector_db"
        },
        "table": {
            "id": 2016100,
            "name": "connector_table"
        },
        "created_at": 1480916729,
        "updated_at": 1480916788,
        "start_at": 1480916732,
        "end_at": 1480916788
    }
]

Sample Request Status 404 Not Found

Sample RequestSample Response
Copy
Copied
curl -X GET https://api.treasuredata.com/v3/bulk_loads/connector_abcd/jobs 
Copy
Copied
{
    "error": "Resource not found",
    "message": "Resource not found",
    "text": "Resource not found",
    "severity": "error",
    "status_code": 404
}