我提供了"id",但它总是返回错误"Required parameter:id"
BTW,如果我使用正常请求(即非批量),那么相同的代码
: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"}}
这是由于Google API Ruby客户端库中的一个错误引起的。我在图书馆的问题跟踪器中进行了跟踪:https://code.google.com/p/google-api-ruby-client/issues/detail?id=79