Data Query Service v0.5.0

Data Query Service v0.5.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Base URLs:

Authentication

  • HTTP Authentication, scheme: bearer

Default

Search health data by executing the provided SQL statement.

Code samples

URL obj = new URL("http://localhost:3030/api/projects/{projectId}/sql");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /sql

Body parameter

{
  "sql": "select * from heartrates where user_id='u1'"
}

Parameters

Name In Type Required Description
projectId path string true This is the ID of the project that needs to be retrieved.
body body object true An SQL statement. This is only allowed to retrieve data.

Example responses

200 Response

{
  "metadata": {
    "columns": [
      "user_id",
      "..."
    ],
    "count": 8
  },
  "data": [
    {
      "id": "1",
      "user_id": "u1",
      "time": "2019-05-21T00:00:00.000Z",
      "bpm": 120
    },
    {
      "id": "2",
      "user_id": "u1",
      "time": "2019-05-22T00:00:00.000Z",
      "bpm": 108
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK

This is the expected response to a valid request. Inline
default Default An unexpected error occurred. Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» metadata any false none none
» data [object] true none none

Status Code default

Name Type Required Restrictions Description
» code integer(int32) true none none
» message string true none none

Schemas

Error




{
  "code": 0,
  "message": "string"
}

Properties

Name Type Required Restrictions Description
code integer(int32) true none none
message string true none none