【问题标题】:Using HTTParty to post json to Google Places使用 HTTParty 将 json 发布到 Google Places
【发布时间】:2011-09-14 17:33:09
【问题描述】:

我试图弄清楚如何使用 HTTParty 编写一个 google 地方 POST 请求。我能够发出 GET 请求,但不知道如何解决 Google Places 有一个嵌套参数要发布到的事实。这是 api 文档中的 json 语法。有人可以帮我把它翻译成可以与 HTTParty.post 一起使用的语法

POST https://maps.googleapis.com/maps/api/place/add/json?sensor=true_or_false&key=api_key HTTP/1.1
Host: maps.googleapis.com

{
  "location": {
    "lat": -33.8669710,
    "lng": 151.1958750
  },
  "accuracy": 50,
  "name": "Google Shoes!",
  "types": ["shoe_store"],
  "language": "en-AU"
}

【问题讨论】:

    标签: ruby-on-rails json google-maps httparty


    【解决方案1】:

    httparty gem 包括an example,它将嵌套的 JSON 发布到服务器。

    【讨论】:

    • 谢谢。但是现在我收到了 content-length required 错误。关于如何解决这个问题的任何想法?
    猜你喜欢
    • 2011-11-19
    • 1970-01-01
    • 1970-01-01
    • 2019-08-18
    • 1970-01-01
    • 1970-01-01
    • 2019-02-22
    • 1970-01-01
    相关资源
    最近更新 更多