1
我試圖將一些數據發佈到Google Places api。但是,當我運行代碼(下面)時,我收到一個411長度要求的錯誤。有誰知道如何使用下面的代碼來解決這個問題。謝謝使用Rails將內容長度添加到API發佈請求
require 'rubygems'
require 'httparty'
class Partay
include HTTParty
base_uri 'https://maps.googleapis.com/maps/api/place/add/json?sensor=false&key=API_Key'
end
#add to google API
options = {
:location => {
:lat => '33.71064',
:lng => '-84.479605'
}
}
{
:accuracy => '50',
:name=>"Rays NewShoeTree",
:types=> "shoe_store",
:language=> "en-AU"
}
puts Partay.post('/maps/api/place/add/json?sensor=false&key=API_Key', options)
我是否缺少url中的一些設置,或者我應該在選項中附加長度哈希值? –