ATEST-302
This commit is contained in:
72
Readme.md
72
Readme.md
@ -60,21 +60,47 @@ POST http://<host>:<port>/channels
|
||||
#### Data
|
||||
|
||||
```json
|
||||
{"regex": "TRFCA|TRFCB", "dbMode": "databuffer"}
|
||||
{"regex": "TRFCA|TRFCB","backends": ["databuffer"],"ordering":"asc","reload":true}
|
||||
```
|
||||
|
||||
##### Explanation
|
||||
|
||||
- **regex**: Reqular expression used to filter channel names (default: no filtering). Filtering is done using JAVA's [Pattern](https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html), more precisely [Matcher.find()](https://docs.oracle.com/javase/8/docs/api/java/util/regex/Matcher.html#find--)).
|
||||
- **dbMode**: Defines the database to access (values: **databuffer**|archiverappliance)
|
||||
|
||||
- **regex**: Reqular expression used to filter channel names. In case this value is undefined, no filter will be applied. Filtering is done using JAVA's [Pattern](https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html), more precisely [Matcher.find()](https://docs.oracle.com/javase/8/docs/api/java/util/regex/Matcher.html#find--)).
|
||||
- **backends**: Array of backends to access (values: databuffer|archiverappliance|filestorage). In case this value is undefined, all backends will be queried for their channels.
|
||||
- **ordering**: The ordering of the channel names (values: **none**|asc|desc).
|
||||
- **reload**: Forces the server to reload cached channel names (values: **false**|true).
|
||||
|
||||
### Example
|
||||
|
||||
#### Command
|
||||
|
||||
```bash
|
||||
curl -H "Content-Type: application/json" -X POST -d '{"regex": "TRFCA|TRFCB"}' http://data-api.psi.ch/sf/channels
|
||||
```
|
||||
|
||||
#### Response
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"backend":"databuffer",
|
||||
"channels":[
|
||||
"Channel_01",
|
||||
"Channel_02",
|
||||
"Channel_03"
|
||||
]
|
||||
},
|
||||
{
|
||||
"backend":"archiverappliance",
|
||||
"channels":[
|
||||
"Channel_01",
|
||||
"Channel_04",
|
||||
"Channel_05"
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
<a name="query_range"/>
|
||||
|
||||
## Query Range
|
||||
@ -127,6 +153,36 @@ Queries are applied to a range. The following types of ranges ranges are support
|
||||
- **endMillis**: The end time of the range.
|
||||
- **[endNanos]**: The optional nanosecond offset.
|
||||
|
||||
<a name="query_channel_names"/>
|
||||
|
||||
## Query Channel Names
|
||||
|
||||
The simplest way to define channels is to use an array of channel name Strings.
|
||||
|
||||
```json
|
||||
"channels":[
|
||||
"Channel_02",
|
||||
"Channel_04"
|
||||
]
|
||||
```
|
||||
|
||||
The query interface will automatically select the backend which contains the channel (e.g., *databuffer* for *Channel_02* and *archiverappliance* for *Channel_04*. In case name clashes exist, the query interface will use following order of priority: *databuffer*, *archiverappliance* and *filestorage*.
|
||||
|
||||
It is also possible to explicitly define the backend to overcome name clashes.
|
||||
|
||||
```json
|
||||
"channels":[
|
||||
{
|
||||
"name":"Channel_01",
|
||||
"backend":"archiverappliance"
|
||||
},
|
||||
{
|
||||
"name":"Channel_01",
|
||||
"backend":"databuffer"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
<a name="query_data"/>
|
||||
|
||||
@ -144,7 +200,7 @@ A request is performed by sending a valid JSON object in the HTTP request body.
|
||||
|
||||
The following attributes can be specified:
|
||||
|
||||
- **channels**: Array of channel names to be queried.
|
||||
- **channels**: Array of channels to be queried (see [Query Range](Readme.md#query_channel_names)).
|
||||
- **range**: The range of the query (see [Query Range](Readme.md#query_range)).
|
||||
- **ordering**: The ordering of the data (see [here](https://git.psi.ch/sf_daq/ch.psi.daq.common/blob/master/src/main/java/ch/psi/daq/common/ordering/Ordering.java) for possible values).
|
||||
- **fields**: The requested fields (see [here](https://git.psi.ch/sf_daq/ch.psi.daq.query/blob/master/src/main/java/ch/psi/daq/query/model/QueryField.java) for possible values).
|
||||
@ -152,8 +208,6 @@ The following attributes can be specified:
|
||||
- **binSize**: Activates data binning. Specifies the number of pulses per bin for pulse-range queries or the number of milliseconds per bin for time-range queries (using number of pulses and number of milliseconds makes this binning strategy consistent between channel with different update frequencies).
|
||||
- **aggregations**: Activates data aggregation. Array of requested aggregations (see [here](https://git.psi.ch/sf_daq/ch.psi.daq.query/blob/master/src/main/java/ch/psi/daq/query/model/Aggregation.java) for possible values). These values will be added to the *data* array response.
|
||||
- **aggregationType**: Specifies the type of aggregation (see [here](https://git.psi.ch/sf_daq/ch.psi.daq.query/blob/master/src/main/java/ch/psi/daq/query/model/AggregationType.java)). The default type is *value* aggregation (e.g., sum([1,2,3])=6). Alternatively, it is possible to define *index* aggregation for multiple arrays in combination with binning (e.g., sum([1,2,3], [3,2,1]) = [4,4,4]).
|
||||
- **aggregateChannels**: Specifies whether the data of the requested channels should be combined together using the defined aggregation (values: true|**false**)
|
||||
- **dbMode**: Defines the database to access (values: **databuffer**|archiverappliance)
|
||||
- **compression**: Defines the compression algorithm to use, default value is **none**, see all values [here](https://github.psi.ch/sf_daq/ch.psi.daq.query/blob/master/src/main/java/ch/psi/daq/query/model/Compression.java))
|
||||
- **responseFormat**: Specifies the format the response of the requested data is in, either in JSON or CSV format, default value **JSON**, see all values [here](https://github.psi.ch/sf_daq/ch.psi.daq.query/blob/master/src/main/java/ch/psi/daq/query/model/ResponseFormat.java))
|
||||
|
||||
@ -165,7 +219,7 @@ If compression is enabled, we have to tell `curl` that the data is compressed so
|
||||
|
||||
### `responseFormat`: data is in JSON by default
|
||||
|
||||
Responses can be formatted as CSV or JSON using the `responseFormat` field. The returned data is JSON-formatted per default.
|
||||
Responses can be formatted as CSV or JSON using the `responseFormat` field. The returned data is JSON-formatted by default.
|
||||
|
||||
CSV export does not support `index` and `extrema` aggregations.
|
||||
|
||||
@ -319,7 +373,7 @@ See JSON representation of the data above.
|
||||
|
||||
```json
|
||||
{
|
||||
"dbMode":"archiverappliance",
|
||||
"backend":"archiverappliance",
|
||||
"range":{
|
||||
"startMillis":0,
|
||||
"startNanos":0,
|
||||
|
Reference in New Issue
Block a user