Skip to content

Commit 7077ed8

Browse files
committed
retrieve stream information
1 parent 46016d0 commit 7077ed8

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed

QUIZ.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# To retrieve Quiz Information:
2+
3+
## To retrieve the basic quiz information for all quizes a particular stream
4+
Using an qdmin/api bearer token you can retrieve all quiz information
5+
6+
```
7+
curl -XGET 'https://api.zender.tv/v1/channels/<channelId>/streams/<streamId>/quiz' -H 'content-type: application/json' -H 'authorization: Bearer <bearerToken>' -H 'accept: application/json' | jq
8+
[
9+
10+
"id": "df209242-4097-479c-ac83-76a4cb8e288c", <= unique quizId
11+
"streamId": "abe2c3fb-a60a-41ee-b6e3-a649755bdea2",
12+
"createdAt": "2018-04-03T14:28:23.237Z",
13+
"endedAt": "2018-08-28T15:20:03.647Z",
14+
"status": "ended",
15+
"startedAt": "2018-08-28T15:19:43.003Z",
16+
"updatedAt": "2018-08-28T15:20:03.647Z",
17+
"answerTime": 10000,
18+
"hideTime": 15000,
19+
"description": "Test",
20+
"price": 500, <= the amout of prize money
21+
"resultsAt": "2018-08-28T15:19:46.402Z", <= indicates if the results have been triggered
22+
"title": "Test Quiz"
23+
24+
]
25+
```
26+
27+
## Retrieve quizzes that have finished
28+
To filter out the quizzes that have finished , filter on streams that have a `resultsAt`
29+
30+
```
31+
curl -XGET 'https://api.zender.tv/v1/channels/<channelId>/streams/<streamId>/quiz' -H 'content-type: application/json' -H 'authorization: Bearer <bearerToken>' -H 'accept: application/json' | jq '.[] | select(.resultsAt) | .id'
32+
```
33+
34+
## To retrieve detailed results for a specific Quiz:
35+
Now that you can find all the quizzes, you can retreive details such as the results of one quiz:
36+
37+
```
38+
curl -XGET 'https://api.zender.tv/v1/channels/<channelId>/streams/<streamId>/quiz/<quizId>/results' -H 'authorization: Bearer <bearerToken>' -H 'content-type: application/json' -H 'accept: application/json'
39+
40+
{
41+
"winners": [
42+
43+
"id": "309ae678-b9ec-42b0-86fc-d4de304c7dcd",
44+
"name": "Jan Willem",
45+
"avatar": "https://graph.facebook.com/1854345981301940/picture?width=250&type=square"
46+
47+
],
48+
"count": 1 <= number of winners
49+
50+
}
51+
```

STREAM.md

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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

Comments
 (0)