Skip to content

资源库

API 主地址:https://cn-api-v2.acrcloud.cn/api

请求时在 hearder 中必须携带 Authorization Bearer Token。

如果你不知道 Authorization Bearer Token 是什么, 请查看 AccessToken 部分。

提示

请注意 Authorization 的值必须以「Bearer 」开头且与获取到的 access token 中有一个空格

下面是一个例子:

python

headers = {'Authorization': Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.qzoqZ8EOWghqmiaYp_Bf4olGiclMMFL9UQJrx57zJNz8pAP1xsPQhVYdBYsJoP37o9ojT0MquvC1bm98xtTgZK_lkNwI9ukVTaSOyG191ifVrqxN4JJgKdaiPePIJJkoz1xwcQjPwmwdO2OHtVoAp3VZVQgNW9XK1ZCO_BFOM_y2wYnJE2SBGX8FxucSo5ttmzV4WVC86UkN4TA8SE_PNxI8shsi3ySV0KsVYWsCN16zkLXbOIUExmNot4HQKgMucgjrNkeZ5afNMCi9r51CRa9rvoWhQs8G4ZAYT7IwhRgGAuDxQyZKjRlCrpz3MHh6sTNi16ibTfA1pLW6lqkalsLhaULPqShrkreQCO6OSurhVXKLOvjKLOzySjUdFNVJBy9JgqDggvgYrIxLluK5zaiLM9wXuF07Dp25-T1hKXjBY0xBJu6ZwDl5NbFmLqB5owwDpG8MwYFeNqFXcspdwDlAR5qyG3DgvmaUerry1-f8QQLzNOYFgODSNxZRGy6QpwMx4NkGk2ypzm7rgXcuDKcYZ_1fc8nnia97uD9D-k1p5RJJC4Zs-NWlDU3L9Q0jTSJhyfVr9GIMsUSXk00rIoPtwz5i7pARMdD-hwIt3dkAOZSW-b3e_U_Fpw}

资源库 API 列表

URL方法说明
/bucketsPOST新建资源库
/bucketsGET获取资源库列表
/buckets/:idGET获取指定资源库信息
/buckets/:idPUT更新指定资源库信息
/buckets/:idDELETE删除指定资源库

创建资源库

创建一个空存储桶,然后可以上传音频文件或向该存储桶添加节目频道以创建指纹数据库。

API 地址:https://cn-api-v2.acrcloud.cn/api/buckets

请求方法: POST

参数:

参数名类型描述
namestring资源库名称
regionstring区名,cn-north-1(中国大陆目前只有一个区所以直接写cn-north-1即可)
typestring资源库类型,单选,File|Live|LiveRec|LiveTimeshift
net_typeint网络类型,单选,1|2|0,1是在线识别库 2是离线库 0是两个都支持
labelsarray标签, 数组, 内容为任意值, 比如 [Music,'Video','Others']
metadata_templatestring元数据模板。比如 {"album":{"type":"text", "default":"one"}, "artist":{"type":"select", "options":["one", "two"], "default":"one"}}

返回值:

Response
json
{
    "data": {
        "id": 8881,
        "uid": 1,
        "name": "bucket_music",
        "type": "File",
        "node": "127.0.0.1-871",
        "state": 1,
        "region": "ap-southeast-1",
        "metadata_template": "{\"artist\":{\"default\":\"abc\"}, \"album\":{\n\"type\":\"select\", \"default\":\"334\", \"options\":[\"123\", \"334\"]}}",
        "labels": [
            "Music",
            "Video"
        ],
        "net_type": 1,
        "created_at": "2019-03-01 15:31:25",
        "updated_at": "2019-08-16 07:17:32",
        "num": 10,
        "size": "300000",
        "access_permission": "private"
    }
}

获取资源库列表

列出当前账号下拥有的资源库

API 地址:https://cn-api-v2.acrcloud.cn/api/buckets

请求方法: GET

参数:

参数名类型描述
searchstring搜索关键词
sortstring排序键,按 id 或状态排序,默认是按 id 排序
orderstring顺序,asc|desc, 默认 asc
pageint翻页的页数
per_pageint每页的个数

返回值:

