Skip to content

Commit

Permalink
Add success and error response codes for each API
Browse files Browse the repository at this point in the history
  • Loading branch information
chiranjeevi committed Jan 10, 2024
1 parent d4170a3 commit 040c877
Show file tree
Hide file tree
Showing 9 changed files with 717 additions and 384 deletions.
135 changes: 79 additions & 56 deletions docs/live-stream-api/list-live-stream-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,60 +11,83 @@ To retrieve a list of live streams in the organization, send an HTTP GET request
https://app.tpstreams.com/api/v1/<organization_id>/assets/live_streams/
```
**Sample webhook response is as follows**
```json
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"title": "Data Science Live Class",
"bytes": null,
"type": "livestream",
"video": null,
"id": "8DH94uXQgrA",
"live_stream": {
"rtmp_url": "rtmp://52.66.213.19/live",
"stream_key": "org-89b2cy-live-8DH94uXQgrA-7XkI",
"status": "Completed",
"hls_url": "https://d3cydmgt9q030i.cloudfront.net/live/89b2cy/8DH94uXQgrA/video.m3u8",
"start": "2023-12-07 13:02:16",
"transcode_recorded_video": true,
"enable_drm_for_recording": true,
"chat_embed_url": null,
"resolutions": [
"240p",
"480p",
"720p"
]
},
"parent": null,
"parent_id": null
},
{
"title": "GO LIVE NOW",
"bytes": null,
"type": "livestream",
"video": null,
"id": "9QgXR3pPj49",
"live_stream": {
"rtmp_url": "",
"stream_key": null,
"status": "Completed",
"hls_url": "https://d3cydmgt9q030i.cloudfront.net/live/89b2cy/9QgXR3pPj49/video.m3u8",
"start": "2023-12-07 12:34:42",
"transcode_recorded_video": true,
"enable_drm_for_recording": true,
"chat_embed_url": null,
"resolutions": [
"240p",
"480p",
"720p"
]
**Response**

**HTTP Status Codes:**

- **200 OK :**
Request successful. Server processed the request.

```json
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"title": "Data Science Live Class",
"bytes": null,
"type": "livestream",
"video": null,
"id": "8DH94uXQgrA",
"live_stream": {
"rtmp_url": "rtmp://52.66.213.19/live",
"stream_key": "org-89b2cy-live-8DH94uXQgrA-7XkI",
"status": "Completed",
"hls_url": "https://d3cydmgt9q030i.cloudfront.net/live/89b2cy/8DH94uXQgrA/video.m3u8",
"start": "2023-12-07 13:02:16",
"transcode_recorded_video": true,
"enable_drm_for_recording": true,
"chat_embed_url": null,
"resolutions": [
"240p",
"480p",
"720p"
]
},
"parent": null,
"parent_id": null
},
"parent": null,
"parent_id": null
}
]
}
```
{
"title": "GO LIVE NOW",
"bytes": null,
"type": "livestream",
"video": null,
"id": "9QgXR3pPj49",
"live_stream": {
"rtmp_url": "",
"stream_key": null,
"status": "Completed",
"hls_url": "https://d3cydmgt9q030i.cloudfront.net/live/89b2cy/9QgXR3pPj49/video.m3u8",
"start": "2023-12-07 12:34:42",
"transcode_recorded_video": true,
"enable_drm_for_recording": true,
"chat_embed_url": null,
"resolutions": [
"240p",
"480p",
"720p"
]
},
"parent": null,
"parent_id": null
}
]
}
```

- **401 Unauthorized :**
Returned when the request lacks valid authentication credentials.

```json
{
"detail": "Invalid token."
}


- **404 Not Found :**
If the wrong organization ID is provided:

```json
The requested resource was not found on this server.
```
86 changes: 59 additions & 27 deletions docs/live-stream-api/live-stream/schedule-a-live-stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,66 @@ https://app.tpstreams.com/api/v1/<organization_id>/assets/live_streams/

