Example of the REST Query API

About this task

The REST query container exposes port 8989 for querying the data that was read from the Historian database. For information on the list of APIs and their usage, refer to the Predix Time Series service API documentation.
Note: The API /v1/datapoints/latest/v2 is not supported by the REST query.

Procedure

  1. Create a query.
    The header of the query must be in the following format:
    Headers:
        Authorization: Bearer <token from a trusted issuer>
        Predix-Zone-Id: <tenant>
        Content-Type: application/json
    The following table provides the URL and other required values for each task that you can perform using the REST query.
    Task URL Method Request Body Request Headers
    Get values for a tag http://<IP address of the Linux machine>:8989/v1/datapoints POST { “start”: “1h-ago”, “tags”: [ { “name”: “”, “order”: “desc” } ] } Predix-Zone-Id Can be any value. Not validated.
    Get values for a tag http://<IP address of the Linux machine>:8989/v1/datapoints?query= { “start”: “1h-ago”, “tags”: [ { “name”: “”, “order”: “desc” } ] } GET Predix-Zone-Id Can be any value. Not validated.
    Get all tags http://<IP address of the Linux machine>:8989/v1/tags GET None Predix-Zone-Id Can be any value. Not validated.
  2. Retrieve a token from the OAUTH2 server by using the following REST API:
    curl -u <Client-Id>:<Client-secret> https://<IP address of the Predix Edge OS device>:8080/uaa/oauth/token -d 'grant_type=client_credentials'
    curl -u edgeclient:edgesecret https://10.10.10.10:8080/uaa/oauth/token -d 'grant_type=client_credentials'