视频分类
创建分类¶
[POST] /api/v1/class
创建新的媒体分类,可以指定分类名称和当前分类所属的上级分类,如果不指定上级分类,则默认创建为根分类。
输入参数¶
参数名称 | 必选 | 类型 | 描述 |
---|---|---|---|
parentId | 否 | String | 当前分类如果是子分类,需要指定父分类的ID |
className | 是 | Binary | 当前创建分类的分类名称 |
返回结果¶
参数名称 | 类型 | 描述 |
---|---|---|
data | String | 新建的分类数据的唯一标识 |
示例¶
以下为
Javascript
语言的代码示例, 示例中Authorization
参数均以字符串"token"
表示
输入示例
var data = JSON.Stringify({
"parentId": "032f27f0-08d0-4fa2-90b4-19ad4bcadf84",
"className": "Garrick96"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "http://vod.test.mediacloud.imgo.tv/api/v1/class");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Authorization", "token");
xhr.send(data);
{
"requestId": "3f409576-7b3d-45ba-a8d7-c5de4f7290e4",
"code": 200,
"msg": "创建成功",
"data": "7f342059-4654-4d92-867a-36093aed17c7"
}
删除分类¶
[DELETE] /api/v1/class
删除指定 id 的分类,可以批量删除,该删除只会删除指定 id 的分类。因此删除操作可能会导致被删的分类的子分类成为孤岛数据。
输入参数¶
参数名称 | 必选 | 类型 | 描述 |
---|---|---|---|
uids | 是 | StringArray | 指定需要删除的分类ID |
返回结果¶
参数名称 | 类型 | 描述 |
---|---|---|
示例¶
以下为
Javascript
语言的代码示例, 示例中Authorization
参数均以字符串"token"
表示
输入示例
var data = JSON.Stringify({
"uids": [
"553f3ca2-233e-4218-ab45-41d847e7ef71"
]
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("DELETE", "http://vod.test.mediacloud.imgo.tv/api/v1/class");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Authorization", "token");
xhr.send(data);
{
"requestId": "43b6e2ab-892b-4fe4-b300-ed507fc559a7",
"code": 200,
"msg": "删除成功",
"data": [
"553f3ca2-233e-4218-ab45-41d847e7ef71"
]
}
查询分类¶
[GET] /api/v1/class/{uid}
查询指定 id 的分类数据
输入参数¶
参数名称 | 必选 | 类型 | 描述 |
---|---|---|---|
uid | 是 | String | 指定需要查询的分类ID |
返回结果¶
参数名称 | 类型 | 描述 |
---|---|---|
示例¶
以下为
Javascript
语言的代码示例, 示例中Authorization
参数均以字符串"token"
表示
输入示例
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "http://vod.test.mediacloud.imgo.tv/api/v1/class/7f342059-4654-4d92-867a-36093aed17c7");
xhr.setRequestHeader("Authorization", "token");
xhr.send();
{
"requestId": "c84d2d3e-bcdc-400e-a2d1-9b748f6d9b1d",
"code": 200,
"msg": "查询成功",
"data": {
"uid": "7f342059-4654-4d92-867a-36093aed17c7",
"parentId": "ff7a939f-4a67-443d-939f-67e97dcfe7cd",
"type": 0,
"className": "girls",
"sort": 0,
"createdAt": "2024-03-08 17:23:58",
"updatedAt": "2024-03-08 17:23:58"
}
}
查询分类树¶
[GET] /api/v1/class/tree
查询分类树,返回嵌套的分类结构树
输入参数¶
参数名称 | 必选 | 类型 | 描述 |
---|---|---|---|
返回结果¶
参数名称 | 类型 | 描述 |
---|---|---|
示例¶
以下为
Javascript
语言的代码示例, 示例中Authorization
参数均以字符串"token"
表示
输入示例
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "http://vod.test.mediacloud.imgo.tv/api/v1/class/tree");
xhr.setRequestHeader("Authorization", "token");
xhr.send();
{
"requestId": "f678789e-9695-4a9e-92ce-ee6347e4ac92",
"code": 200,
"data": [
{
"uid": "96c513bf-19b2-4af6-bdc2-26bc9efe6eec",
"label": "father",
"sort": 0,
"parentId": "",
"children": [
{
"uid": "7f342059-4654-4d92-867a-36093aed17c7",
"label": "boys",
"sort": 0,
"parentId": "96c513bf-19b2-4af6-bdc2-26bc9efe6eec",
"children": []
},
{
"uid": "b9ccd8f5-d495-4a7f-96ef-527dec820d14",
"label": "son",
"sort": 0,
"parentId": "96c513bf-19b2-4af6-bdc2-26bc9efe6eec",
"children": [
{
"uid": "9e08a9ef-9323-4a13-a65e-2876a3a40859",
"label": "grand son",
"sort": 0,
"parentId": "b9ccd8f5-d495-4a7f-96ef-527dec820d14",
"children": []
}
]
}
]
}
]
}
查询分类列表¶
[GET] /api/v1/class
输入参数¶
参数名称 | 必选 | 类型 | 描述 |
---|---|---|---|
parentId | 否 | String | 父分类ID,查询父分类ID的下一级分类数据 |
limit | 否 | Int | 分页查询参数,每页返回的分类数量,最大值为 1000,最小为10,不指定则默认为10 |
page | 否 | Int | 分页查询参数,页码,默认为1 |
返回结果¶
参数名称 | 类型 | 描述 |
---|---|---|
示例¶
以下为
Javascript
语言的代码示例, 示例中Authorization
参数均以字符串"token"
表示
输入示例
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "http://vod.test.mediacloud.imgo.tv/api/v1/class");
xhr.setRequestHeader("Authorization", "token");
xhr.send();
{
"requestId": "c28cb34b-e51d-4785-8f64-7027dad69867",
"code": 200,
"msg": "查询成功",
"data": [
{
"uid": "96c513bf-19b2-4af6-bdc2-26bc9efe6eec",
"parentId": "",
"type": 0,
"className": "father",
"sort": 0,
"createdAt": "2024-03-08 17:23:06",
"updatedAt": "2024-03-08 17:23:06"
},
{
"uid": "b9ccd8f5-d495-4a7f-96ef-527dec820d14",
"parentId": "96c513bf-19b2-4af6-bdc2-26bc9efe6eec",
"type": 0,
"className": "son",
"sort": 0,
"createdAt": "2024-03-08 17:23:16",
"updatedAt": "2024-03-08 17:23:16"
}
]
}
更新分类¶
[PUT] /api/v1/class/{uid}
输入参数¶
参数名称 | 必选 | 类型 | 描述 |
---|---|---|---|
uid | 是 | String | 指定需要更新的分类ID |
parentId | 否 | String | 父级分类id |
className | 否 | String | 当前更新分类名称 |
返回结果¶
参数名称 | 类型 | 描述 |
---|---|---|
示例¶
以下为
Javascript
语言的代码示例, 示例中Authorization
参数均以字符串"token"
表示
输入示例
var data = JSON.Stringify({
"parentId": "96c513bf-19b2-4af6-bdc2-26bc9efe6eec",
"className": "boys"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("PUT", "http://vod.test.mediacloud.imgo.tv/api/v1/class/7f342059-4654-4d92-867a-36093aed17c7");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Authorization", "token");
xhr.send(data);
{
"requestId": "ec51e4d7-58e0-45b8-8c70-e62fd2c5ab53",
"code": 200,
"msg": "更新成功",
"data": "7f342059-4654-4d92-867a-36093aed17c7"
}