Genres endpoint¶
The genres
endpoint returns data for all the different genres that songs in
the music collection belong to.
Path and method¶
GET /avalon/genres
Note
This path may be different depending on your REQUEST_PATH
configuration setting.
Filtering Parameters¶
Name | Required? | Type | Mutiple? | Description |
---|---|---|---|---|
query |
No | string |
No | Select only genres whose name contains query . The match is
not case sensitive and unicode characters will be normalized if
possible before being compared (in the query and fields
being compared). The query is compared using prefix
matching against each portion of the genre (delimited by
whitespace). |
Other Parameters¶
Name | Required? | Type | Mutiple? | Description |
---|---|---|---|---|
limit |
No | integer |
No | If there are more than limit results, only limit will
be returned. This must be a positive integer . If the
offset parameter is present, the limit will be applied
after the offset . If the limit is not an integer
error code 101 (invalid parameter type) will be returned.
If the limit is not positive error code 102 (invalid
parameter value) will be returned. |
offset |
No | integer |
No | Skip the first offset entries returned as part of a result
set. This must be a positive integer . This parameter does
not have any effect if the limit parameter is not also
present. If the offset is not an integer error code
101 (invalid parameter type) will be returned. |
order |
No | string |
No | Name of the field to use for ordering the result set. Any valid
field of the members of the result set may be used. If the
order is not a valid field error code 100 (invalid
parameter name) will be returned. |
direction |
No | string |
No | Direction to sort the results in. Valid values are asc or
desc . This parameter does not have any effect if the
order parameter is not also present. If the direction
is not asc or desc error code 102 (invalid
parameter value) will be returned. |
Example request¶
Possible error responses¶
Code | Message key | HTTP code | Description |
---|---|---|---|
100 | avalon.service.error.invalid_input_name | 400 | An error that indicates that the name of a field specified is not a valid field. |
101 | avalon.service.error.invalid_input_type | 400 | An error that indicates the type of a parameter is not valid for that particular parameter. |
102 | avalon.service.error.invalid_input_value | 400 | An error that indicates the value of a parameter is not valid for that particular parameter. |
Success output format¶
{ "warnings": [], "success": [ { "name": "Hard Rock", "id": "ec93d3f1-3642-5beb-bb10-07f29bb18fc5" }, { "name": "Punk Ska", "id": "3af7ba62-d87f-5258-af62-d7c5655ec567" } ], "errors": [] }
Error output format¶
{ "warnings": [], "success": null, "errors": [ { "payload": { "value": -10, "field": "offset" }, "message_key": "avalon.service.error.invalid_input_value", "message": "The value of offset may not be negative", "code": 102 } ] }