Updated API (markdown)

This commit is contained in:
Omar Roth 2018-09-28 10:58:34 -05:00
parent dc85721f49
commit 439f02c4b8
1 changed files with 275 additions and 123 deletions

382
API.md
View File

@ -1,6 +1,8 @@
##### GET `/api/v1/videos/:id` ##### GET `/api/v1/videos/:id`
> Schema: > Schema:
```
```javascript
{ {
"title": String, "title": String,
"videoId": String, "videoId": String,
@ -95,8 +97,75 @@
} }
``` ```
##### GET `/api/v1/trending` ##### GET `/api/v1/comments/:id`
> Schema: > Schema:
```javascript
{
"commentCount": Int32?,
"comments": [
{
"author": String,
"authorThumbnails": [
"url": String,
"width": Int32,
"height": Int32
],
"authorId": String,
"authorUrl": String,
"content": String,
"contentHtml": String,
"published": Int64,
"publishedText": String,
"likeCount": Int32,
"commentId": String,
"replies": {
"replyCount": Int32,
"continuation": String
}?
}
],
"continuation": String?
}
```
Parameters:
```
continuation: String
```
##### GET `/api/v1/captions/:id`
> Schema:
```javascript
{
"captions": [
{
"label": String,
"languageCode": String,
"url": String
}
]
}
```
Parameters:
```
label: String
```
A request with `label` will return the selected captions in WebVTT format.
##### GET `/api/v1/trending`
> Schema:
``` ```
[ [
{ {
@ -126,7 +195,9 @@
``` ```
##### GET `/api/v1/top` ##### GET `/api/v1/top`
> Schema: > Schema:
``` ```
[ [
{ {
@ -156,7 +227,9 @@
``` ```
##### GET `/api/v1/channels/:ucid` ##### GET `/api/v1/channels/:ucid`
> Schema: > Schema:
``` ```
{ {
"author": String, "author": String,
@ -213,176 +286,255 @@
``` ```
##### GET `/api/v1/channels/:ucid/videos`, `/api/v1/channels/videos/:ucid` ##### GET `/api/v1/channels/:ucid/videos`, `/api/v1/channels/videos/:ucid`
> Schema: > Schema:
```
```javascript
[ [
{ {
"title": String, title: String,
"videoId": String, videoId: String,
"author": String, author: String,
"authorId": String, authorId: String,
"authorUrl": String, authorUrl: String,
"videoThumbnails": [ videoThumbnails: [
{ {
"quality": String, quality: String,
"url": String, url: String,
"width": Int32, width: Int32,
"height": Int32 height: Int32
} }
], ],
"description": String, description: String,
"descriptionHtml": String, descriptionHtml: String,
"viewCount": Int64, viewCount: Int64,
"published": Int64, published: Int64,
"publishedText": String, publishedText: String,
"lengthSeconds": Int32 lengthSeconds: Int32
} }
] ];
``` ```
Parameters: Parameters:
``` ```
page: Int32 page: Int32
``` ```
##### GET `/api/v1/search` ##### GET `/api/v1/channels/search/:ucid`
> Schema: > Schema:
```
```javascript
[ [
{ {
"type": "video", type: "video",
"title": String, title: String,
"videoId": String, videoId: String,
"author": String, author: String,
"authorId": String, authorId: String,
"authorUrl": String, authorUrl: String,
"videoThumbnails": [ videoThumbnails: [
{ {
"quality": String, quality: String,
"url": String, url: String,
"width": Int32, width: Int32,
"height": Int32 height: Int32
} }
], ],
"description": String, description: String,
"descriptionHtml": String, descriptionHtml: String,
"viewCount": Int64, viewCount: Int64,
"published": Int64, published: Int64,
"publishedText": String, publishedText: String,
"lengthSeconds": Int32, lengthSeconds: Int32,
"liveNow": Bool liveNow: Bool
}, },
{ {
"type": "playlist", type: "playlist",
"title": String, title: String,
"playlistId": String, playlistId: String,
"author": String, author: String,
"authorId": String, authorId: String,
"authorUrl": String, authorUrl: String,
"videoCount": Int32, videoCount: Int32,
"videos": [ videos: [
"title": String, "title": String,
"videoId": String, "videoId": String,
"lengthSeconds": Int32, "lengthSeconds": Int32,
"videoThumbnails": [ "videoThumbnails": [
{ {
"quality": String, quality: String,
"url": String, url: String,
"width": Int32, width: Int32,
"height": Int32 height: Int32
} }
] ]
] ]
}, },
{ {
"type": "channel", type: "channel",
"author": String, author: String,
"authorId": String, authorId: String,
"authorUrl": String, authorUrl: String,
"authorThumbnails": [ authorThumbnails: [
{ {
"url": String, url: String,
"width": Int32, width: Int32,
"height": Int32 height: Int32
} }
], ],
"subCount": Int32, subCount: Int32,
"videoCount": Int32, videoCount: Int32,
"description": String, description: String,
"descriptionHtml": String, descriptionHtml: String
} }
] ];
``` ```
Parameters Parameters:
``` ```
q: String, q: String
page: Int32, page: Int32
```
##### GET `/api/v1/search`
> Schema:
```javascript
[
{
type: "video",
title: String,
videoId: String,
author: String,
authorId: String,
authorUrl: String,
videoThumbnails: [
{
quality: String,
url: String,
width: Int32,
height: Int32
}
],
description: String,
descriptionHtml: String,
viewCount: Int64,
published: Int64,
publishedText: String,
lengthSeconds: Int32,
liveNow: Bool
},
{
type: "playlist",
title: String,
playlistId: String,
author: String,
authorId: String,
authorUrl: String,
videoCount: Int32,
videos: [
"title": String,
"videoId": String,
"lengthSeconds": Int32,
"videoThumbnails": [
{
quality: String,
url: String,
width: Int32,
height: Int32
}
]
]
},
{
type: "channel",
author: String,
authorId: String,
authorUrl: String,
authorThumbnails: [
{
url: String,
width: Int32,
height: Int32
}
],
subCount: Int32,
videoCount: Int32,
description: String,
descriptionHtml: String
}
];
```
Parameters:
```
q: String
page: Int32
sort_by: "relevance", "rating", "upload_date", "view_count" sort_by: "relevance", "rating", "upload_date", "view_count"
date: "hour", "today", "week", "month", "year" date: "hour", "today", "week", "month", "year"
duration: "short", "long" duration: "short", "long"
type: "video", "playlist", "channel", "all", (default: video) type: "video", "playlist", "channel", "all", (default: video)
``` ```
##### GET `/api/v1/captions/:id` ##### GET `/api/v1/playlists/:plid`
> Schema: > Schema:
```
```javascript
{ {
"captions": [ "title": String,
"playlistId": String,
"author": String,
"authorId": String,
"authorThumbnails": [
{ {
"label": String, "url": String,
"languageCode": String "width": String,
"height": String
} }
],
"description": String,
"descriptionHtml": String,
"videoCount": Int32,
"viewCount": Int64,
"updated": Int64,
"videos": [
"title": String,
"videoId": String,
"author": String,
"authorId": String,
"authorUrl": String,
"videoThumbnails": [
{
"quality": String,
"url": String,
"width": Int32,
"height": Int32
}
],
"index": Int32,
"lengthSeconds": Int32
] ]
} }
``` ```
Parameters
```
label: String
```
A request with `label` will return the selected captions in WebVTT format.
##### GET `/api/v1/comments/:id`
> Schema:
```
{
"commentCount": Int32?,
"comments": [
{
"author": String,
"authorThumbnails": [
"url": String,
"width": Int32,
"height": Int32
],
"authorId": String,
"authorUrl": String,
"content": String,
"contentHtml": String,
"published": Int64,
"publishedText": String,
"likeCount": Int32,
"commentId": String,
"replies": {
"replyCount": Int32,
"continuation": String
}?
}
],
"continuation": String?
}
```
Parameters: Parameters:
``` ```
continuation: String page: Int32
``` ```