文件操作

获取文件详情

接口

GET https://cloud.minapp.com/oserve/v2.2/file/:file_id/

其中 :file_id 需替换为你的文件 ID

代码示例

curl -X GET \
-H "Authorization: Bearer 58f6cd9f84b1b0c04941fbd4d87bc5f14a785107" \
-H "Content-Type: application/json" \
https://cloud.minapp.com/oserve/v2.2/file/5a1ba9c1fff1d651135e5ff1/
var request = require('request');

var opt = {
  uri: 'https://cloud.minapp.com/oserve/v2.2/file/5a2fe93308443e313a428cxx/',  // 5a6ad3cffff1d675b9e2cexx 对应 uri :file_id
  method: 'GET',
  headers: {
    Authorization: `Bearer ${token}`
  }
}

request(opt, function(err, res, body) {
  console.log(body)
})

返回示例

获取文件列表

接口

GET https://cloud.minapp.com/oserve/v2.2/file/

info 该接口支持通过参数 return_total_count 指定是否返回查询对象总数,以协助不关心对象总数只关心查询结果列表的开发者提升接口响应速度。 同时,从 v2.2 版本开始该接口默认不返回查询对象总数,欲获取总数的开发者需要显式指定 return_total_count 参数。

参数说明

Content-Type: application/json

参数
类型
必填
说明

order_by

String

Y

排序(支持 created_at 进行排序)

limit

Number

N

限制返回资源的个数,默认为 20 条,最大可设置为 1000

offset

Number

N

设置返回资源的起始偏移值,默认为 0

return_total_count

Number

N

返回结果 meta 中是否返回 total_count,1 为返回,0 为不返回,默认不返回

若开发者只需要获取对象总数,则可以通过设置 limit=1 以及 return_total_count=1 来达到该效果,total_count 可从返回的 meta 中获取

请求示例:

代码示例

删除文件

接口

DELETE https://cloud.minapp.com/oserve/v2.2/file/:file_id/

其中 :file_id 需替换为你的文件 ID

代码示例

状态码说明

204 删除成功

批量删除文件

接口

DELETE https://cloud.minapp.com/oserve/v2.2/file/?id__in=:file1_id,:file2_id

代码示例

状态码说明

204 删除成功

视频截图

接口

POST https://cloud.minapp.com/oserve/v1/media/video-snapshot/

请求参数说明

| 参数 | 类型 | 必填 | 说明 | | :----- | :-- -- | :-- | :-- | | source | String | Y | 视频文件的 id | | save_as | String | Y | 截图保存的文件名 | | point | String | Y | 截图时间格式,格式:HH:MM:SS | | category_id | String | N | 文件所属类别 ID | | random_file_link | Boolean | N | 是否使用随机字符串作为文件的下载地址,不随机可能会覆盖之前的文件,默认为 true | | size | String | N | 截图尺寸,格式为 宽 x 高,默认是视频尺寸 | | format | String | N | 截图格式,可选值为 jpg,png, webp, 默认根据 save_as 的后缀生成 |

返回参数

参数
类型
说明

created_at

Integer

创建时间 (格式为 unix 时间戳)

path

String

上传成功后的访问地址 URL

created_by

Integer

创建者 id

mime_type

String

mime_type 类型

media_type

String

媒体类型

size

Integer

文件大小

name

String

文件名

status

String

文件状态

reference

Object

引用

cdn_path

String

文件在 CDN 中的相对路径

updated_at

Integer

更新时间 (格式为 unix 时间戳)

categories

String

文件所属类别

id

String

本条记录 ID

代码示例

返回示例

状态码说明

200 截图成功

400 参数错误

404 文件不存在

M3U8 视频拼接

接口

POST https://cloud.minapp.com/oserve/v1/media/m3u8-concat/

请求参数说明

| 参数 | 类型 | 必填 | 说明 | | :----- | :-- -- | :-- | :-- | | m3u8s | Array | Y | 视频文件的 id 列表,按提交的顺序进行拼接 | | save_as | String | Y | 截图保存的文件名 | | category_id | String | N | 文件所属类别 ID | | random_file_link | Boolean | N | 是否使用随机字符串作为文件的下载地址,不随机可能会覆盖之前的文件,默认为 true |

