文件操作

获取文件详情

接口

GET https://cloud.minapp.com/oserve/v1/file/:file_id/

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

代码示例

  1. curl -X GET \
  2. -H "Authorization: Bearer 58f6cd9f84b1b0c04941fbd4d87bc5f14a785107" \
  3. -H "Content-Type: application/json" \
  4. https://cloud.minapp.com/oserve/v1/file/5a1ba9c1fff1d651135e5ff1/
  1. var request = require('request');
  2. var opt = {
  3. uri: 'https://cloud.minapp.com/oserve/v1/file/5a2fe93308443e313a428cxx/', // 5a6ad3cffff1d675b9e2cexx 对应 uri :file_id
  4. method: 'GET',
  5. headers: {
  6. Authorization: `Bearer ${token}`
  7. }
  8. }
  9. request(opt, function(err, res, body) {
  10. console.log(body)
  11. })
  1. <?php
  2. $file_id = '5a2fe93308443e313a428cxx'; // 文件 ID
  3. $url = "https://cloud.minapp.com/oserve/v1/file/{$file_id}/";
  4. $ch = curl_init();
  5. $header = array(
  6. "Authorization: Bearer {$token}",
  7. 'Content-Type: application/json; charset=utf-8'
  8. );
  9. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  10. curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  11. curl_setopt($ch, CURLOPT_URL, $url);
  12. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
  13. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  14. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
  15. $res = curl_exec($ch);
  16. curl_close($ch);

返回示例

  1. {
  2. "categories": [
  3. {
  4. "id": "5a1ba7b708443e7fc5f2fb18",
  5. "name": "Category",
  6. }
  7. ],
  8. "cdn_path": "1eJCS1MFGdvaaBoV.png",
  9. "created_at": 1511762369,
  10. "id": "5a1ba9c1fff1d651135e5ff1",
  11. "media_type": "image",
  12. "mime_type": "image/png",
  13. "name": "box_close.png",
  14. "path": "https://cloud-minapp-287.cloud.ifanrusercontent.com/1eJCS1MFGdvaaBoV.png",
  15. "size": 3652,
  16. "status": "success"
  17. }

获取文件列表

接口

GET https://cloud.minapp.com/oserve/v1/file/

参数说明

Content-Type: application/json

参数类型必填说明
order_byStringY排序(支持 created_at 进行排序)
limitNumberN限制返回资源的个数,默认为 20 条,最大可设置为 1000
offsetNumberN设置返回资源的起始偏移值,默认为 0

代码示例

  1. curl -X GET \
  2. -H "Authorization: Bearer 58f6cd9f84b1b0c04941fbd4d87bc5f14a785107" \
  3. -H "Content-Type: application/json" \
  4. -G \
  5. -d order_by=-created_at \
  6. -d category=5a1ba7b708443e7fc5f2fb18 \
  7. https://cloud.minapp.com/oserve/v1/file/
  1. var request = require('request');
  2. var opt = {
  3. uri: 'https://cloud.minapp.com/oserve/v1/file/',
  4. method: 'GET',
  5. headers: {
  6. Authorization: `Bearer ${token}`
  7. },
  8. qs: { // query string, 被附加到uri的参数
  9. offset: 0, // 可选
  10. limit: 20, // 可选
  11. order_by: 'created_at' // 按照创建时间来排序,可选
  12. }
  13. }
  14. request(opt, function(err, res, body) {
  15. console.log(body)
  16. })
  1. <?php
  2. $url = "https://cloud.minapp.com/oserve/v1/file/";
  3. $ch = curl_init();
  4. $header = array(
  5. "Authorization: Bearer {$token}",
  6. 'Content-Type: application/json; charset=utf-8'
  7. );
  8. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  9. curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  10. curl_setopt($ch, CURLOPT_URL, $url);
  11. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
  12. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  13. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
  14. $res = curl_exec($ch);
  15. curl_close($ch);

删除文件

接口

DELETE https://cloud.minapp.com/oserve/v1/file/:file_id/

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

代码示例

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

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

request(opt, function(err, res, body) {
  console.log(res.statusCode)
})
<?php
$file_id = '5a45f22bfff1d659681c87xx'; // 文件 ID
$url = "https://cloud.minapp.com/oserve/v1/file/{$file_id}/";

