1

I'm trying to post some data to the Google Places api. However when I run the code (below) I receive a 411 Length Required error. Does anyone know how to resolve this using the code below. Thanks

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)
Ray A.
  • 161
  • 1
  • 1
  • 9

1 Answers1

0

You need to specify a body in the post. Even just nil or an empty hash, then HTTParty will include the Content-Length header.

rdmcfee
  • 540
  • 6
  • 13