Data Schema Warehouse API

Create database

Method: POST

Path:

https://[client].datainsider.co/api/ingestion/file/sync/history?from=0&size=10

Parameter
Type
Description

name

string

name of the table

display_name (optional)

string

name of the database displayed on the website

api_key

string

API key that has database permission

Sample request:

curl --request POST \
  --url https://[client].datainsider.co/api/databases \
  --header 'Content-Type: application/json' \
  --data '{
    "api_key": "cccccccc-14a1-4eb1-8964-000000000000",
    "name": "[client]_db",
    "display_name": "[client] Database"
}'

Sample response:

{
  "name": "[client]_db",
  "organization_id": 0,
  "display_name": "[client] Database",
  "creator_id": "root",
  "created_time": 1645007956002,
  "updated_time": 1645007956002,
  "tables": []
}

Get list of databases

Method: POST

Path:

https://[client].datainsider.co/api/databases

Sample request:

curl --request GET \
  --url https://[client].datainsider.co/api/databases \
  --header 'Content-Type: application/json' \
  --data '{
    "api_key": "cccccccc-14a1-4eb1-8964-000000000000"
}

Sample response:

[
    {
   	 "name": "analytics",
   	 "organization_id": 0,
   	 "display_name": "Analytics",
   	 "created_time": 1638464075069,
   	 "updated_time": 1638464075069
    },
    {
   	 "name": "KPI_DATABASE",
   	 "organization_id": 0,
   	 "display_name": "Kpi Database",
   	 "created_time": 1640866001362,
   	 "updated_time": 1640866001362
    },
    {
   	 "name": "[client]_db",
   	 "organization_id": 0,
   	 "display_name": "[client] Database",
   	 "creator_id": "root",
   	 "created_time": 1645007956002,
   	 "updated_time": 1645007956002
    }
]

Create table

Method: POST

Path:

https://[client].datainsider.co/api/databases/[client]_db/tables

Parameter
Type
Description

tbl_name

string

name of the table

db_name

string

name of the database that contains the table

api_key

string

API key that has database permission

columns

array<column>

columns of the table. The column of the table having the field class_name is an enum representing the data type of the column. List of supported data types: int32, uint32, int64, uint64, string, double, datetime.

Sample request:

curl --request POST \
  --url https://[client].datainsider.co/api/databases/<db_name>/tables \
  --header 'Content-Type: application/json' \
  --data '{
    "api_key": "cccccccc-14a1-4eb1-8964-000000000000",
    "tbl_name": "user_transactions",
    "columns": [
    	{
    	"class_name": "uint64",
    	"name": "trans_id",
    	"display_name": "Transaction Id",
    	"is_nullable": true
  	},
  	{
    	"class_name": "string",
    	"name": "from_user",
    	"display_name": "From User",
    	"is_nullable": true
  	},
     	 {
    	"class_name": "string",
    	"name": "to_user",
    	"display_name": "To User",
    	"is_nullable": true
  	},
  	{
    	"class_name": "double",
    	"name": "amount",
    	"display_name": "Amount",
    	"is_nullable": true
  	},
  	{
    	"class_name": "datetime",
    	"name": "at_time",
    	"display_name": "At Time",
    	"is_nullable": true
  	},
  	{
    	"class_name": "bool",
    	"name": "is_success",
    	"display_name": "Is Success",
    	"is_nullable": true
  	}
    ]
}'

Sample response:

{
  "name": "user_transactions",
  "db_name": "[client]_db",
  "organization_id": 0,
  "display_name": "user_transactions",
  "columns": [
	{
  	"class_name": "uint64",
  	"name": "trans_id",
  	"display_name": "Transaction Id",
  	"is_nullable": true
	},
	{
  	"class_name": "string",
  	"name": "from_user",
  	"display_name": "From User",
  	"is_nullable": true
	},
	{
  	"class_name": "string",
  	"name": "to_user",
  	"display_name": "To User",
  	"is_nullable": true
	},
	{
  	"class_name": "double",
  	"name": "amount",
  	"display_name": "Amount",
  	"is_nullable": true
	},
	{
  	"class_name": "datetime",
  	"name": "at_time",
  	"display_name": "At Time",
  	"input_as_timestamp": false,
  	"input_formats": [],
  	"is_nullable": true
	},
	{
  	"class_name": "bool",
  	"name": "is_success",
  	"display_name": "Is Success",
  	"is_nullable": true
	}
  ],
  "primary_keys": [],
  "partition_by": [],
  "order_bys": [],
  "temporary": false
}

Get list of tables in a database

Method: GET

Path:

https://[client].datainsider.co/api/databases/<db_name>

Parameter
Type
Description

db_name

string

name of the database that contains the table

api_key

string

API key that has database permission

Sample request:

curl --request GET \
  --url https://[client].datainsider.co/api/databases/<db_name> \
  --header 'Content-Type: application/json' \
  --data '{
    "api_key": "cccccccc-14a1-4eb1-8964-000000000000"
}'

Sample response:

{
  "name": "[client]_db",
  "organization_id": 0,
  "display_name": "[client] Database",
  "creator_id": "root",
  "created_time": 1645007956002,
  "updated_time": 1645007956002,
  "tables": [
{
  	"name": "user_transactions",
  	"db_name": "[client]_db",
  	"organization_id": 0,
  	"display_name": "user_transactions",
  	"columns": [
    	{
      	"class_name": "uint64",
      	"name": "trans_id",
      	"display_name": "Transaction Id",
      	"is_nullable": true
    	},
    	{
      	"class_name": "string",
      	"name": "from_user",
      	"display_name": "From User",
      	"is_nullable": true
    	},
    	{
      	"class_name": "string",
      	"name": "to_user",
      	"display_name": "To User",
      	"is_nullable": true
    	},
    	{
      	"class_name": "double",
      	"name": "amount",
      	"display_name": "Amount",
      	"is_nullable": true
    	},
    	{
      	"class_name": "datetime",
      	"name": "at_time",
      	"display_name": "At Time",
      	"input_as_timestamp": false,
      	"input_formats": [],
      	"is_nullable": true
    	},
    	{
      	"class_name": "bool",
      	"name": "is_success",
      	"display_name": "Is Success",
      	"is_nullable": true
    	}
  	],
  	"primary_keys": [],
  	"partition_by": [],
  	"order_bys": [],
  	"temporary": false
	}
  ]
}

Last updated