$ch = curl_init();
$header = array(
  "Authorization: Bearer {$token}",
  'Content-Type: application/json; charset=utf-8'
);

curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);

$res['response'] = curl_exec($ch); // 反馈结果
$res['status_code'] = curl_getinfo($ch, CURLINFO_HTTP_CODE); // 请求状态码
curl_close($ch);

状态码说明

204 删除成功

批量删除文件

接口

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

代码示例

curl -X DELETE \
-H "Authorization: Bearer 58f6cd9f84b1b0c04941fbd4d87bc5f14a785107" \
-H "Content-Type: application/json" \
https://cloud.minapp.com/oserve/v1/file/?id__in=5a1ba9c1fff1d651135e5ff1,59ca3d275f281f58523fc47a
var request = require('request');

var opt = {
  uri: 'https://cloud.minapp.com/oserve/v1/file/?id__in=5a3b8e8908443e06aa6f0a99,5a3b673308443e643f1b0c47',
  method: 'DELETE',
  headers: {
    Authorization: `Bearer ${token}`
  }
}

request(opt, function(err, res, body) {
  console.log(res.statusCode)
})
<?php
$file_id[] = '5a45f22bfff1d659681cxxxx'; // 文件 ID
$file_id[] = '5a3b673308443e643f1bxxxx'; // 文件 ID
$url = "https://cloud.minapp.com/oserve/v1/file/?id__in=".implode(',',$file_id);

$ch = curl_init();
$header = array(
  "Authorization: Bearer {$token}",
  'Content-Type: application/json; charset=utf-8'
);

curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);

$res['response'] = curl_exec($ch); // 反馈结果
$res['status_code'] = curl_getinfo($ch, CURLINFO_HTTP_CODE); // 请求状态码
curl_close($ch);

状态码说明

204 删除成功

视频截图

接口

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

请求参数说明

参数类型必填说明
sourceStringY视频文件的 id
save_asStringY截图保存的文件名
pointStringY截图时间格式,格式:HH:MM:SS
category_idStringN文件所属类别 ID
random_file_linkBooleanN是否使用随机字符串作为文件的下载地址,不随机可能会覆盖之前的文件,默认为 true
sizeStringN截图尺寸,格式为 宽 x 高,默认是视频尺寸
formatStringN截图格式,可选值为 jpg,png, webp, 默认根据 save_as 的后缀生成

返回参数

参数类型说明
created_atInteger创建时间 (格式为 unix 时间戳)
pathString路径
created_byInteger创建者 id
mime_typeStringmime_type 类型
media_typeString媒体类型
sizeInteger文件大小
nameString文件名
statusString文件状态
referenceObject引用
cdn_pathStringcdn 中保存的路径
updated_atInteger更新时间 (格式为 unix 时间戳)
categoriesString文件所属类别
idString本条记录 ID

代码示例

curl --request POST \
  --url https://cloud.minapp.com/oserve/v1/media/video-snapshot/ \
  --header 'Authorization: Bearer 050c5121242eda175e8d0ee1cbe6950dadc77' \
  --header 'Content-Type: application/json' \
  --data '{\n    "source": "5c4a6db320fa9c2e054c6c36",\n    "save_as": "1-25-test.png",\n    "point": "00:00:50",\n    "category_id": "5a377bb009a8054139faafed"\n}'
var request = require("request");

var options = {
  method: 'POST',
  url: 'https://cloud.minapp.com/oserve/v1/media/video-snapshot/',
  headers:
  {
    'Content-Type': 'application/json',
    Authorization: 'Bearer 2323d124881bd3d63c9bb78458252454f80a676b'
  },
  body:
  {
    source: "5c453c7cfe10833f3178479e",
    save_as: "1-25-test.png",
    point: "00:00:50",
    category_id: "5a377bcb09a8054139faaff1"
  },
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);
  console.log(body);
});
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://cloud.minapp.com/oserve/v1/media/video-snapshot/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"source\": \"5c4a6db320fa9c2e054c6c36\",\n\t\"save_as\": \"1-25-test.png\",\n\t\"point\": \"00:00:50\",\n\t\"category_id\": \"5a377bb009a8054139faafed\"\n}",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer 050c5121242eda175e8d0ee1cbe6950dadc777db",
    "Content-Type: application/json",
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

