Overview


The API infrastructure uses a highly regarded OAuth2 server.

Our APIs can be tested with popular tools like Postman or [Insomnia]()

  1. Access the system from the admin base url (TBA)
  2. Log in as a moderator, then go to Moderator Tasks. From there you can generate an access token with proper scopes. Copy the token and use it in the Authorisation / Bearer Token section in the request configuration of your chosen testing application (Postman, Insomnia etc.)
  3. Prepare the request according to the method and the URI. For example, to add data use the POST method and set the URL according to the URI.
  4. /api/v1/raw-data and the base URL https://app.augmentedinsights.cloud/api/v1/raw-data

Next, you need to add HTTP Headers including:

  • Content-Type: application/json
  • Accept: application/json

Example JSON

Prepare the HTTP request body if necessary. This is usually in stringified JSON format. For example, a request body to add data:

{
  "dst": "care_home_001_elect",
  "ds": "electricity",
  "entity": "john",
  "ts": "2019-04-04T10:25:03.123456+08:00",
  "value": 789
}

The common success response will give a 2xx HTTP status code as well as the data in JSON format.

For example, 200 OK or 201 Created.

Errors

The common error responses will give 4xx HTTP status code and optionally the message / errors. For example:

  • 401 Unauthorized
  • 403 Forbidden
  • 400 Bad request, with the error message and more detail errors if applicable.