Methods
Reference
/api/db/create
Executes create query against DropKit
POST /api/db /create
Parameters
Name Type Description
db_statement string SQL exec command
caller_pk string Caller private key
Response
Content Type: application/json
Name Type Description
Code number Response code
Message string Response message
Audit string Audit log hash
Response Code
Code Description
0 Success
20101 Unauthorized
Sample Input
{
"db_statement" : "CREATE TABLE employee (id int PRIMARY KEY, name varchar, age int, language varchar)" ,
"caller_pk" : "00000000000000000000000000000000000000000000000000000000000000000000"
}
Sample Response
{
"Code" : 0 ,
"Message" : "Ok" ,
"Audit" : "0x6eb3bc317d8bcb363d7f60f54e3f1503cdb80d82b3f3b775b3186a4a5262a626"
}
curl Example
curl http://localhost:5000/api/db/create \
-X POST \
-d '{
"db_statement": "CREATE TABLE employee (id int PRIMARY KEY, name varchar, age int, language varchar)",
"caller_pk": "00000000000000000000000000000000000000000000000000000000000000000000"
}'
{"Code" : 0,"Message" : "Ok" ,"Audit" : "0x6eb3bc317d8bcb363d7f60f54e3f1503cdb80d82b3f3b775b3186a4a5262a626" }
/api/db/insert
Executes insert query against DropKit
POST /api/db /insert
Parameters
Name Type Description
db_statement string SQL exec command
caller_pk string Caller private key
Response
Content Type: application/json
Name Type Description
Code number Response code
Message string Response message
Audit string Audit log hash
Response Code
Code Description
0 Success
20101 Unauthorized
Sample Input
{
"db_statement" : "INSERT INTO employee (id, name, age, language) VALUES (1, 'John', 35, 'Go')" ,
"caller_pk" : "00000000000000000000000000000000000000000000000000000000000000000000"
}
Sample Response
{
"Code" : 0 ,
"Message" : "Ok" ,
"Audit" : "0x6eb3bc317d8bcb363d7f60f54e3f1503cdb80d82b3f3b775b3186a4a5262a626"
}
curl Example
curl http://localhost:5000/api/db/insert \
-X POST \
-d '{
"db_statement": "INSERT INTO employee (id, name, age, language) VALUES (1, ' John', 35, ' Go')",
"caller_pk": "00000000000000000000000000000000000000000000000000000000000000000000"
}'
{"Code" : 0,"Message" : "Ok" ,"Audit" : "0x6eb3bc317d8bcb363d7f60f54e3f1503cdb80d82b3f3b775b3186a4a5262a626" }
/api/db/select
Executes select query against DropKit
POST /api/db /select
Parameters
Name Type Description
db_statement string SQL exec command
caller_pk string Caller private key
Response
Content Type: application/json
Name Type Description
Code number Response code
Message string Response message
Data list Database response
Audit string Audit log hash
Response Code
Code Description
0 Success
20101 Unauthorized
Sample Input
{
"db_statement" : "SELECT name, age, language FROM employee WHERE id = 1" ,
"caller_pk" : "00000000000000000000000000000000000000000000000000000000000000000000"
}
Sample Response
{
"Code" : 0 ,
"Message" : "Ok" ,
"Data" : [
{
"age" : 35 ,
"language" : "Go" ,
"name" : "John"
}
],
"Audit" : "0x19c5a417c739977c39dfefc7cd86762e3a6ba2cac7beba5f77452814fd2a613a"
}
curl Example
curl http://localhost:5000/api/db/select \
-X POST \
-d '{
"db_statement": "SELECT name, age, language FROM employee WHERE id = 1",
"caller_pk": "00000000000000000000000000000000000000000000000000000000000000000000"
}'
{"Code" : 0,"Message" : "Ok" ,"Data" : [{"age" : 35,"language" : "Go" ,"name" : "John" }],"Audit" : "0x19c5a417c739977c39dfefc7cd86762e3a6ba2cac7beba5f77452814fd2a613a" }