返回示例

{
  "status": "success",
  "id": "5c4a6dcc20fa9c2e054c6c3b",
  "created_at": 1548381644,
  "updated_at": 1548381644,
  "media_type": "image",
  "mime_type": "image/png",
  "size": 1122460,
  "reference": {},
  "name": "1-25-test.png",
  "path": "https://cloud-minapp-7894.cloud.ifanrusercontent.com/1gmqnUzZx1gNpp78.png",
  "cdn_path": "1gmqnUzZx1gNpp78.png",
  "categories": [
    {
      "id": "5a377bb009a8054139faafed",
      "parent": null,
      "name": "图片"
    }
  ],
  "created_by": 2176
}

状态码说明

200 截图成功

400 参数错误

404 文件不存在

M3U8 视频拼接

接口

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

请求参数说明

参数类型必填说明
m3u8sArrayY视频文件的 id 列表,按提交的顺序进行拼接
save_asStringY截图保存的文件名
category_idStringN文件所属类别 ID
random_file_linkBooleanN是否使用随机字符串作为文件的下载地址,不随机可能会覆盖之前的文件,默认为 true

返回参数

参数类型说明
created_atInteger创建时间 (格式为 unix 时间戳)
pathString路径
created_byInteger创建者 id
mime_typeStringmime_type 类型
media_typeString媒体类型
sizeInteger文件大小
nameString文件名
statusString文件状态
referenceObject引用
cdn_pathStringcdn 中保存的路径
updated_atInteger更新时间 (格式为 unix 时间戳)
categoriesString文件所属类别
idString本条记录 ID

代码示例

curl --request POST \
  --url https://cloud.minapp.com/oserve/v1/media/m3u8-concat/ \
  --header 'Authorization: Bearer 050c5121242eda175e8d0ee1cbe6950dadc777db' \
  --header 'Content-Type: application/json' \
  --data '{\n    "m3u8s": ["5c453c7cfe10833f3178479e", "5c452bebfe10832bf97846c9"],\n    "save_as": "1-25-test.m3u8",\n    "category_id": "5a377bcb09a8054139faaff1"\n}'
var request = require("request");

var options = {
  method: 'POST',
  url: 'https://cloud.minapp.com/oserve/v1/media/m3u8-concat/',
  headers:
  {
    'Content-Type': 'application/json',
    Authorization: 'Bearer 2323d124881bd3d63c9bb78458252454f80a676b'
  },
  body:
  {
    m3u8s: ["5c453c7cfe10833f3178479e", "5c452bebfe10832bf97846c9"],
    save_as: "1-25-test.m3u8",
    category_id: "5a377bcb09a8054139faaff1"
  },
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);
  console.log(body);
});
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://cloud.minapp.com/oserve/v1/media/m3u8-concat/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"m3u8s\": [\"5c453c7cfe10833f3178479e\", \"5c452bebfe10832bf97846c9\"],\n\t\"save_as\": \"1-25-test.m3u8\",\n\t\"category_id\": \"5a377bcb09a8054139faaff1\"\n}",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer 050c5121242eda175e8d0ee1cbe6950dadc777db",
    "Content-Type: application/json",
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

返回示例

{
  "status": "pending",
  "id": "5c4a699820fa9c27f14c6ddd",
  "created_at": 1548380568,
  "updated_at": 1548380568,
  "media_type": "other",
  "mime_type": null,
  "size": 0,
  "reference": {},
  "name": "1-25-test.m3u8",
  "path": "https://cloud-minapp-7894.cloud.ifanrusercontent.com/1gmqW8egmWLqY4Q1.m3u8",
  "cdn_path": "1gmqW8egmWLqY4Q1.m3u8",
  "categories": [
    {
      "id": "5a377bcb09a8054139faaff1",
      "parent": null,
      "name": "视频"
    }
  ],
  "created_by": 2176
}

状态码说明

200 成功

400 参数错误

404 文件不存在

M3U8 视频剪辑

接口

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

请求参数说明

