Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

As it is time-series data, it can be filtered based on three main criteria:

Datetime
  • Data in last X hours 
  • Data after a particular Data after specified DateTime (To be supported in Istanbul Release)
  • Data between a date rangebefore specified DateTime 
  • Last X records
DataTypes in CPS Core

...

NoNameTypeDefaultPurposeExample
1indexpageint0

The query output can have many rows so it is important to limit the fetched data. To limit the number of records and to provide pagination, these two parameters can be used. 

"indexpage" parameter represents the page number, starts with 0, and maxSize "limit" is the page size.


2maxSizelimitint1000
3pointInTimeTimestamp (ISO Format)CurrentDateTime

When a user uses the APIs with pagination (by running several stateless requests), the result set can be impacted by new states stored while navigating. This can be a challenge to retrieve a consistent result set. 

This parameter must be used to avoid this issue. However, It will not provide a consistent result set if data, that meet search criteria, get deleted because of the cleanup triggered by the retention policy.


4

sortBysort

string LATEST_FIRSTtimestamp:desc

Data is by default returned sorted by the timestamp in descending order. It can be overridden and data can be sorted by multiple fields.

sort=timestamp:asc,anchor:descPossible values - OLDEST_FIRST & LATEST_FIRST

Assumptions

...

  1. after - timestamp ( ISO Format) to consider data created after the specified Timestamp
  2. payload simplePayloadFilter - to define payload filtering criteria
  3. index page - to define the page number (required for pagination)
  4. maxSize limit - to limit the response size
  5. pointInTime - to consider data changed or added before this time.
  6. sortBy sort - to define the order of data in the result set

...

Example: GET /dataspaces/{dataspace-name}​/anchors/{anchor-name}​?after=2021-03-21T00:00:00-0:00&payloadsimplePayloadFilter={"idNearRTRIC":"1"}&maxSizelimit=500

Endpoint Format B

URL: GET /dataspaces/{dataspace-name}​/anchor-data?anchor={anchor-name}

Example: GET /dataspaces/{dataspace-name}​/anchor-data?anchor={anchor-name}​&after=2021-03-21T00:00:00-0:00&payloadsimplePayloadFilter={"idNearRTRIC":"1"}&maxSizelimit=500

By Dataspace and Schema-set

...

Example: GET /dataspaces/{dataspace-name}/anchors?schemaSet={schemaset-name}&after=2021-03-21T00:00:00-0:00&payloadsimplePayloadFilter={"idNearRTRIC":"1"}

Endpoint Format B

...

Example: GET /dataspaces/{dataspace-name}/anchor-data?schemaSet={schemaset-name}&after=2021-03-21T00:00:00-0:00&payloadsimplePayloadFilter={"idNearRTRIC":"1"}

Response 
Anchor
responseBody
responseBody

...

Code Block
{
  "nextRecordsLink": "cps-temporal/api/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}?after=2021-03-21T00:00:00-0:00&payloadsimplePayloadFilter={"idNearRTRIC":"1"}&maxSizelimit=500&pointInTime=2021-04-21T00:00:00-0:00&indexpage=2",
  "previousRecordsLink": "cps-temporal/api/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}?after=2021-03-21T00:00:00-0:00&payloadsimplePayloadFilter={"idNearRTRIC":"1"}&maxSizelimit=500&pointInTime=2021-04-21T00:00:00-0:00&indexpage=0",
  "records": [
    {
      "timestamp": "2021-03-21T00:00:00-0:00",
      "dataspace": "my-dataspace",
      "schemaSet": "my-schema-set",
      "anchor": "my-anchor",
      "data": {
        "status" : "UP"
      }
    }
  ]
}

...