Start (or resume) a session for a client.
POST/session
The entry point to the API. This endpoint serves to create your client id, bind the client to a specific placement, and express if the client will be able to play any music at all.
A session returns a specific placement, which has a unique id and a
list of stations. As new stations are published or their contents are
changed, a new placement with a new id is created with those updated
stations, but the original placement and stations continue to exist and
are still available to clients. If your client is short lived, and you
don't want to deal with stations disappearing or reappearing during a
session, then you should use endpoints (like GET /placement/\{placement_id\}/station) that bind the request to a specific
placement. For station-related calls that don't accept a placement
argument (like POST /station and GET /station), the operation will
be run against the most recently created placement. The returned placement
and list of stations shouldn't be cached for more than 24 hours.
This is the only route that will mint a client for you. When the
request carries no client_id the server creates one and returns it as
session.client_id. Every other route will fail with missingParameter
instead. Store the returned client_id and send it back on subsequent
calls so the same listener is recognised; values longer than 23
characters are silently truncated.
Calling this again for a known client_id simply returns a fresh view
of what that client may play.
When no music is available the call still succeeds with HTTP 200.
The response is { "success": true } with session.available: false
and a human-readable session.message (for example Sorry, there is no streaming music available for your client), and placement,
stations, offline_placement and offline_stations are all absent.
Check session.available, not the HTTP status. offline_placement and
offline_stations are present only for apps configured for offline
listening; the stations in that list carry an expire_date.
Request
Responses
- 200
- 401
- 429
- default
The session was created. Inspect session.available to find out
whether this client may actually play music — an unavailable session
is reported here, not as an error status.
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"The server judged the rate of requests from these credentials to be excessive and is refusing them for a time. The block lasts 30 seconds from the request that tripped it. Requests made during the block are refused and do not extend it.
The threshold is not published, and is not part of this contract. The threshold is also tuned from time to time.
The response carries a Retry-After header giving whole seconds until
the block clears. Wait at least that long. It says when to come back,
not what rate to aim for, and retrying sooner simply meets the block
again.
This exists to stop abuse, and a well-behaved client should not reach it; if yours does, the fix is to reduce your request rate rather than to retry on a timer. If you believe your application needs a rate that trips it, contact Feed.fm rather than working around it.
An error occurred.