Methods are provided for creating, deleting, and getting information about tables:
This command creates a table. You must supply the name of the database in which the table will be created and a name for the table. The body of the command contains the field definitions as a JSON list.
Type: Post
URL: /ctree/api/v1/table/{db}/{table}
Parameters:
Body:
A JSON string containing an array of objects specifying the table fields. Each field object consists of the following properties:
The name property is a required string containing the field name.
The type property is a required string containing the data type of the field. Possible values are: BIT, TINYINT, SMALLINT, INTEGER, BIGINT, MONEY, DATE, TIME, REAL, DOUBLE, TIMESTAMP, BINARY, CHAR, NUMBER, VARBINARY, LVARBNARY, VARCHAR, LVARCHAR, NCHAR, NVARCHAR.
The length property is an integer that is required for field types CHAR, NCHAR, and BINARY. The property indicates the number of bytes used to store the field. It is optional for VARCHAR, NVARCHAR, VARBINARY and indicates the intended length.
The scale property is an integer that is only required for the NUMBER field type and specifies the number of digits to the right of the decimal point.
The precision property is an integer that is only required for the NUMBER field type and specifies the total number of digits available to represent a number including digits on the left and right of the decimal point.
Example:
POST https://localhost:8443/ctree/api/v1/table/ctreeSQL/part
{
"fields" : [
{
"name" : "part_number",
"type" : "INTEGER",
"length" : 4
},
{
"name" : "part_name",
"type" : "CHAR",
"length" : 30
},
{
"name" : "part_description",
"type" : "VARCHAR",
"length" : "300"
}
]
}
When you want to connect using a secure connection over TLS, use https:// and port 8443. Without TLS use http:// and port 8080.
Responses:
This command deletes the specified table from the specified database.
Type: DELETE
URL: /ctree/api/v1/table/{db}/{table}
Parameters:
Example:
DELETE https://localhost:8443/ctree/api/v1/table/ctreeSQL/part
When you want to connect using a secure connection over TLS, use https:// and port 8443. Without TLS use http:// and port 8080.
Responses:
This command returns the specified table definition as a JSON string.
Type: GET
URL: /ctree/api/v1/table/{db}/{table}
Parameters:
Example:
GET https://localhost:8443/ctree/api/v1/table/ctreeSQL
When you want to connect using a secure connection over TLS, use https:// and port 8443. Without TLS use http:// and port 8080.
Responses:
{
"fields": [
{
"name": "part_number",
"type": "INTEGER"
},
{
"name": "part_name",
"type": "CHAR",
"length": 30
},
{
"name": "part_description",
"type": "VARCHAR",
"length": 300
}
]
}
Retrieve a list of the tables in the specified database.
Type: GET
URL: /ctree/api/v1/table/{db}
Parameters:
Example:
GET https://my-ctree-server:8443/ctree/api/v1/table/ctreeSQL
When you want to connect using a secure connection over TLS, use https:// and port 8443. Without TLS use http:// and port 8080.
Responses:
{
"_tables": [
"part"
]
}