Other APIs¶
Server Time¶
- GET /_config/server-time¶
Description Fetching UTC time in epoch format in millisecond
HTTP Method GET
Endpoint
/_config/server-time
Request Header
Authorization
Basic <token>Sample Request
curl --location 'https://app.4pointx.com/_config/server-time --header 'Authorization: Basic <token>' \
Sample Response
Success
1702625795.3759577
SQL Connect¶
- POST /_config/pipelines/sql/connect¶
Description Internal API used to connect to an online SQL server
HTTP Method POST
Endpoint
/_config/pipelines/sql/connect
Request Parameters
Body Parameters
server_address
(string, required): Address of the SQL serverport
(int, required): Port to be used for connectionusername
(string, required): User to be used for connectionpassword
(string, required): Password of the user that is used for connection
Query Parameters
database
(string, optional): Name of the database to be used for data collectiontable
(string, optional): Name of the table to be used for data collectiontime_field
(string, optional): Name of the column to be used as timestampreturn_data_types
(string, optional): Flag to determine whether to return data types of the columns (Values: true, false)ignore_type
(list, optional): List of data types to ignore
Sample Request
Case 1: Fetching list of databases
curl --location 'https://app.4pointx.com/_config/pipelines/sql/connect' \ --header 'Content-Type: application/json' \ --data '{ "server_address": "sql.freedb.tech", "port": 3306, "username": "freedb_user", "password": "M@4may7sZH*!2*R" }'
Case 2: Fetching list of tables in a database
curl --location 'https://app.4pointx.com/_config/pipelines/sql/connect?database=freedb_test_sql_gateway' \ --header 'Content-Type: application/json' \ --data '{ "server_address": "sql.freedb.tech", "port": 3306, "username": "freedb_user", "password": "M@4may7sZH*!2*R" }'
Case 3: Fetching list of columns in a table
curl --location 'https://app.4pointx.com/_config/pipelines/sql/connect?database=freedb_test_sql_gateway&table=production' \ --header 'Content-Type: application/json' \ --data '{ "server_address": "sql.freedb.tech", "port": 3306, "username": "freedb_user", "password": "M@4may7sZH*!2*R" }'
Case 4: Fetching list of columns in a table except timestamp column
curl --location 'https://app.4pointx.com/_config/pipelines/sql/connect?database=freedb_test_sql_gateway&table=production&time_field=ts' \ --header 'Content-Type: application/json' \ --data '{ "server_address": "sql.freedb.tech", "port": 3306, "username": "freedb_user", "password": "M@4may7sZH*!2*R" }'
Case 5: Fetching data types of columns in a table except timestamp column
curl --location 'https://app.4pointx.com/_config/pipelines/sql/connect?database=freedb_test_sql_gateway&table=production&time_field=ts&return_data_types=true' \ --header 'Content-Type: application/json' \ --data '{ "server_address": "sql.freedb.tech", "port": 3306, "username": "freedb_user", "password": "M@4may7sZH*!2*R" }'
Case 6: Fetching columns in a table except timestamp column and data types which are to be ignored
curl --location 'https://app.4pointx.com/_config/pipelines/sql/connect?database=freedb_test_sql_gateway&table=production&time_field=ts&return_data_types=false&ignore_type=["varchar"]' \ --header 'Content-Type: application/json' \ --data '{ "server_address": "sql.freedb.tech", "port": 3306, "username": "freedb_user", "password": "M@4may7sZH*!2*R" }'
Sample Response
Success
Case 1: Fetching list of databases
[ "freedb_test_sql_gateway", "information_schema", "performance_schema" ]
Case 2: Fetching list of tables in a database
[ "condition", "energy", "fft", "process", "production" ]
Case 3: Fetching list of columns in a table
[ "id", "ts", "product_id", "product_name", "batch_number", "production_line", "quantity", "cost", "operator", "status" ]
Case 4: Fetching list of columns in a table except timestamp column
[ "id", "product_id", "product_name", "batch_number", "production_line", "quantity", "cost", "operator", "status" ]
Case 5: Fetching data types of columns in a table except timestamp column
[ "int", "varchar", "decimal" ]
Case 6: Fetching columns in a table except timestamp column and data types which are to be ignored
[ "id", "product_id", "quantity", "cost" ]
Error
{ "error": { "status": 400, "message": "Missing parameters: <param1>, <param2>" } }
{ "error": { "status": 400, "message": "Failed to connect to DB" } }
{ "error": { "status": 400, "message": "ignore_type must be a list" } }