简体   繁体   English

使用HTTParty将json发布到Google地方信息

[英]Using HTTParty to post json to Google Places

I'm trying to figure out how to write a google places POST request using HTTParty. 我试图弄清楚如何使用HTTParty编写Google Places POST请求。 I was able to do a GET request but can't figure out how to work around the fact that Google Places has a nested parameter to post into. 我能够发出GET请求,但无法弄清楚如何解决Google Places有一个嵌套参数要发布的事实。 Here is the json syntax from the api documentation. 这是api文档中的json语法。 Can someone help me translate this into the syntax that can work with HTTParty.post 有人可以帮我翻译成可以与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"
}

httparty gem包含一个示例该示例将嵌套的JSON发布到服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM