I am getting the following error when I make a request to the Google Calendar API.
{"error"=>{"errors"=>[{"domain"=>"global", "reason"=>"required", "message"=>"Missing end time."}], "code"=>400, "message"=>"Missing end time."}}
What is wrong with my formatting? I've tried a ton of different layouts and can't seem to find much information about using HTTParty to make a request to a Google API.
results = HTTParty.post("https://www.googleapis.com/calendar/v3/calendars/primary/events?key=#{Rails.application.secrets.google_api_key}",
:headers => {
"Authorization" => "Bearer #{response["access_token"]}"
},
:query => {
"end": {
"dateTime" => "2015-05-29T09:00:00-08:00",
"timeZone" => "America/Los_Angeles"
},
"start": {
"dateTime" => "2015-05-29T09:00:00-07:00",
"timeZone" => "America/Los_Angeles"
},
"summary": "TEST POST"
}
)
Thanks in advance!
Figured it out. I needed to use a
:body
key and also specify JSON in the header