API¶
The Resolwe framework provides a RESTful API through which most of its functionality is exposed.
TODO
Elasticsearch endpoints¶
Advanced lookups¶
All fields that can be filtered upon (as defined for each viewset) support specific lookup operators that can be used for some more advanced lookups.
Currently the supported lookup operators are:
ltcreates an ES range query withltbound. Supported for number and date fields.ltecreates an ES range query withltebound. Supported for number and date fields.gtcreates an ES range query withgtbound. Supported for number and date fields.gtecreates an ES range query withgtebound. Supported for number and date fields.increates an ES boolean query with all values passed as a should match. For GET requests, multiple values should be comma-separated.exactcreates an ES query on therawsubfield of the given field, requiring the value to match exactly with the raw value that was supplied during indexing.
Limiting fields in responses¶
As responses from the Resolwe API can contain a lot of data, especially with nested JSON outputs and schemas, the API provides a way of limiting what is returned with each response.
This is achieved through the use of a special fields GET parameter, which
can specify one or multiple field projections. Each projection defines what
should be returned. As a working example, let’s assume we have the following
API response when no field projections are applied:
[
{
"foo": {
"name": "Foo",
"bar": {
"level3": 42,
"another": "hello"
}
},
"name": "Boo"
},
{
"foo": {
"name": "Different",
},
"name": "Another"
}
]
A field projection may reference any of the top-level fields. For example, by
using the fields=name projection, we get the following result:
[
{
"name": "Boo"
},
{
"name": "Another"
}
]
Basically all fields not matching the projection are gone. We can go further
and also project deeply nested fields, e.g., fields=foo__name:
[
{
"foo": {
"name": "Foo"
}
},
{
"foo": {
"name": "Different"
}
}
]
And at last, we can combine multiple projections by separating them with commas,
e.g., fields=name,foo__name, giving us:
[
{
"foo": {
"name": "Foo"
},
"name": "Boo"
},
{
"foo": {
"name": "Different"
},
"name": "Another"
}
]