参数类型必填说明
m3u8StringY视频文件的 id
save_asStringY截图保存的文件名
category_idStringN文件所属类别 ID
random_file_linkBooleanN是否使用随机字符串作为文件的下载地址,不随机可能会覆盖之前的文件,默认为 true
includeArrayN包含某段内容的开始结束时间,单位是秒。当 index 为 false 时,为开始结束分片序号
excludeArrayN不包含某段内容的开始结束时间,单位是秒。当 index 为 false 时,为开始结束分片序号
indexBooleanNinclude 或者 exclude 中的值是否为 ts 分片序号,默认为 false

返回参数

参数类型说明
created_atInteger创建时间 (格式为 unix 时间戳)
pathString路径
created_byInteger创建者 id
mime_typeStringmime_type 类型
media_typeString媒体类型
sizeInteger文件大小
nameString文件名
statusString文件状态
referenceObject引用
cdn_pathStringcdn 中保存的路径
updated_atInteger更新时间 (格式为 unix 时间戳)
categoriesString文件所属类别
idString本条记录 ID

代码示例

curl --request POST \
  --url https://cloud.minapp.com/oserve/v1/media/m3u8-clip/ \
  --header 'Authorization: Bearer 050c5121242eda175e8d0ee1cbe6950dadc777db' \
  --header 'Content-Type: application/json' \
  --data '{\n    "m3u8": "5c452bebfe10832bf97846c9",\n    "save_as": "1-25-test.m3u8",\n    "include": [0, 5],\n    "category_id": "5a377bcb09a8054139faaff1"\n}'
var request = require("request");

var options = {
  method: 'POST',
  url: 'https://cloud.minapp.com/oserve/v1/media/m3u8-clip/',
  headers:
  {
    'Content-Type': 'application/json',
    Authorization: 'Bearer 2323d124881bd3d63c9bb78458252454f80a676b'
  },
  body:
  {
    m3u8: "5c3421788318ed7f50e5ea8b",
    save_as: "1-25-test.m3u8",
    include: [0, 5],
    category_id: "5a377bcb09a8054139faaff1"
  },
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);
  console.log(body);
});
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://cloud.minapp.com/oserve/v1/media/m3u8-clip/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"m3u8\": \"5c452bebfe10832bf97846c9\",\n\t\"save_as\": \"1-25-test.m3u8\",\n\t\"include\": [0, 5],\n\t\"category_id\": \"5a377bcb09a8054139faaff1\"\n}",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer 050c5121242eda175e8d0ee1cbe6950dadc777db",
    "Content-Type: application/json",
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

返回示例

{
  "status": "pending",
  "id": "5c4a685520fa9c27f14c6d48",
  "created_at": 1548380245,
  "updated_at": 1548380245,
  "media_type": "other",
  "mime_type": null,
  "size": 0,
  "reference": {},
  "name": "1-25-test.m3u8",
  "path": "https://cloud-minapp-7894.cloud.ifanrusercontent.com/1gmqQuVchCjctKhe.m3u8",
  "cdn_path": "1gmqQuVchCjctKhe.m3u8",
  "categories": [
    {
      "id": "5a377bcb09a8054139faaff1",
      "parent": null,
      "name": "视频"
    }
  ],
  "created_by": 2176
}

状态码说明

200 成功

400 参数错误

404 文件不存在

M3U8 时长和分片信息

接口

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

请求参数说明

参数类型必填说明
m3u8StringY视频文件的 id

返回参数

res:

参数类型说明
status_codeInteger状态码
messageString返回信息
metaObject详见以下

meta 参数说明:

参数类型说明
duartionNumberm3u8 时长
pointsArray时间点

代码示例

curl --request POST \
  --url https://cloud.minapp.com/oserve/v1/media/m3u8-meta/ \
  --header 'Authorization: Bearer 050c5121242eda175e8d0ee1cbe6950dadc777db' \
  --header 'Content-Type: application/json' \
  --data '{\n    "m3u8": "5c452bebfe10832bf97846c9"\n}'
var request = require("request");

