【问题标题】:Batch request for youtube playlist_items.delete always failedyoutube playlist_items.delete 的批量请求总是失败
【发布时间】:2013-02-05 04:34:29
【问题描述】:

我提供了“id”,但总是返回“必填参数:id”的错误

顺便说一句,如果我使用普通请求(即非批处理),那么相同的代码

:api_method => yt.playlist_items.delete,
:parameters => {:id => ids[0]}

将成功而没有错误。但是如果我使用批处理请求,那么它总是失败!

这是我的代码

require 'google/api_client'

client = Google::APIClient.new(:application_name => 'YouBoard', :application_version => '1.0')
yt = client.discovered_api('youtube', 'v3')
client.authorization.access_token = 'Some Access Token'

response = client.execute!(
  :api_method => yt.playlist_items.list,
  :parameters => {
    :playlistId => pid,
  :part => 'id'
}
)

# Get playlist_item's id
ids = response.data.items.collect {|x| x.id}

batch = Google::APIClient::BatchRequest.new() do |result|
  p result.data
end

batch.add(
 :api_method => yt.playlist_items.delete,
 :parameters => {:id => ids[0]}
)

client.execute!(batch)

这里是错误

"error"=>{"errors"=>[{
"domain"=>"global", 
"reason"=>"required", 
"message"=>"Required parameter: id", 
"locationType"=>"parameter", 
"location"=>"id"}], "code"=>400, "message"=>"Required parameter: id"}}

【问题讨论】:

    标签: youtube-api google-api-ruby-client


    【解决方案1】:

    这是由于 Google API Ruby 客户端库中的错误造成的。我已经在图书馆的问题跟踪器中跟进:https://code.google.com/p/google-api-ruby-client/issues/detail?id=79

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-05-31
      • 1970-01-01
      • 2012-08-16
      • 2014-02-23
      • 2021-12-08
      • 2020-12-22
      • 2019-05-20
      • 1970-01-01
      相关资源
      最近更新 更多