...
- Temporal database stores full information in the payload ( CPS-192: Design data store for Temporal Service).
- It is a possibility possible that data stored for the different timestamps is the same, especially if the payload is used to filter data.
- Data in response body will always contain the entire payload.
Query APIs
Filtering Data
...
- The query output can have many rows so it is important to limit the fetched data. To limit it and to add a pagination feature, we added below query parameters provided two
- index
- maxSize: default as 1000 (configurable) with the ability to override.
Proposed APIs
No | API endpoint | Description | Example |
---|---|---|---|
1. | GET /dataspaces/{dataspace-name}/anchors/{anchor-name}?after=<epoch-time>&maxSize=1000 | Return all the data entries for an anchor after the specified epoch in nanoseconds | |
2. | GET /dataspaces/{dataspace-name}/schema-sets/{schema-set}?after=<epochtime> | Return all the data entries based on provided schema-set after the specified epoch in nanoseconds. | |
Response Body
It contains three field
name | type | |
---|---|---|
nextRecordsLink | string | added only if there are remaining records to be fetched for the query. |
previousRecordsLink | string | added only if it is not the first set of records. |
records | list | contains one record for each timestamp that meets filtering criteria. It contains header information along with data. |
Code Block |
---|
{ "headernextRecordsLink": { "next": "cps-temporal/api/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}?after=<epoch-time>&maxSize=1000&before=<epoch-time>&index=2", "dataspacepreviousRecordsLink" : "abcd", "schema-set": "ijkl" }: "cps-temporal/api/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}?after=<epoch-time>&maxSize=1000&before=<epoch-time>&index=0", "datarecords": [ { "timestamp": "1234567788889", "anchor-iddataspace": "pnfmy-namedataspace", "payload": { "status" schemaSet": "UPmy-schema-set", "key1anchor" : "value1my-anchor", "more-infodata": { "key2status" : "value" }UP" } } ] } |
Open Items
- Datetime format
...