var options = {
  method: 'POST',
  url: 'https://cloud.minapp.com/oserve/v1/media/m3u8-meta/',
  headers:
  {
    'Content-Type': 'application/json',
    Authorization: 'Bearer 2323d124881bd3d63c9bb78458252454f80a676b'
  },
  body:
  {
    m3u8: "5c3421788318ed7f50e5ea8b"
  },
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);
  console.log(body);
});
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://cloud.minapp.com/oserve/v1/media/m3u8-meta/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"m3u8\": \"5c452bebfe10832bf97846c9\"\n}",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer 050c5121242eda175e8d0ee1cbe6950dadc777db",
    "Content-Type: application/json",
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

返回示例

{
  "message": "ok",
  "status_code": 200,
  "meta": {
    "duration": 1769.2619999999997,
    "points": [
      20.44,
      40,
      60.92,
      80.68,
      100.16000000000001,
      120.08000000000001,
      1581.5839999999998,
      1600.9429999999998,
      1620.9429999999998,
      1640.9429999999998,
      1660.6629999999998,
      1680.6629999999998,
      1700.6629999999998,
      1720.6629999999998,
      1740.6629999999998,
      1760.6629999999998,
      1769.2619999999997
    ]
  }
}

状态码说明

200 成功

400 参数错误

404 文件不存在

音视频原信息

接口

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

请求参数说明

参数类型必填说明
sourceStringY文件的 id

返回参数

res:

参数类型说明
formatObject音视频格式信息,详见以下
streamsArraystream 列表,详见以下

format 参数说明:

参数类型说明
bitrateInteger比特率
durationNumber时长
formatString容器格式
fullnameString容器格式全称

streams 参数说明:

参数类型说明
indexInteger表示第几路流
typeString一般情况下, video 或 audio
bitrateInteger流码率
codecString流编码
codec_descString流编码说明
durationNumber流时长
video_fpsNumber(视频流)视频帧数
video_heightInteger(视频流)视频高度
video_widthInteger(视频流)视频宽度
audio_channelsInteger(音频流)音频通道数
audio_samplerateInteger(音频流)音频采样率

代码示例

curl --request POST \
  --url https://cloud.minapp.com/oserve/v1/media/audio-video-meta/ \
  --header 'Authorization: Bearer 050c5121242eda175e8d0ee1cbe6950dadc777db' \
  --header 'Content-Type: application/json' \
  --data '{\n    "source": "5c3421788318ed7f50e5ea8b"\n}'
var request = require("request");

var options = {
  method: 'POST',
  url: 'https://cloud.minapp.com/oserve/v1/media/audio-video-meta/',
  headers:
  {
    'Content-Type': 'application/json',
    Authorization: 'Bearer 2323d124881bd3d63c9bb78458252454f80a676b'
  },
  body:
  {
    source: "5c3421788318ed7f50e5ea8b"
  },
  json: true
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);
  console.log(body);
});
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://cloud.minapp.com/oserve/v1/media/audio-video-meta/",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"source\": \"5c3421788318ed7f50e5ea8b\"\n}",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer 050c5121242eda175e8d0ee1cbe6950dadc777db",
    "Content-Type: application/json",
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

返回示例

{
  "format": {
    "format": "mov,mp4,m4a,3gp,3g2,mj2",
    "filesize": 91427419,
    "duration": 43.451667,
    "fullname": "QuickTime / MOV",
    "bitrate": 16832941
  },
  "streams": [
    {
      "index": 0,
      "duration": 43.451667,
      "bitrate": 16762715,
      "video_fps": 24,
      "codec_desc": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
      "metadata": {
        "creation_time": "2016-01-17T02:58:26.000000Z",
        "encoder": "H.264",
        "language": "und",
        "rotate": "90",
        "handler_name": "Core Media Data Handler"
      },
      "video_height": 1080,
      "video_width": 1920,
      "type": "video",
      "codec": "h264"
    },
    {
      "index": 1,
      "duration": 43.451678,
      "bitrate": 62934,
      "codec_desc": "AAC (Advanced Audio Coding)",
      "metadata": {
        "creation_time": "2016-01-17T02:58:26.000000Z",
        "language": "und",
        "handler_name": "Core Media Data Handler"
      },
      "audio_samplerate": 44100,
      "audio_channels": 1,
      "type": "audio",
      "codec": "aac"
    }
  ]
}

状态码说明

200 成功

400 参数错误

404 文件不存在