如何使用3taps API

时间:2015-05-05 18:21:12

标签: ruby-on-rails ruby api

使用3 taps API中的信息开发Ruby on Rails应用程序。我想要的信息来自Craigslist。想要提取有关英国待售自行车的信息。

以下为我提供了待售自行车的类别信息

{
            "code": "SBIK",
            "group_code": "SSSS",
            "group_name": "For Sale",
            "name": "Bicycles"
        },

所以在我的浏览器中添加以下内容

http://polling.3taps.com/poll?auth_token=fxxxxxxxxx4a23a1cc86e0d&anchor=2109915749&source=CRAIG&category_group=SSSS&category=SBIK

{
"success": true,
"anchor": 2110058535,
"postings": [
{
"id": 2109916051,
"source": "CRAIG",
"category": "SBIK",
"external_id": "5010763041",
"external_url": "http://wilmington.craigslist.org/bik/5010763041.html",
"heading": "WTB:  Tri-bike...56-58cm",
"timestamp": 1430838700,
"annotations": {
"source_map_yahoo": "http://maps.yahoo.com/#mvt=m&lat=34.157200&lon=-77.914100&zoom=16",
"source_continent": "USA",
"latlong_source": "In Posting",
"source_heading": "WTB:  Tri-bike...56-58cm",
"source_cat": "sss",
"proxy_ip": "104.236.116.193:22225",
"source_state": "North Carolina",
"phone": "5010763041",
"source_account": "5hz2n-5010763041@sale.craigslist.org",
"gzip_data_size": "4170",
"source_loc": "wilmington",
"source_subcat": "bia|bik",
"html_data_size": "12631",
"source_map_google": "https://maps.google.com/maps/preview/@34.157200,-77.914100,16z"
},

但是当我添加国家代码 - 这是GBR我没有得到任何补充 http://polling.3taps.com/poll?auth_token=fa95xxxxxxxx3a1cc86e0d&anchor=2109915749&source=CRAIG&category_group=SSSS&category=SBIK&level-country=GBR

但得到错误{"成功":false,"错误":"轮询不支持级别参数"}

当我进行位置搜索时,它使用metro字段

http://reference.3taps.com/locations?auth_token=favvvvvvvvvv6f4a23a1cc86e0d&level=metro&country=GBR

"locations": [
{
"bounds_max_lat": 57.21864,
"bounds_max_long": -2.06182,
"bounds_min_lat": 57.10158,
"bounds_min_long": -2.22161,
"code": "GBR-ABD",
"full_name": "Aberdeen, United Kingdom",
"short_name": "Aberdeen"
},
{
"bounds_max_lat": null,
"bounds_max_long": null,
"bounds_min_lat": null,
"bounds_min_long": null,
"code": "GBR-BAT",
"full_name": "Bath, United Kingdom",
"short_name": "Bath"
},

但是当我将此添加到我的投票搜索中时,我无法让它返回英国待售自行车的任何值?

http://polling.3taps.com/poll?auth_token=fa9xxxxxxxxxcc86e0d&anchor=2109915749&source=CRAIG&category_group=SSSS&category=SBIK&&level=metro&country=GBR

还使用& location.city = GBR-MAN在曼彻斯特找到自行车返回错误

我得到{"成功":false,"错误":"级别,轮询不支持国家/地区参与"}。

1 个答案:

答案 0 :(得分:1)

与响应一样,3taps的轮询API不支持" location。#{level}"参数还没有。您必须使用3taps的搜索API - 尝试查看timestamp参数以获得与轮询API类似的效果。