# データテーブルAPI
Calling methods See the description in the Open API doc.
# Function introduction
- Data Table API, which can implement some operations of Data Table on the page and help realize the requirements for automatic operation of Data Table;
- Data Table API, you can complete the following operations for the Data Table:
- Create a Data Table
- Update existing Data Table
- Associating Data Tables with primary properties
- Unassociate the Data Tables with the primary properties
- Create the Data Table:
You can create a Data Table that does not exist, upload the file for the first time, and specify the name and type of each field of the Data Table;
- Update existing Data Tables:
Only supports updating of Data Table content, does not support the addition, deletion or type modification of Data Table fields;
It can replace the contents of the full table, or update incrementally based on existing data;
- Associate Data Table with primary properties:
Support associating existing Data Table with primary properties to generate dimension properties;
- Disassociate the Data Table from the primary properties:
Support disassociating the associated Data Table and primary properties, and deleting the generated dimension properties;
TIP
- For more details see: Data Table
- Dimension Properties For more details see: Virtual Properties and Dimension Table Properties
# Create a Data Table
The process of creating a Data Table is divided into two steps:
- Upload files
- Use the uploaded file to create a Data Table
# file upload
The maximum size of file upload is 100M, and the uploaded file type supports excel and csv
Interface URL
/open/datatable/uploadFile
request method
POST
Content-Type
multipart/form-data
Request Query parameter
parameter name | example | parameter type | is required | parameter position | parameter description |
---|---|---|---|---|---|
token | xxx | String | Yes | query key | |
projectId | 0 | number | Yes | query | The project to which the Data Table belongs ID created. |
file | "/path/to/my_datatable.xls" | file | Yes | body | multipart/form-data; csv/excel of uploaded table, first as primary key |
exported parameters
fileId (this fileId is used in the next step, which is to create the Data Table)
# Create a Data Table
Interface URL
/open/datatable/createDatatable
request method
POST
Content-Type
application/json
Request Query parameter
parameter name | parameter type | is required | parameter position | description | ||||
---|---|---|---|---|---|---|---|---|
projectId | number | Yes | query | Project Identity | ||||
fileId | string | Yes | body | id of the uploaded file | ||||
datatableName | string | Yes | body | Data Table name Beginning with a lowercase letter, can contain lowercase letters, numbers, underscores | ||||
datatableColumns | array | Yes | body | |||||
columnName | string | Yes | The column name of each column and the corresponding data type Column names can only start with a letter, contain letters, numbers, and underscores "_", and have a maximum length of 50 characters | |||||
dataType | string | Yes | column data type |
code examples
curl --location --request POST 'http://xxx.com/open/datatable/createDatatable?projectId=390' \
--header 'Content-Type: application/json' \
--data-raw '{
"fileId": "xxxxxxx",
"datatableName": "xxx",
"datatableColumns": [
{
"columnName": "aaa",
"dataType": "string"
}
]
}'
exported parameters
parameter name | data type | description | ||
---|---|---|---|---|
succeededRowCount | number | number of successful rows | ||
failedRowCount | number | number of failed rows |
# Update existing Data Table
Interface URL
/open/datatable/updateDatatable
request method
POST
Content-Type
multipart/form-data
Request Query parameter
parameter name | data type | is required | parameter position | description | ||
---|---|---|---|---|---|---|
projectId | number | Yes | query | The project to which the Data Table belongs ID created. | ||
datatableName | string | Yes | query | Data Table name | ||
updateType | enum(INCR_UPDATE/REPL_UPDATE) | Yes | query | Update type, INCR_UPDATE incremental update, REPL_UPDATE to replace the entire table content update | ||
file | file | Yes | body | multipart/form-data; csv/excel of uploaded table, first as primary key |
code examples
curl --location --request POST 'http://xxx.com/open/datatable/updateDatatable?projectId=390&datatableName=xxx&updateType=INCR_UPDATE' \
--form '=@"/path/to/file"'
# Associating Data Tables with primary properties
Interface URL
/open/datatable/bindAssociatedProperty
request method
POST
Content-Type
application/json
Request Query parameter
parameter name | data type | is required | parameter position | description | ||
---|---|---|---|---|---|---|
projectId | number | Yes | query | The project to which the Data Table belongs ID created. | ||
datatableName | string | Yes | body | Data Table name | ||
associatedPropertyName | string | Yes | body | associated attribute name | ||
associatedPropertyTableType | user/event | Yes | body | associated attribute type | ||
timestampJoinFormat | no | body | If the main attribute is a time type (timestamp), it supports binding dimension attributes after granularity calculation by timestamp |
The timestampJoinFormat
supports the following granularity types.
value | describe |
---|---|
DATE_STR_YEAR | Property will be formatted as "yyyy" string after binding dimension property |
DATE_STR_MONTH | Property will be formatted as "yyyy- MM" after binding the dimension property |
DATE_STR_DAY | Property will be formatted as "yyyy-MM -dd" after binding the dimension property |
DATE_STR_HOUR | Property will be formatted as "yyyy- MM -dd HH" after binding dimension property |
DATE_STR_MINUTE | The attribute will be formatted as "yyyy-MM -dd HH: mm" after binding the dimension attribute |
DATE_STR_SECOND | The attribute will be formatted as "yyyy-MM -dd HH: mm: ss" after binding the dimension attribute |
DATE_STR_MILLISECOND | The attribute will be formatted as "yyyy-MM -dd HH: mm: ss.SSS" after binding the dimension attribute |
code examples
curl --location --request POST 'http://xxx.com/open/datatable/bindAssociatedProperty?projectId=390' \
--header 'Content-Type: application/json' \
--data-raw '{
"datatableName": "xxxxxxx",
"associatedPropertyName": "aaa",
"associatedPropertyTableType": "user",
"timestampJoinFormat": "DATE_STR_YEAR"
}'
Output parameters
parameter name | data type | description | ||||
---|---|---|---|---|---|---|
dimensionProperties | array | |||||
columnName | string | dimension property name | ||||
selectType | string | Dimension table data type |
# Unassociate the Data Table with the main attribute
Interface URL
/open/datatable/unbindAssociatedProperty
request method
POST
Content-Type
application/json
Request Query parameter
parameter name | data type | is required | parameter position | description | ||
---|---|---|---|---|---|---|
projectId | number | Yes | query | The project to which the Data Table belongs ID created. | ||
datatableName | string | Yes | body | Data Table name | ||
associatedPropertyName | string | Yes | body | associated attribute name | ||
associatedPropertyTableType | user/event | Yes | body | associated attribute type |
code examples
curl --location --request POST 'http://xxx.com/open/datatable/unbindAssociatedProperty?projectId=390' \
--header 'Content-Type: application/json' \
--data-raw '{
"datatableName": "xxxxxxx",
"associatedPropertyName": "aaa",
"associatedPropertyTableType": "user"
}'