如何 post 数据到 mapquest table

How to post data to a mapquest table

我正在尝试 post 将数据发送到 mapquest table 并且我已经根据他们的 API

完成了所有工作

这是我的 json:

{
    "tableName": "mqap.jZ3uoAVablablabla_reported_points",
    "append": true,
    "returnResults": true, 
    "rows": [
        [
            {
                "mqap_geography": "POINT (-123.3141509 48.4647675)",
                "date": "2016-03-13T02:19:09.674Z",
                "email": "anna@gmail.com",
                "latitude": "48.47542496514236",
                "longitude": "-123.37663650512695",
                "message": "ss",
                "user": "a"
            }
        ]
    ]

}

这是 table

的屏幕截图

这是我在 Postman 中得到的回复

{
  "failures": [
    {
      "reason": "Either no latitude/longitude was provided, or the other information was insufficient for geocoding at or near line #0 of input.",
      "row": ""
    }
  ],
  "append": true,
  "returnResults": true,
  "totalRows": 1,
  "tableName": "mqap.jblablabla_reported_points",
  "tableSize": {
    "raw": 8192,
    "readable": "8 KB"
  },
  "data": {
    "rows": []
  },
  "failureCount": 1,
  "rowCount": 0,
  "info": {
    "statusCode": 0,
    "copyright": {
      "text": "© 2015 MapQuest, Inc.",
      "imageUrl": "http://api.mqcdn.com/res/mqlogo.gif",
      "imageAltText": "© 2015 MapQuest, Inc."
    },
    "messages": []
  }
}

我做错了什么?

我遗漏了两件事:

  1. 数据库需要有地理对象。所以我添加了一个我最终没有使用的 latlong Geography 对象。
  2. JSON 的格式应该如下所示:

    {
    "tableName": "mqap.jZ3uoAVablablabla_reported_points",
    "append": true,
    "returnResults": true, 
    "rows": [
           [
           {"name":"user","value":user},
           {"name":"email","value":email},
           {"name":"date","value":date},
           {"name":"message","value":message},
           {"name":"latitude","value":latitude},
           {"name":"longitude","value"longitude},
           {"name":"latlong","value":"POINT(" + parseFloat(longitude) + " " + parseFloat(latitude) +")"}
           ]
        ]
    }
    

创建 table 时,地理列默认应位于 table 中:mqap_geography。此列根据其他列中的信息填充,具体取决于它们的数据类型:地理、[纬度、经度]、[街道、城市、州省、邮政编码、县、国家/地区] 和 FullAddress。上面 table 中的纬度、经度列是字符串类型,因此它们不会填充地理列。