Response
json
{
    "data": [
        {
            "id": 14791,
            "uid": 19,
            "name": "test",
            "type": "Live",
            "state": 1,
            "region": "eu-west-1",
            "metadata_template": null,
            "labels": [
                "TV"
            ],
            "net_type": 1,
            "created_at": "2020-07-16 11:09:20",
            "updated_at": "2020-07-16 11:09:20",
            "num": 0,
            "size": 0,
            "access_permission": "private"
        },
        {
            "id": 14556,
            "uid": 19,
            "name": "adsfasdf",
            "type": "LiveTimeshift",
            "state": 1,
            "region": "eu-west-1",
            "metadata_template": "",
            "labels": [
                ""
            ],
            "net_type": 1,
            "created_at": "2020-06-24 11:07:00",
            "updated_at": "2020-06-24 11:07:00",
            "num": 0,
            "size": 0,
            "access_permission": "private"
        },
        {
            "id": 12310,
            "uid": 19,
            "name": "eu_shared_bucket2",
            "type": "LiveRec",
            "state": 1,
            "region": "eu-west-1",
            "metadata_template": "",
            "labels": [
                "Radio"
            ],
            "net_type": 1,
            "created_at": "2019-10-30 07:54:56",
            "updated_at": "2019-10-30 07:54:56",
            "num": 0,
            "size": 0,
            "access_permission": "private"
        },
        {
            "id": 12309,
            "uid": 19,
            "name": "eu_shared_bucket",
            "type": "LiveRec",
            "node": "",
            "state": 1,
            "region": "eu-west-1",
            "metadata_template": "",
            "labels": [
                "Radio"
            ],
            "net_type": 1,
            "created_at": "2019-10-30 07:53:58",
            "updated_at": "2019-10-30 07:53:58",
            "num": 0,
            "size": 0,
            "access_permission": "private"
        },
        {
            "id": 1159,
            "uid": 19,
            "name": "us_bucket",
            "type": "File",
            "state": 1,
            "region": "global",
            "metadata_template": "",
            "labels": [
                "Music"
            ],
            "net_type": 0,
            "created_at": "2016-05-11 06:49:55",
            "updated_at": "2017-07-17 11:48:06",
            "num": 7,
            "size": "1487",
            "access_permission": "private"
        },
        {
            "id": 1116,
            "uid": 19,
            "name": "offline-bucket",
            "type": "File",
            "node": "10.12.12.236-850",
            "state": 1,
            "region": "eu-west-1",
            "metadata_template": "",
            "labels": [
                "Music"
            ],
            "net_type": 2,
            "created_at": "2016-05-01 07:10:16",
            "updated_at": "2018-01-05 16:41:15",
            "num": 0,
            "size": 0,
            "access_permission": "private"
        }
    ],
    "links": {
        "first": "https://cn-api-v2.acrcloud.cn/api/buckets?page=1",
        "last": "https://cn-api-v2.acrcloud.cn/api/buckets?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://cn-api-v2.acrcloud.cn/api/buckets",
        "per_page": 20,
        "to": 6,
        "total": 6
    }
}

获取指定资源库信息

获取指定资源库信息

API 地址:https://cn-api-v2.acrcloud.cn/api/buckets/:id

请求方法: GET

路径:

  • 「:id」替换成你的资源库的id

返回值:

Response
json
{
    "data": {
        "id": 8881,
        "uid": 1,
        "name": "bucket_music",
        "type": "File",
        "node": "127.0.0.1-871",
        "state": 1,
        "region": "ap-southeast-1",
        "metadata_template": "{\"artist\":{\"default\":\"abc\"}, \"album\":{\n\"type\":\"select\", \"default\":\"334\", \"options\":[\"123\", \"334\"]}}",
        "labels": [
            "Music",
            "Video"
        ],
        "net_type": 1,
        "created_at": "2019-03-01 15:31:25",
        "updated_at": "2019-08-16 07:17:32",
        "num": 10,
        "size": "300000",
        "access_permission": "private"
    }
}

更新指定资源库信息

API 地址:https://cn-api-v2.acrcloud.cn/api/buckets/:id

请求方法: PUT

路径:

  • 「:id」替换成你的资源库的id

参数:

参数名类型描述
metadata_templatestring元数据模板。比如 {"album":{"type":"text", "default":"one"}, "artist":{"type":"select", "options":["one", "two"], "default":"one"}}
labelsarray标签, 多选, Music|Video|Advertisement|Others
namestring资源库名称

返回值:

Response
json
{
    "data": {
        "id": 8881,
        "uid": 1,
        "name": "bucket_music",
        "type": "File",
        "node": "127.0.0.1-871",
        "state": 1,
        "region": "ap-southeast-1",
        "metadata_template": "{\"artist\":{\"default\":\"abc\"}, \"album\":{\n\"type\":\"select\", \"default\":\"334\", \"options\":[\"123\", \"334\"]}}",
        "labels": [
            "Music",
            "Video"
        ],
        "net_type": 1,
        "created_at": "2019-03-01 15:31:25",
        "updated_at": "2019-08-16 07:17:32",
        "num": 10,
        "size": "300000",
        "access_permission": "private"
    }
}

删除指定资源库

API 地址:https://cn-api-v2.acrcloud.cn/api/buckets/:id

请求方法: DELETE

路径:

  • 「:id」替换成你的资源库的id