|
| 1 | +# Zender Retrieve Stream information |
| 2 | + |
| 3 | +Information about your stream is entered in the Zender Admin. |
| 4 | +Sometimes you want to access this information and use it in your app (for example to list upcoming, past streams) |
| 5 | + |
| 6 | +When you retrieve the streams there are two types: |
| 7 | +- the lobby stream (will be there at all times, when there is no show) |
| 8 | +- non-lobby stream or regular stream/episode |
| 9 | + |
| 10 | +To make these request one needs an admin/API token (used as bearer-token). |
| 11 | + |
| 12 | +As this has admin privileges these requests should be done from backend code; |
| 13 | +And ideally cached, so not every user request results in a new API request. |
| 14 | + |
| 15 | + |
| 16 | +# To retrieve all streams: |
| 17 | +``` |
| 18 | +curl -XGET 'https://api.zender.tv/v1/channels/<channelId>' -H 'authorization: Bearer <bearerToken>' -H 'content-type: application/json' -H 'accept: application/json' | jq '.streams[]' |
| 19 | +
|
| 20 | +{ |
| 21 | + "published": true, <= is the stream public |
| 22 | + "state": "live", <= state of the stream before , live , after |
| 23 | + "lobby": false, <= is the stream a lobby stream (in between streams) this field is optional) |
| 24 | + "airdate": "2018-04-09T19:41:00.000Z", |
| 25 | + "channelId": "3789b16d-8e9d-4071-9209-2dae67be3760", |
| 26 | + "userCount": 2, <= number of users currently on the stream |
| 27 | + "description": "Quizzia ", |
| 28 | + "id": "f5cc622a-4239-40f9-9ee5-0d29374a4a72", <= unique streamId (not available for public if no yet published" |
| 29 | + "title": "Quizzia" |
| 30 | +} |
| 31 | +``` |
| 32 | + |
| 33 | +- To get the next stream information you need to sort by airdate and filter out the lobby stream |
| 34 | +- To get the previous stream information you need to take the last airdate in the past |
| 35 | + |
| 36 | +# To retrieve all upcoming/listed streams: |
| 37 | +The previous API call retrieves all streams. Sometimes you only want to see the upcoming/listed streams. |
| 38 | +A stream is explicitely marked as listed so it is visible to the audience. This can be used to make an overview of upcoming shows. |
| 39 | + |
| 40 | + |
| 41 | +``` |
| 42 | +curl -XGET 'https://api.zender.tv/v1/channels/<channelId>/streams/listed?from=2010-06-25T08:21:55.505Z' -H 'authorization: Bearer <bearerToken>' -H 'content-type: application/json' -H 'accept: application/json' | jq '.streams[]' |
| 43 | +
|
| 44 | +{ |
| 45 | + "published": true, <= is the stream public |
| 46 | + "state": "live", <= state of the stream before , live , after |
| 47 | + "lobby": false, <= is the stream a lobby stream (in between streams) this field is optional) |
| 48 | + "airdate": "2018-04-09T19:41:00.000Z", |
| 49 | + "channelId": "3789b16d-8e9d-4071-9209-2dae67be3760", |
| 50 | + "userCount": 2, <= number of users currently on the stream |
| 51 | + "description": "Quizzia ", |
| 52 | + "id": "f5cc622a-4239-40f9-9ee5-0d29374a4a72", <= unique streamId (not available for public if no yet published" |
| 53 | + "title": "Quizzia" |
| 54 | +} |
| 55 | +``` |
0 commit comments