NAV
cURL JavaScript

Time Series Query Search API

Examples below make use of the TSA server of the production Waylay SaaS cluster at
https://ts-analytics.waylay.io
The examples use apiKey/apiSecret authentication. These credentials can be obtained through the Waylay Console.

The GET /config/query list and search endpoint, as part of the Time Series Query API.

Search

GET /config​/query provides listing and search on the previously saved Time Series Query entities.

Using a search filter name:demo tag:demo -tag:not-demo resource:151CF

curl -u apiKey:apiSecret \
  'https://ts-analytics.waylay.io/config/query?q=name:demo+tag:demo+-tag:not-demo+resource:151CF' 

The following url parameters are supported:

key default description
q none a valid search string
represents a search filter, see below
limit 10 integer between 0 and 100
the maximal number of entities
represented in the result
offset 0 non-negative integer
number of skipped entities in
the underlying database query (paging)

Search Response

HTTP 200
{
  "messages": [],
  "queries": [
    {
      "name": "151CF-temperature",
      "meta": {
        "name": "temperature",
        "tags": [
          "imported"
        ],
        "resource": "151CF"
      },
      "attrs": {
        "created": "2019-10-16T13:51:22.991765+00:00",
        "created_by": "users/0476f99d-ac60-4f86-bc45-7215962754cd",
        "modified": "2020-08-25T11:53:21.406523+00:00",
        "modified_by": "users/0476f99d-ac60-4f86-bc45-7215962754cd"
      },
      "_links": {
        "self": {
          "href": "https://ts-analytics.waylay.io/config/query/151CF-temperature"
        },
        "execute": {
          "href": "https://ts-analytics.waylay.io/data/query/151CF-temperature"
        }
      }
    }
  ],
  "_links": {
    "self": {
      "href": "https://ts-analytics.waylay.io/config/query?q=name:temperature+resource:151D8&limit=1"
    },
    "last": {
      "href": "https://ts-analytics.waylay.io/config/query?q=name%3Atemperature+resource%3A151D8&limit=1&offset=7"
    },
    "next": {
      "href": "https://ts-analytics.waylay.io/config/query?q=name%3Atemperature+resource%3A151D8&limit=1&offset=1"
    }
  },
  "count": 1,
  "offset": 0,
  "limit": 1,
  "total": 8
}

The JSON response of a GET /config​/query has the following properties

As of release v0.19, results are always ordered by name, and by default be limited to a first page of 10 entities.

The result representation can have additional keywords that are general for the API:

The q Search Filter

The format of the search filter string (the value of the q request parameter) is specified in a domain specific language (DSL) that can be used to filter entities in the TSA Repository.

general aspects

These are the rules of the search filter language that is used in the q parameter:

    resource:APL4995 name:office tag:prio1,demo -tag:preview  
    created:"2020-04-22T12:34:00+00:00/" tag:demo,'ab c'

url encoding

created:"2020-04-22T12:34:00+00:00/" tag:demo,'ab c'

Note that, when specifying a search filter as the q url parameter, you’ll need to properly url-encode the value.

example of aggressive encoding

curl -u apiKey:apiSecret https://ts-analytics.waylay.io/config/query?q=created%3A%222020-04-22T12%3A34%3A00%2B00%3A00%2F%22+tag%3Ademo%2C%27ab+c%27

example of sufficient encoding

curl -u apiKey:apiSecret 'https://ts-analytics.waylay.io/config/query?q=created:"2020-04-22T12:00:00%2B00:00/"+tag:demo,%27ab+c%27'

supported search terms

The following search terms are currently supported when listing Time Series Query entities:

qualifier(s) matcher filter action
name a name fragment string the name of the entity contains the specified string
resource a resource id string the Time Series Query refers to a resource with this (exact) id
tag a tag label the tags array in the metadata contains (exactly) this tag
created_by, modified_by a user identifier matcher (see below) the user that created (resp. last modified) the Time Series Query should be as specified
created, modified a time interval (see below) the Time Series Query has been created (resp. last modified) within this time interval

user identifiers

The currently supported matchers for user identifiers are:

time intervals

The time intervals that match on the timestamp attributes created and modified, are ISO8601 interval expressions, with an extension for timestamps relative to now, and also allowing a millisecond epoch as absolute timestamp. Supported combinations are:

where <Tn> is a timestamp token and <Pn> a period token.

timestamp token

A timestamp token <Tn> can be formatted as:

period token

A period token <Pn> is formatted as:

quoting interval match expressions

created:"2020-04-22T12:34:00+00:00/now-P1W"

Note that when including a time part in an iso8601 expression, the whole matcher must be quoted, as it contains colons :.

combination logic

When multiple search terms or matchers are specified, their combination is interpreted according to the following rules:

same term qualifier is union (or)

# name contains 'AA' OR name contains 'BB' 
name:AA name:BB   

search terms with the same qualifier and exclusion are combined as a union (boolean OR).

different term qualifier is intersection (and)

# name contains 'AA' AND resource id is 'BB' 
# AND name does not contain 'CC'
name:AA resource:BB -name:CC 

(combined groups) for different qualifiers (or different exclusion) are combined as an intersection (boolean AND).

multiple matchers in term is intersection (and)

# name contains 'AA' AND name contains 'BB' 
name:AA,BB

a match expression that is a comma-separated list of matchers expands to an intersection (boolean AND).

examples

Some (contrived) examples to illustrate the combination logic for multiple search terms:

example 1

tag:label1 tag:label2 -tag:label3

selected queries must

AND

example 2

-tag:label2 name:my-query,test name:your-query,test

selected queries should

AND either its name should