Reserve a play for playback.
POST/play
Reserves the next song for this client and returns the play, including
the audio file and the URL to stream it from. The play is not yet
playing: call POST /play/{play_id}/start when audio actually begins
playback. Repeated calls to this endpoint with the same parameters and
no intervening POST /play/{play_id}/start or POST /play/\{play_id\}/invalidate call will return the same song (but
with a newly signed URL pointing to its audio).
The play object returned from this call is valid until a POST /play/\{play_id\}/start call is made against any other play. That is, if
you make multiple POST /play calls with different station_id values,
only one of the returned play ids may be sent to a POST /play/\{play_id\}/start and the rest should be discarded.
noMoreMusic is not an error status. When no song can be selected —
the station is exhausted for this client, or audio_file_id names a
song that cannot be played — the server answers HTTP 200 with a body
of { "success": false, "error": { "code": 9, ... } }. Always inspect
success; do not treat 200 as proof a play was reserved. Each
noMoreMusic is also counted against the client and feeds the throttle
described under 429.
Licensing and option behaviour:
audio_file_idrequests one specific song. It is only honoured on on-demand or replay stations (or whenpreviewis set); anywhere else the request fails withnotOnDemandOrReplay(code 23, HTTP 403).atqueues the song that would be playing at that offset into the station. It is honoured only when the station issingle_play/first_play, or is on-demand or replay and unshuffled. On any other station typeatis silently ignored — no error, no warning in the response — so that the caller gets the wrong-but-playable music instead of no music.crossfadeis only read alongsideat.preview: trueselects the preview transcode of the song and forcesaudio_file.duration_in_secondsto30, regardless of the real length.formatsis a comma-separated codec list (defaultmp3) andmax_bitratecaps the transcode chosen.
Request
Responses
- 200
- 400
- 401
- 403
- 404
- 429
- default
Either a reserved play, or one of the two failures that have no HTTP
status of their own and so arrive here with success: false:
noMoreMusic(code 9) — no song could be selected for this client and station.formatUnavailable(code 24) — a song was selected but no transcode of it matched the requestedformatsandmax_bitrate.
Both are detectable only by inspecting success.
missingParameter (code 16) — no client_id was supplied.
Credentials were missing or invalid. The response carries
WWW-Authenticate: Basic realm="Feed.fm".
Response Headers
The authentication challenge. Always Basic realm="Feed.fm".
Basic realm="Feed.fm"notOnDemandOrReplay (code 23) — audio_file_id was sent for a
station that is neither on-demand nor replay.
forbidden (code 6) — the station only carries sample rights, so
full songs may not be streamed from it.
missingObject (code 17) — the requested placement, station or
audio file does not exist, or is not visible to these credentials.
throttled (code 22) — this client received 10 or more
noMoreMusic answers within 60 seconds, so the request is refused
until 5 minutes after the first of them. Back off on your own timer
rather than retrying.
An error occurred.