# Create Timeseries table
This endpoint creates one or more Timeseries tables.
Method | Path | Operation* |
---|---|---|
POST | /account/services/timeseries | create_timeseries_table |
*
In order for a user to perform the "create_timeseries_table" operation, the "create_timeseries_table" permission must be included in the list of allowed actions in the statement of the user's role.
# Request
Parameter | Type | In | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dimensions required | dictionary | body | Dictionary containing a list of dimension names and a list of data types of the corresponding dimensions.
| ||||||||||||
measurements required | dictionary | body | Dictionary containing a list of measurement column names and a list of data types of the corresponding measurement columns.
| ||||||||||||
defaults optional * | dictionary, DEFAULT=null | body | Dictionary containing templates for |
Attribute | Type | Description |
---|---|---|
measurement | string | Template that determines the name of the measurement column to store the Entry value. Provided default template is used if no default template is defined in the "timeseries" property of a Ledger's Entry. The template follows the Python string str.format() convention (see Format String Syntax(opens new window)). |
dimensions | dictionary | Template that determines the value for each of the dimensions. Provided default template is used if no default template is defined in the "timeseries" property of a Ledger's Entry. The template follows the Python string str.format() convention (see Format String Syntax(opens new window)). |
timestamp | string | Template that determines the value of the timestamp. |
optional *
^([1-9][0-9]{0,2}[DWMY])|(INF)$
.optional *
^([1-9][0-9]{0,2}[DWMY])|(INF)$
.optional *
*
The "defaults"
, "retention"
, "chunk"
, and "database"
parameters are optional and do not need to be included in the request body when creating Timeseries tables. If they are not included in the request body, their default values are used.
TIP
The Trusted Twin platform provides you with the flexibility to use the double asterisk **
to unpack a dictionary passed as a value of the "value"
attribute of a Ledger Entry.
# Response
The response returns a list of Timeseries tables with their attributes.
Attribute | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dimensions | dictionary | Dictionary containing a list of dimension names and a list of data types of the corresponding dimensions.
| ||||||||||||
measurements | dictionary | Dictionary containing a list of measurement column names and a list of data types of the corresponding measurement columns.
| ||||||||||||
defaults | dictionary | Dictionary containing templates for |
Attribute | Type | Description |
---|---|---|
measurement | string | Template that determines the name of the measurement column to store the Entry value. Provided default template is used if no default template is defined in the "timeseries" property of a Ledger's Entry. The template follows the Python string str.format() convention (see Format String Syntax(opens new window)). |
dimensions | dictionary | Template that determines the value for each of the dimensions. Provided default template is used if no default template is defined in the "timeseries" property of a Ledger's Entry. The template follows the Python string str.format() convention (see Format String Syntax(opens new window)). |
timestamp | string | Template that determines the value of the timestamp. |
^([1-9][0-9]{0,2}[DWMY])|(INF)$
.^([1-9][0-9]{0,2}[DWMY])|(INF)$
.# Response ('Table already exists')
NOTE
If you try to create a Timeseries table that already exists, you will receive the message "error": "Table already exists."
for this table in the response. However, the response itself will return the 201 Created
status code (see example below).
In our example, we send a request to create two Timeseries tables:
"water_pollution"
: A Timeseries table with the name"water_pollution"
does not exists in the account yet."air_quality_index"
: A Timeseries table with the name"air_quality_index"
already exists in the account.
The response returns the details of the Timeseries table "water_polution"
and the message "error": "Table already exists."
for the Timeseries table "air_quality_index"
.
# Status codes
Requests to this endpoint result in generic status codes. For a comprehensive list of status codes, please consult the Status codes section.
Status code | Message | Comment |
---|---|---|
201 | Created | If a Timeseries table that you are trying to create already exists, you will receive the error: "error": "Table already exists." for this table in the response. |
Was this article helpful?