Call #POST /reporting/datamodels/{datamodel_id}/datasets/{dataset_id}/tables.
For the API endpoint, select the appropriate endpoint for your region.
curl -X POST https://${TD_API_ENDPOINT}/reporting/datamodels/xxxxxx/datasets/yyyyyy/tables \
-H 'authorization: TD1 xxxx/xxxxxxxxxxxxxx' \
-H 'cache-control: no-cache' \
-H 'accept: application/json' \
-H 'content-type: application/json' \
-d '{
"name": "pageviews",
"definition": {
"columns": {
"td_url": {
"type": "text"
},
"time": {
"type": "int"
}
}
}
}' Here is some more information about the example:
name. The table name that you are going to ingest.
definition. List all columns that you’d like to ingest. Each column requires that you identify its type.
| Treasure Data Terminology | Analytics Platform Terminology |
|---|---|
| string | text |
| int | int/bigint |
| long | bigint |
| float | float |
| double | float |
| array type* | text |
In the Treasure Data console, when working with JSON data (array or object type), it's essential to set the data type as 'string' before transferring the data. This ensures that the Analytics platform can process the data accurately. Please note that the Analytics platform does not directly support JSON array type data and instead transfers it as text data. Therefore, defining the type as 'string' is a necessary step to ensure proper data handling.
- indexed. This is optional. Indexed is a Boolean attribute; the default value is false.
- timestamp. The Analytics platform does not support unixtimestamp. If you want to use datetime in a widget, convert unixtimestamp to text with the timestamp format before you create an Insights model and define the column as a type of timestamp.