Stations
About
A station resource identifies an internet radio station. Below is a JSON representation of a station:
{
"id": 101,
"title": "Station Title",
"description": "Station description",
"genre": "Station genre",
"country": "Station country",
"language": "Station language",
"source": "http://internetradiostation.com/radio.mp3",
"playCount": 1,
"lastPlayed": "",
"creatorId": 1,
"approved": true,
"favourite": false
}
Properties
A station resource has the following properties:
Name | Description |
---|---|
approved | boolean Whether the station has been moderator approved. Non-approved stations are visible only to the user with creatorId |
country | string The country to which the station belongs. |
creatorId | integer The unique identifier of the user that created the station. |
description | string The description of the station. |
favourite | boolean Whether the station is in the authenticated user's favourites. |
genre | string The genre to which the station belongs. |
id | integer The unique identifier for the station. |
language | string The language to which the station belongs. |
lastPlayed | datetime The datetime at which the station was last marked as played by an authenticated user. |
playCount | boolean The number of times the station has been marked as played by an authenticated user. |
source | string The station stream URL. |
title | string The title of the station. |
Methods
The API supports the following methods:
Method | Endpoint | Description |
---|---|---|
GET | /stations | Retrieves a list of stations. |
POST | /stations | Creates a new station. Requires a valid access token. |
PUT | /stations/$STATION_ID | Updates an existing station. Requires a valid access token belonging to the user that created the station. |
GET /stations
Request
GET http://marxoft.co.uk/api/cuteradio/stations
Parameters
Name | Description |
---|---|
country | string Restricts results to those matching the specified country. |
genre | string Restricts results to those matching the specified genre. |
id | string Restricts results to those matching the comma-separated list of station ids. |
language | string Restricts results to those matching the specified language. |
limit | integer The maximum number of results that should be returned. Must be between 1 and 50. The default is 20. |
mine | boolean Restricts results to those created by the authenticated user. Requires a valid access token. |
offset | integer The index of the first result to be returned. The index is 0-based. |
search | string The keyword(s) to be used to filter results. |
sort | string The property used to sort the results. The default is 'name'. |
sortDescending | boolean Whether result should be sorted in descending order. The default is false. |
Response
{
"items": [
$STATION
],
"next": "/stations?limit=20&offset=20&sort=title&sortDescending=false"
}
Errors
Error type | Description |
---|---|
403 - Forbidden | One or more of the specified parameters require a valid access token, and none was provided. |
POST /stations
Request
POST http://marxoft.co.uk/api/cuteradio/stations
Request body
Name | Description |
---|---|
country | string The country to which the station belongs. Optional. |
description | string The station description. Optional. |
genre | string The genre to which the station belongs. Optional. |
language | string The language to which the station belongs. Optional. |
source | string The station stream URL. Required. |
title | string The station title. Required. |
Response
The API will return a station resource.Errors
Error type | Description |
---|---|
400 - Bad request | Either the 'source' field or the 'title' field was not provided. |
403 - Forbidden | No valid access token was provided. |
PUT /stations/$STATION_ID
Request
PUT http://marxoft.co.uk/api/cuteradio/stations/$STATION_ID
Request body
Name | Description |
---|---|
country | string The country to which the station belongs. Optional. |
description | string The station description. Optional. |
genre | string The genre to which the station belongs. Optional. |
language | string The language to which the station belongs. Optional. |
source | string The station stream URL. Optional. |
title | string The station title. Optional. |
Response
The API will return a station resource.Errors
Error type | Description |
---|---|
400 - Bad request | Either the 'source' field or the 'title' field are empty. |
403 - Forbidden | No valid access token was provided. |
404 - Not found | The station identified by the id could not be found. |