You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Vimeo视频标签上传失败求助:API调用后标签未生效

Vimeo API 添加视频标签失败问题解决

问题根源

你的代码存在两个核心问题:

  1. 参数格式不符合API要求:Vimeo API的PUT /videos/{video_id}/tags端点接受的tags参数是字符串数组(如["tui1", "tui2"]),而非你传入的包含name字段的对象数组。
  2. 请求体配置不规范:需要明确设置Content-Type为application/json,确保服务器能正确解析请求体中的JSON数据。

修正后的代码

const uploadTagsService = async (videoUri, tags) => {
  return new Promise((resolve, reject) => {
    // 将对象数组转换为标签名称字符串数组
    const tagNames = tags.map(tag => tag.name);
    client.request({
      method: 'PUT',
      path: `${videoUri}/tags`,
      headers: {
        'Content-Type': 'application/json'
      },
      body: {
        tags: tagNames
      }
    }, (error, body) => {
      if (error) {
        reject({ status: error.statusCode || 500, message: error.message });
      } else {
        resolve({ status: 200, message: 'Video tags updated successfully', data: body });
      }
    });
  });
};

额外验证点

  • 确保你的API客户端拥有视频编辑权限(权限范围需包含video_edit),没有对应权限会导致标签设置失败但返回成功状态的情况。
  • 如果需要追加标签而非替换所有现有标签,可以改用POST /videos/{video_id}/tags端点,每次传入单个标签的name字段(如{"name": "tui3"})。

内容的提问来源于stack exchange,提问作者Nguyen Quoc Viet

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 00:12:38