Entry API to Read Data
The API provides several endpoints for reading data from an entry including reading a single record, reading multiple records in a batch, and querying records for a time interval.
Get a Record from an Entry​
The method finds a record for the given timestamp or query ID and sends its content in the HTTP response body. It also sends meta information in headers:
x-reduct-time- UNIX timestamp of the record in microsecondsx-reduct-last- 1 - if a record is the last record in the query (deprecated since version 1.4, use NoContent response)x-reduct-label-<name>- a value of the<name>label
If authentication is enabled, the method needs a valid API token with read access to the entry's bucket.
Changes:
- Version 1.3: the database supports labels. If a record has some
labels, the method sends them as headers that start with
x-reduct-label. - Version 1.4: the
x-reduct-lastheader is deprecated. Use the NoContent response instead.
Get a Batch of Records from an Entry​
The method retrieves a batch of records for the given query ID and sends their contents in the HTTP response body.
The method works in conjunction with the GET /b/:bucket/:entry/q method and uses the Batch Protocol to read records in a batch.
If authentication is enabled, the method needs a valid API token with read access to the entry's bucket.
Changes:
- Version 1.5: the method was introduced.
Query Records for a Time Interval​
The method responds with a JSON document containing an ID which should be
used to read records with the following endpoint: GET /b/:bucket_name/:entry_name?q=ID.
The time interval is [start, stop).
If authentication is enabled, the method needs a valid API token with read access to the bucket of the entry.
Changes:
- Version 1.3: the method also provides the
include-<label>andexclude-<label>query parameters to filter records based on the values of certain labels. For example:This would find all records that haveGET /api/v1/:bucket/:entry/q?include-<label1>=foo&exclude-<label2>=barlabel1equal to "foo" and excludes those that havelabel2equal to "bar". A user can specify multipleincludeandexcludelabels, which will be connected with an AND operator. For example:GET /api/v1/:bucket/:entry/q?include-<label1>=foo&include-<label2>=bar - Version 1.4: the method has the
continuousflag. If it is true, the current query will not be discarded if there are no records. A client can ask them later. The query will not be removed until its TTL has expired. Thestopparameter is ignored for continuous queries. - Version 1.6: the method provides the
limitquery parameter. It limits the number of records in the query. If it is not set, the query is unlimited by default. - Version 1.10: the method has the
each_nandeach_squery parameters. If theeach_nparameter is set, the method returns only everyeach_n-th record. If theeach_sparameter is set, the method returns only one record pereach_sseconds.
Reading only meta information​
Sometimes you need to retrieve only the meta information about a record without its content, ReductStore provides the HEAD version of the read endpoints for this purpose.