返回参数

参数
类型
说明

created_at

Integer

创建时间 (格式为 unix 时间戳)

path

String

上传成功后的访问地址 URL

created_by

Integer

创建者 id

mime_type

String

mime_type 类型

media_type

String

媒体类型

size

Integer

文件大小

name

String

文件名

status

String

文件状态

reference

Object

引用

cdn_path

String

文件在 CDN 中的相对路径

updated_at

Integer

更新时间 (格式为 unix 时间戳)

categories

String

文件所属类别

id

String

本条记录 ID

代码示例

返回示例

状态码说明

200 成功

400 参数错误

404 文件不存在

M3U8 视频剪辑

接口

POST https://cloud.minapp.com/oserve/v1/media/video-clip/

请求参数说明

| 参数 | 类型 | 必填 | 说明 | | :----- | :-- -- | :-- | :-- | | m3u8 | String | Y | 视频文件的 id | | save_as | String | Y | 截图保存的文件名 | | category_id | String | N | 文件所属类别 ID | | random_file_link | Boolean | N | 是否使用随机字符串作为文件的下载地址,不随机可能会覆盖之前的文件,默认为 true | | include | Array | N | 包含某段内容的开始结束时间,单位是秒。当 index 为 false 时,为开始结束分片序号 | | exclude | Array | N | 不包含某段内容的开始结束时间,单位是秒。当 index 为 false 时,为开始结束分片序号 | | index | Boolean | N | include 或者 exclude 中的值是否为 ts 分片序号,默认为 false |

返回参数

参数
类型
说明

created_at

Integer

创建时间 (格式为 unix 时间戳)

path

String

上传成功后的访问地址 URL

created_by

Integer

创建者 id

mime_type

String

mime_type 类型

media_type

String

媒体类型

size

Integer

文件大小

name

String

文件名

status

String

文件状态

reference

Object

引用

cdn_path

String

文件在 CDN 中的相对路径

updated_at

Integer

更新时间 (格式为 unix 时间戳)

categories

String

文件所属类别

id

String

本条记录 ID

代码示例

返回示例

状态码说明

200 成功

400 参数错误

404 文件不存在

M3U8 时长和分片信息

接口

POST https://cloud.minapp.com/oserve/v1/media/m3u8-meta/

请求参数说明

| 参数 | 类型 | 必填 | 说明 | | :----- | :-- -- | :-- | :-- | | m3u8 | String | Y | 视频文件的 id |

返回参数

res:

参数
类型
说明

status_code

Integer

状态码

message

String

返回信息

meta

Object

详见以下

meta 参数说明:

参数
类型
说明

duartion

Number

m3u8 时长

points

Array

时间点

代码示例

返回示例

状态码说明

200 成功

400 参数错误

404 文件不存在

音视频原信息

接口

POST https://cloud.minapp.com/oserve/v1/media/audio-video-meta/

请求参数说明

| 参数 | 类型 | 必填 | 说明 | | :----- | :-- -- | :-- | :-- | | source | String | Y | 文件的 id |

返回参数

res:

参数
类型
说明

format

Object

音视频格式信息,详见以下

streams

Array

stream 列表,详见以下

format 参数说明:

参数
类型
说明

bitrate

Integer

比特率

duration

Number

时长

format

String

容器格式

fullname

String

容器格式全称

streams 参数说明:

参数
类型
说明

index

Integer

表示第几路流

type

String

一般情况下, video 或 audio

bitrate

Integer

流码率

codec

String

流编码

codec_desc

String

流编码说明

duration

Number

流时长

video_fps

Number

(视频流)视频帧数

video_height

Integer

(视频流)视频高度

video_width

Integer

(视频流)视频宽度

audio_channels

Integer

(音频流)音频通道数

audio_samplerate

Integer

(音频流)音频采样率

代码示例

返回示例

状态码说明

200 成功

400 参数错误

404 文件不存在

Last updated

Was this helpful?