Synthetic query

Execute an on-the-fly synthetic query

Securityoidc-token or oauth2-client-credentials or oauth2-open-industrial-data or oauth2-auth-code
Request
Request Body schema: application/json
required

The list of queries to perform

required
Array of objects (SyntheticQuery) [ 1 .. 10 ] items
Responses
200

List of datapoints for the specified queries.

400

Query error

post/timeseries/synthetic/query
Request samples
expression = '''
    123
    + ts{id:123}
    + ts{externalId:'abc'}
    + ts{space:'my-space',externalId:'my-ts-xid'}
'''
dps = client.time_series.data.synthetic.query(
    expressions=expression,
    start="2w-ago",
    end="now")

from cognite.client.data_classes.data_modeling.ids import NodeId
ts = client.time_series.retrieve(id=123)
variables = {
    "A": ts,
    "B": "my_ts_external_id",
    "C": NodeId("my-space", "my-ts-xid"),
}
dps = client.time_series.data.synthetic.query(
    expressions="A+B+C", start="2w-ago", end="now", variables=variables)

from sympy import symbols, cos, sin
x, y = symbols("x y")
dps = client.time_series.data.synthetic.query(
    [sin(x), y*cos(x)],
    start="2w-ago",
    end="now",
    variables={x: "foo", y: "bar"},
    aggregate="interpolation",
    granularity="15m",
    target_unit="temperature:deg_c")
Response samples
application/json
{
  • "items": [
    • {
      }
    ]
}