Restful api documentation


1.query

description:

Accepts a sql query string (like select ... from databaseid.tablename), and then returns the result content.

url:

http://54.174.80.167:7654/Query/

request:

content-type:application/json
request-type: PUT
request-json-format:

{"query":"your query string here"}

-(root)
  -query String


response:


content-type:application/json
response-json-format:

{
"schema": {
"columnNames": ["column1", "column2", "column3"]
},
"data": [{
"row": ["value11", "value12", "value13"]
}]
}


-(root)
  -schema
    -columnNames (String[])
  -data (row[])
    -row (String[])
      .
      .
      .
    -row (String[])


error response:


response-json-format:
{
"error" : "error type",
"message" : "description of error"
}


2.get table content

description:


Accepts databseid and tableName as parameters, and then returns the table content.

url


http://54.174.80.167:7654/Query/{databaseid}/{tablename}

request:


request-type: GET

response: (same as above)


content-type:application/json
response-json-format:

{
"schema": {
"columnNames": ["column1", "column2", "column3"]
},
"data": [{
"row": ["value11", "value12", "value13"]
}]
}

-(root)
  -schema
    -columnNames (String[])
  -data (row[])
    -row (String[])
      .
      .
      .
    -row (String[])

error response:


response-json-format:
{
"error" : "error type",
"message" : "description of error"
}


3. save query result as new datasource (debugging)

description:


With user input register information, it saves the query result as a new datasource. Will register on metastore and our matcher. Only select queries can be saved.

url:


http://54.174.80.167:7654/Query/Save/

request:


content-type:application/json
request-type: PUT
request-json-format:

{
"ip":"xxx.xxx.xxx.xxx",
"port":"pppp",
"dbtype":"MySQL",
"username":"your_username",
"password":"your_password",
"dbname":"database name",
"title":"title of the post",
"description":"description of the post",
"tablename":"your_table_name",
"query":"your query string here"
}

-(root)
  -ip String
  -port String
  -dbtype String
  -username String
  -password String
  -dbname String
  -title String
  -description String
  -tablename String
  -query String

response:


content-type:application/json
response-json-format:

{
"success": "the table has been saved"
}

-(root)
  -success String("the table has been saved")


error response:


response-json-format:
{
"error" : "error type",
"message" : "description of error"
}


4. add catalog (done, only open to metastore)

description:


With input information, it saves datasource connection as presto catalog, and did,catalog,databsename in matcher.

url:


http://54.174.80.167:7654/Catalog/add

request:


content-type:application/json
request-type: PUT
request-json-format:

{
"id":"databaseid",
"ip":"xxx.xxx.xxx.xxx",
"port":"pppp",
"dbtype":"MySQL",
"username":"your username",
"password":"your password",
"dbname":"database name"
}

-root
  -id String
  -ip String
  -port String
  -dbtype String
  -username String
  -password String
  -dbname String


response:


content-type:application/json
response-json-format:

{
"success": "the record has been saved"
}

-(root)
  -success String("the record has been saved")


error response:


response-json-format:
{
"error" : "error type",
"message" : "description of error"
}


5. drop catalog (done, only open to metastore)

description:


Delete both the catalog file and the record in our matcher, where the database id is did.

url:


http://54.174.80.167:7654/Catalog/drop/{did}

request: did is the database id

request-type: GET

response:


content-type:application/json
response-json-format:

{
"success": "the record has been deleted"
}

-(root)
  -success String("the record has been deleted")


error response:


response-json-format:
{
"error" : "error type",
"message" : "description of error"
}