REST api v2
Last updated
Last updated
We are expanding and improving the REST api. At its heart is a simplified query syntax called RSQL for collection queries For query syntax see RSQL parser. In addition we simplify the reading of entities.
Request
Request
We use the RSQL HTTP/URL based query language:
See the MOLGENIS RSQL documentation for all supported operators in MOLGENIS and matching examples.
We also support aggregation of the result query:
The aggregation query supports the RSQL selectors 'x', 'y' and 'distinct' and the RSQL operator '=='. The selector 'x' defines the first aggregation attribute name, 'y' defines the second aggregation attribute name, 'distinct' defines the distinct aggregation attribute name.
For simple lookup lists, it might be a convenience to include the list in the initial API response. You can do this for CATEGORICAL, and CATEGORICAL_MREF attributes using includeCategories
.
Not including the query option will set it to the default false
.
You can add a unique, visible attribute to the metadata of the table after the ID-attribute to sort the categorical options.
NOTE: Make sure the ID-attribute is invisible.
Attribute definition
Metadata of target table
When you call a V2 call with the includeCategories option this column will be used to sort on.
TableA
TableB
Request
Response
Request
To create/add a list of entities into a collection you can POST the 'entities' parameter to a collection:
Request
Response
Body
To batch update a list of entities of a collection you can PUT the 'entities' parameter to a collection:
Request
Response
(since v3.0.0)
To delete a list of entities of a collection you can DELETE the 'entityIds' parameter to a collection:
Request
Response
Body
If you only want to change one attribute without needing to provide all other attributes:
Request
Response
Key
Type
Description
attrs
Comma-separated string
Defines which fields in the API response to select
_method
HTTP method
Tunnel request through defined method over default API operation
Key
Type
Description
q
Query string in RSQL
RSQL query to filter the entity collection response
sort
Query string in RSQL
Defines how entity collection response is sorted
attrs
Comma-separated string
Defines which fields in the API response to select
start
int
Offset in resource collection
num
int
Number of resources to retrieve starting at start
_method
HTTP method
Tunnel request through defined method over default API operation
Key
Type
Description
q
Query string in RSQL
RSQL query to filter the entity collection response
aggs
Aggregation query string in RSQL
Aggregation query to aggregate entities
Key
Type
Description
includeCategories
boolean
Includes a list of categorical options in attribute metadata for CATEGORICAL and CATEGORICAL_MREF attributes
id
visible
unique
type
mySortAttribute
TRUE
TRUE
int
id
mySortAttribute
label
A
0
A very awesome category
B
2
A very busy category
C
1
A very complex category
id
category
1
A
id
label
A
A very awesome category
B
A very busy category
C
A very complex category