Queries with REST

It’s best to become familiar with REST before trying these tests.

Here are some things to remember.

  1. By default the pattoo server will run on port TCP 20202.
  2. If you are running it on your local machine the RESTful API URLs will all start with http://localhost:20202/pattoo/api/v1/web/rest. All the examples assume make reference to this fact. So if the uri /data is mentioned then assume we are referring to the complete URL of http://localhost:20202/pattoo/api/v1/web/rest/data

Let’s begin.

Why a RESTful Interface?

We provide a RESTful interface for ease of comparison with GraphQL for a limited set of functions. There will be no further development of the RESTful beyond what is listed here. Do not write any pattoo related code based on REST. This feature is deprecated and will soon be removed.

Using the RESTful Interface (Deprecated)

View DataPoint data

To view data for generated by a specific DataPoint visit the /data URI. Add the idx_datapoint value to the end to get /data/1 for idx_datapoint value of 1.

  1. By default a week’s worth of data is returned.
  2. There is no ability to get data for all DataPoints simultaneously.
  3. You can use the ?secondsago=X query string to get data starting X seconds ago to the most recently stored data.

In this case we have data from /data/1?secondsago=3600

[
    {
        "1573619400" : 3878839847
    },
    {
        "1573619700" : 3879239629
    },
    {
        "1573620000" : 3879652192
    },
    {
        "1573620300" : 3880050372
    },
    {
        "1573620600" : 3880449410
    },
    {
        "1573620900" : 3880856015
    },
    {
        "1573621200" : 3881272430
    },
    {
        "1573621500" : 3881704477
    },
    {
        "1573621800" : 3882250116
    },
    {
        "1573622100" : 3882650025
    },
    {
        "1573622400" : 3883064936
    }
]