```

For valid requests the API server returns a JSON:
### Response
**HTTP Status Codes:**

For valid requests the API server returns a JSON
- **201 Created:**
Indicates successful creation of a new video resource

```json
{
"title": "Data science Live class",
"bytes": null,
"type": "livestream",
"video": null,
"id": "AuC9yX2EtBr",
"live_stream": {
"rtmp_url": "",
"stream_key": null,
"status": "Not Started",
"hls_url": "https://d28qihy7z761lk.cloudfront.net/live/gnarys/AuC9yX2EtBr/video.m3u8",
"start": "2024-10-05 15:30:00",
"transcode_recorded_video": true,
"enable_drm_for_recording": false,
"chat_embed_url": null,
"resolutions": [
"240p",
"480p",
"720p"
]
},
"parent": null,
"parent_id": null
}
```

- **401 Unauthorized :**
Returned when the request lacks valid authentication credentials.

```json
{
"detail": "Invalid token."
}
```
- **404 Not Found :**
If the wrong organization ID is provided

```json
The requested resource was not found on this server.
```
- ** 400 Bad Request :**
Returned when the provided folder UUID is invalid.

```json
{
"parent": [
"Invalid folder UUID"
]
}



```json
{
"title": "Data science Live class",
"bytes": null,
"type": "livestream",
"video": null,
"id": "AuC9yX2EtBr",
"live_stream": {
"rtmp_url": "",
"stream_key": null,
"status": "Not Started",
"hls_url": "https://d28qihy7z761lk.cloudfront.net/live/gnarys/AuC9yX2EtBr/video.m3u8",
"start": "2024-10-05 15:30:00",
"transcode_recorded_video": true,
"enable_drm_for_recording": false,
"chat_embed_url": null,
"resolutions": [
"240p",
"480p",
"720p"
]
},
"parent": null,
"parent_id": null
}
```
Live stream is created with the scheduled time for you to start the server later.

Above response has the details of the live stream scheduled which can also be obtained by API
Expand Down
80 changes: 54 additions & 26 deletions docs/live-stream-api/live-stream/start-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,62 @@ To Start a server for the scheduled live stream you need to send an HTTP POST re
```bash
https://app.tpstreams.com/api/v1/<organization_id>/assets/<str:asset_id>/start_server/
```

**Response**
**HTTP Status Codes:**

For valid requests the API server returns a JSON:
- **200 OK :**
Request successful. Server processed the request.

```json
{
"title": "Data science Live class",
"bytes": null,
"type": "livestream",
"video": null,
"id": "8XGEEj6ptnB",
"live_stream": {
"rtmp_url": "",
"stream_key": null,
"status": "Not Started",
"hls_url": "https://d3cydmgt9q030i.cloudfront.net/live/edee9b/8XGEEj6ptnB/video.m3u8",
"start": "2024-10-05 15:30:00",
"transcode_recorded_video": true,
"enable_drm_for_recording": false,
"chat_embed_url": "https://app.tpstreams.com/live-chat/edee9b/8XGEEj6ptnB/",
"resolutions": [
"240p",
"480p",
"720p"
]
},
"parent": null,
"parent_id": null
}
```

- **404 Not Found :**

If the wrong organization ID is provided:
```json
The requested resource was not found on this server.
```

If the wrong asset ID is provided:

```json
{
"detail": "Not found."
}
- **401 Unauthorized :**
Returned when the request lacks valid authentication credentials.

```json
{
"detail": "Invalid token."
}

```json
{
"title": "Data science Live class",
"bytes": null,
"type": "livestream",
"video": null,
"id": "8XGEEj6ptnB",
"live_stream": {
"rtmp_url": "",
"stream_key": null,
"status": "Not Started",
"hls_url": "https://d3cydmgt9q030i.cloudfront.net/live/edee9b/8XGEEj6ptnB/video.m3u8",
"start": "2024-10-05 15:30:00",
"transcode_recorded_video": true,
"enable_drm_for_recording": false,
"chat_embed_url": "https://app.tpstreams.com/live-chat/edee9b/8XGEEj6ptnB/",
"resolutions": [
"240p",
"480p",
"720p"
]
},
"parent": null,
"parent_id": null
}
```
This will start the server for specified live stream

Above response has the details of the live stream started which can also be obtained by API
Expand Down
Loading

0 comments on commit 040c877

Please sign in to comment.