品牌设置错误youtube api

时间:2013-11-26 12:00:54

标签: youtube youtube-api

我必须使用youtube api更新我频道的精选视频。

当我使用表格

的api资源管理器发送PUT请求时
 PUT https://www.googleapis.com/youtube/v3/channels?part=brandingSettings&key={YOUR_API_KEY}

   {
     "brandingSettings": {
      "channel": {
        "featuredChannelsTitle": "featured channel",
        "featuredChannelsUrls": [
          "http://www.youtube.com/user/channelname"
         ]
        }
     },
     "id": "channelId"
   }

我得到的答复如下

   404 Not Found

   - Show headers -

   {
       "error": {
       "errors": [
       {
         "domain": "youtube.channel",
         "reason": "channelNotFound",
         "message": "Channel branding options not found.",
         "locationType": "parameter",
         "location": "id"
       }
     ],
    "code": 404,
   "message": "Channel branding options not found."
   }
  }

请让我知道我哪里出错。


我提供了错误的频道ID。但现在我正在尝试使用正确的频道ID,我收到了另一条错误消息。

Content-Type:  application/json
Authorization:  Bearer ya29.1.AADtN_X2UP_3BfFvUwAkvLp0d0mk1U-itJNVtWMPEJQU8G7INQ5q-UpI1yNMYniiLQ
X-JavaScript-User-Agent:  Google APIs Explorer

 {
   "id": channelId,
   "brandingSettings": {
      "channel": {
        "featuredChannelsUrls": [
         " http://www.youtube.com/user/USERNAME"
        ],
       "featuredChannelsTitle": "Featured Channels"
      }
   }
 }

响应是400错误请求

 - Show headers -

  {
    "error": {
      "errors": [
         {
            "domain": "youtube.channel",
            "reason": "brandingValidationError",
            "message": "Channel branding validation failed.",
            "locationType": "parameter",
            "location": "brandingSettings"
         }
      ],
     "code": 400,
     "message": "Channel branding validation failed."
   }
  }

如果您可以提供样品申请,那将非常有帮助

1 个答案:

答案 0 :(得分:1)

正如错误信息中所述,它无法找到频道,请确保您提供正确的频道ID。

在API中执行此操作的方法,执行channel->列表请求并使用该响应对象,修改它并将其放回。 (最重要的是确保id在那里并设置。)