gpt4 book ai didi

java - 使用 Foursquare 进行类别搜索返回错误类别

转载 作者:行者123 更新时间:2023-12-01 11:38:51 25 4
gpt4 key购买 nike

我正在对食物进行类别搜索,但我得到了诸如 Bridges 之类的内容。有人可以验证我是否正确构造了 URL,如果是,请指出我做错了什么?

提前非常感谢您。

URL(屏蔽了客户端 ID 和 secret 等敏感内容): https://api.foursquare.com/v2/venues/search?client_id=PUT_YOUR_CLIENT_ID_HERE&client_secret=PUT_YOUR_CLIENT_SECRET_HERE&v=20140714&ll=40.7,-74&radius=1000&category=4d4b7105d754a06374d81259

我使用的类别 ID 来自 foursquare 的网站。这是“食物”的 ID您可以看到 ID 列表 Right Here

这是我的 json 响应(已编辑大小):

{
"meta": {
"code": 200
},
"response": {
"venues": [
{
"id": "430d0a00f964a5203e271fe3",
"name": "Brooklyn Bridge Park",
"contact": {
"phone": "2128033822",
"formattedPhone": "(212) 803-3822",
"twitter": "nycparks",
"facebook": "104475634308",
"facebookUsername": "BartowPell",
"facebookName": "Bartow-Pell Mansion Museum"
},
"location": {
"address": "Main St",
"crossStreet": "Plymouth St",
"lat": 40.70227697066692,
"lng": -73.9965033531189,
"distance": 389,
"postalCode": "11201",
"cc": "US",
"city": "Brooklyn",
"state": "NY",
"country": "United States",
"formattedAddress": [
"Main St (Plymouth St)",
"Brooklyn, NY 11201",
"United States"
]
},
"categories": [
{
"id": "4bf58dd8d48988d163941735",
"name": "Park",
"pluralName": "Parks",
"shortName": "Park",
"icon": {
"prefix": "https:\/\/ss3.4sqi.net\/img\/categories_v2\/parks_outdoors\/park_",
"suffix": ".png"
},
"primary": true
}
],
"verified": true,
"stats": {
"checkinsCount": 28131,
"usersCount": 17548,
"tipCount": 177
},
"url": "http:\/\/nyc.gov\/parks",
"specials": {
"count": 0,
"items": [

]
},
"hereNow": {
"count": 15,
"summary": "15 people are checked in here",
"groups": [
{
"type": "others",
"name": "Other people here",
"count": 15,
"items": [

]
}
]
},
"referralId": "v-1429381004"
},
{
"id": "4a43bcb7f964a520bba61fe3",
"name": "Brooklyn Bridge",
"contact": {
"twitter": "nyc_dot",
"facebook": "166279802886",
"facebookUsername": "NYCDOT",
"facebookName": "NYC DOT"
},
"location": {
"address": "Brooklyn Bridge",
"lat": 40.705953265881305,
"lng": -73.99656772613525,
"distance": 723,
"postalCode": "10038",
"cc": "US",
"city": "New York",
"state": "NY",
"country": "United States",
"formattedAddress": [
"Brooklyn Bridge",
"New York, NY 10038",
"United States"
]
},
"categories": [
{
"id": "4bf58dd8d48988d1df941735",
"name": "Bridge",
"pluralName": "Bridges",
"shortName": "Bridge",
"icon": {
"prefix": "https:\/\/ss3.4sqi.net\/img\/categories_v2\/parks_outdoors\/bridge_",
"suffix": ".png"
},
"primary": true
}
],
"verified": true,
"stats": {
"checkinsCount": 120787,
"usersCount": 67456,
"tipCount": 534
},
"url": "http:\/\/www.nyc.gov\/dot",
"specials": {
"count": 0,
"items": [

]
},
"hereNow": {
"count": 18,
"summary": "18 people are checked in here",
"groups": [
{
"type": "others",
"name": "Other people here",
"count": 18,
"items": [

]
}
]
},
"storeId": "",
"referralId": "v-1429381004"
},
{
"id": "51eabef6498e10cf3aea7942",
"name": "Brooklyn Bridge Park - Pier 2",
"contact": {

},
"location": {
"address": "Furman St",
"crossStreet": "Brooklyn Bridge Park Greenway",
"lat": 40.69956454780675,
"lng": -73.99835740533105,
"distance": 146,
"cc": "US",
"city": "Brooklyn",
"state": "NY",
"country": "United States",
"formattedAddress": [
"Furman St (Brooklyn Bridge Park Greenway)",
"Brooklyn, NY",
"United States"
]
},
"categories": [
{
"id": "4bf58dd8d48988d163941735",
"name": "Park",
"pluralName": "Parks",
"shortName": "Park",
"icon": {
"prefix": "https:\/\/ss3.4sqi.net\/img\/categories_v2\/parks_outdoors\/park_",
"suffix": ".png"
},
"primary": true
}
],
"verified": false,
"stats": {
"checkinsCount": 1508,
"usersCount": 1161,
"tipCount": 10
},
"specials": {
"count": 0,
"items": [

]
},
"hereNow": {
"count": 0,
"summary": "Nobody here",
"groups": [

]
},
"referralId": "v-1429381004"
},
{
"id": "3fd66200f964a520daf11ee3",
"name": "South Street Seaport",
"contact": {
"phone": "2127327678",
"formattedPhone": "(212) 732-7678",
"twitter": "theseaport"
},
"location": {
"address": "South St",
"crossStreet": "Pier 17",
"lat": 40.70566047104496,
"lng": -74.00287628173828,
"distance": 675,
"postalCode": "10038",
"cc": "US",
"city": "New York",
"state": "NY",
"country": "United States",
"formattedAddress": [
"South St (Pier 17)",
"New York, NY 10038",
"United States"
]
},
"categories": [
{
"id": "4bf58dd8d48988d1e0941735",
"name": "Harbor \/ Marina",
"pluralName": "Harbors \/ Marinas",
"shortName": "Harbor \/ Marina",
"icon": {
"prefix": "https:\/\/ss3.4sqi.net\/img\/categories_v2\/parks_outdoors\/harbor_",
"suffix": ".png"
},
"primary": true
}
],
"verified": true,
"stats": {
"checkinsCount": 45850,
"usersCount": 29726,
"tipCount": 180
},
"url": "http:\/\/www.southstreetseaport.com",
"specials": {
"count": 0,
"items": [

]
},
"events": {
"count": 1,
"summary": "Hornblower",
"items": [
{
"id": "550a2152498e6adfd409dfa4",
"name": "Hornblower",
"categories": [

],
"allDay": true,
"date": 1429345800,
"timeZone": "America\/New_York",
"text": "",
"url": "http:\/\/www.voiceplaces.com\/new-york\/hornblower-4897577-e",
"images": [

],
"provider": {
"name": "Village Voice",
"iconUrl": {
"prefix": "https:\/\/playfoursquare.s3.amazonaws.com\/events\/images\/partners\/villagevoice\/",
"sizes": [
20,
40
],
"name": "\/logo.png"
},
"urlText": "more info"
},
"stats": {
"checkinsCount": 0,
"usersCount": 0
}
}
]
},
"hereNow": {
"count": 5,
"summary": "5 people are checked in here",
"groups": [
{
"type": "others",
"name": "Other people here",
"count": 5,
"items": [

]
}
]
},
"venuePage": {
"id": "59071427"
},
"storeId": "",
"referralId": "v-1429381004"
},
{
"id": "42377700f964a52024201fe3",
"name": "Brooklyn Heights Promenade",
"contact": {

},
"location": {
"address": "Columbia Heights",
"crossStreet": "btwn Remsen & Orange",
"lat": 40.69829137715981,
"lng": -73.99663209915161,
"distance": 342,
"postalCode": "11201",
"cc": "US",
"city": "Brooklyn",
"state": "NY",
"country": "United States",
"formattedAddress": [
"Columbia Heights (btwn Remsen & Orange)",
"Brooklyn, NY 11201",
"United States"
]
},
"categories": [
{
"id": "4bf58dd8d48988d163941735",
"name": "Park",
"pluralName": "Parks",
"shortName": "Park",
"icon": {
"prefix": "https:\/\/ss3.4sqi.net\/img\/categories_v2\/parks_outdoors\/park_",
"suffix": ".png"
},
"primary": true
}
],
"verified": false,
"stats": {
"checkinsCount": 18073,
"usersCount": 8755,
"tipCount": 138
},
"url": "http:\/\/nyharborparks.org\/visit\/brhe.html",
"specials": {
"count": 0,
"items": [

]
},
"hereNow": {
"count": 0,
"summary": "Nobody here",
"groups": [

]
},
"referralId": "v-1429381004"
},
{
"id": "53ff2935498e161412b3e871",
"name": "Brooklyn Bridge Park - Pier 2 Yoga Court",
"contact": {

},
"location": {
"lat": 40.700111,
"lng": -73.999185,
"distance": 69,
"cc": "US",
"city": "Brooklyn",
"state": "NY",
"country": "United States",
"formattedAddress": [
"Brooklyn, NY",
"United States"
]
},
"categories": [
{
"id": "4bf58dd8d48988d102941735",
"name": "Yoga Studio",
"pluralName": "Yoga Studios",
"shortName": "Yoga Studio",
"icon": {
"prefix": "https:\/\/ss3.4sqi.net\/img\/categories_v2\/shops\/gym_yogastudio_",
"suffix": ".png"
},
"primary": true
}
],
"verified": false,
"stats": {
"checkinsCount": 6,
"usersCount": 3,
"tipCount": 0
},
"specials": {
"count": 0,
"items": [

]
},
"hereNow": {
"count": 0,
"summary": "Nobody here",
"groups": [

]
},
"referralId": "v-1429381004"
},
{
"id": "4f2c1bbae4b0ccfb1d99b510",
"name": "kk hair salon",
"contact": {

},
"location": {
"lat": 40.69956588745117,
"lng": -74.00108337402344,
"distance": 103,
"cc": "US",
"state": "New York",
"country": "United States",
"formattedAddress": [
"New York",
"United States"
]
},
"categories": [
{
"id": "4bf58dd8d48988d110951735",
"name": "Salon \/ Barbershop",
"pluralName": "Salons \/ Barbershops",
"shortName": "Salon \/ Barbershop",
"icon": {
"prefix": "https:\/\/ss3.4sqi.net\/img\/categories_v2\/shops\/salon_barber_",
"suffix": ".png"
},
"primary": true
}
],
"verified": false,
"stats": {
"checkinsCount": 1,
"usersCount": 1,
"tipCount": 0
},
"specials": {
"count": 0,
"items": [

]
},
"hereNow": {
"count": 0,
"summary": "Nobody here",
"groups": [

]
},
"referralId": "v-1429381004"
},
{
"id": "540ca09f498e9d0f44e40791",
"name": "Smorgasburg at Brooklyn Bridge Park - Pier 2",
"contact": {
"twitter": "bkflea"
},
"location": {
"address": "Pier 2 (at Brooklyn Bridge Park)",
"lat": 40.69938593942123,
"lng": -73.99699733176632,
"distance": 262,
"cc": "US",
"city": "Brooklyn",
"state": "NY",
"country": "United States",
"formattedAddress": [
"Pier 2 (at Brooklyn Bridge Park)",
"Brooklyn, NY",
"United States"
]
},
"categories": [
{
"id": "53e0feef498e5aac066fd8a9",
"name": "Street Food Gathering",
"pluralName": "Street Food Gatherings",
"shortName": "Street Food Gathering",
"icon": {
"prefix": "https:\/\/ss3.4sqi.net\/img\/categories_v2\/food\/streetfood_",
"suffix": ".png"
},
"primary": true
}
],
"verified": false,
"stats": {
"checkinsCount": 545,
"usersCount": 523,
"tipCount": 6
},
"specials": {
"count": 0,
"items": [

]
},
"hereNow": {
"count": 0,
"summary": "Nobody here",
"groups": [

]
},
"referralId": "v-1429381004"
},
{
"id": "3fd66200f964a520e9e81ee3",
"name": "Grimaldi's Pizzeria",
"contact": {
"phone": "7188584300",
"formattedPhone": "(718) 858-4300",
"twitter": "grimaldisnyc"
},
"location": {
"address": "1 Front St",
"crossStreet": "at Cadman Plaza W",
"lat": 40.70250515261926,
"lng": -73.9933359887217,
"distance": 627,
"postalCode": "11201",
"cc": "US",
"city": "Brooklyn",
"state": "NY",
"country": "United States",
"formattedAddress": [
"1 Front St (at Cadman Plaza W)",
"Brooklyn, NY 11201",
"United States"
]
},
"categories": [
{
"id": "4bf58dd8d48988d1ca941735",
"name": "Pizza Place",
"pluralName": "Pizza Places",
"shortName": "Pizza",
"icon": {
"prefix": "https:\/\/ss3.4sqi.net\/img\/categories_v2\/food\/pizza_",
"suffix": ".png"
},
"primary": true
}
],
"verified": false,
"stats": {
"checkinsCount": 21973,
"usersCount": 18381,
"tipCount": 459
},
"url": "http:\/\/www.grimaldis.com",
"hasMenu": true,
"menu": {
"type": "Menu",
"label": "Menu",
"anchor": "View Menu",
"url": "https:\/\/foursquare.com\/v\/grimaldis-pizzeria\/3fd66200f964a520e9e81ee3\/menu",
"mobileUrl": "https:\/\/foursquare.com\/v\/3fd66200f964a520e9e81ee3\/device_menu"
},
"specials": {
"count": 0,
"items": [

]
},
"hereNow": {
"count": 0,
"summary": "Nobody here",
"groups": [

]
},
"referralId": "v-1429381004"
},
{
"id": "4c34a57da0ced13a9379186e",
"name": "Under The Brooklyn Bridge",
"contact": {
"twitter": "nyc_dot",
"facebook": "166279802886",
"facebookUsername": "NYCDOT",
"facebookName": "NYC DOT"
},
"location": {
"address": "Brooklyn Bridge",
"crossStreet": "FDR Dr",
"lat": 40.703475724581324,
"lng": -73.99405334200495,
"distance": 633,
"postalCode": "11201",
"cc": "US",
"city": "Brooklyn",
"state": "NY",
"country": "United States",
"formattedAddress": [
"Brooklyn Bridge (FDR Dr)",
"Brooklyn, NY 11201",
"United States"
]
},
"categories": [
{
"id": "4bf58dd8d48988d165941735",
"name": "Scenic Lookout",
"pluralName": "Scenic Lookouts",
"shortName": "Scenic Lookout",
"icon": {
"prefix": "https:\/\/ss3.4sqi.net\/img\/categories_v2\/parks_outdoors\/sceniclookout_",
"suffix": ".png"
},
"primary": true
}
],
"verified": true,
"stats": {
"checkinsCount": 7406,
"usersCount": 5831,
"tipCount": 31
},
"url": "http:\/\/www.nyc.gov\/dot",
"specials": {
"count": 0,
"items": [

]
},
"hereNow": {
"count": 0,
"summary": "Nobody here",
"groups": [

]
},
"referralId": "v-1429381004"
},
{
"id": "4cb92bdc7148f04d9336d5ab",
"name": "Livys apartment !",
"contact": {

},
"location": {
"address": "95 Wall St",
"crossStreet": "Water st",
"lat": 40.700249,
"lng": -74.001442,
"distance": 124,
"postalCode": "10005",
"cc": "US",
"city": "New York",
"state": "NY",
"country": "United States",
"formattedAddress": [
"95 Wall St (Water st)",
"New York, NY 10005",
"United States"
]
},
"categories": [
{
"id": "4bf58dd8d48988d1a3941735",
"name": "College Residence Hall",
"pluralName": "College Residence Halls",
"shortName": "Residence Hall",
"icon": {
"prefix": "https:\/\/ss3.4sqi.net\/img\/categories_v2\/education\/residencehall_",
"suffix": ".png"
},
"primary": true
}
],
"verified": false,
"stats": {
"checkinsCount": 1,
"usersCount": 1,
"tipCount": 0
},
"specials": {
"count": 0,
"items": [

]
},
"hereNow": {
"count": 0,
"summary": "Nobody here",
"groups": [

]
},
"referralId": "v-1429381004"
},
{
"id": "4c5435bf4623be9a62ee66f2",
"name": "Brooklyn Bridge Park - Pier 4",
"contact": {

},
"location": {
"address": "214 Furman St",
"crossStreet": "Montague St",
"lat": 40.69662731765942,
"lng": -73.99846644034649,
"distance": 397,
"postalCode": "11201",
"cc": "US",
"city": "Brooklyn",
"state": "NY",
"country": "United States",
"formattedAddress": [
"214 Furman St (Montague St)",
"Brooklyn, NY 11201",
"United States"
]
},
"categories": [
{
"id": "4bf58dd8d48988d163941735",
"name": "Park",
"pluralName": "Parks",
"shortName": "Park",
"icon": {
"prefix": "https:\/\/ss3.4sqi.net\/img\/categories_v2\/parks_outdoors\/park_",
"suffix": ".png"
},
"primary": true
}
],
"verified": false,
"stats": {
"checkinsCount": 1196,
"usersCount": 945,
"tipCount": 3
},
"url": "http:\/\/www.brooklynbridgepark.org\/the-park\/future-park\/pier-4",
"specials": {
"count": 0,
"items": [

]
},
"hereNow": {
"count": 0,
"summary": "Nobody here",
"groups": [

]
},
"referralId": "v-1429381004"
},
{
"id": "5054eb43e4b04ed4f0dd1b30",
"name": "La cabana",
"contact": {

},
"location": {
"lat": 40.69875,
"lng": -73.99953,
"distance": 144,
"cc": "US",
"state": "New York",
"country": "United States",
"formattedAddress": [
"New York",
"United States"
]
},
"categories": [
{
"id": "4bf58dd8d48988d154941735",
"name": "Cuban Restaurant",
"pluralName": "Cuban Restaurants",
"shortName": "Cuban",
"icon": {
"prefix": "https:\/\/ss3.4sqi.net\/img\/categories_v2\/food\/cuban_",
"suffix": ".png"
},
"primary": true
}
],
"verified": false,
"stats": {
"checkinsCount": 4,
"usersCount": 4,
"tipCount": 1
},
"specials": {
"count": 0,
"items": [

]
},
"hereNow": {
"count": 0,
"summary": "Nobody here",
"groups": [

]
},
"referralId": "v-1429381004"
},
{
"id": "4ae62580f964a52011a521e3",
"name": "Danish Seamen's Church",
"contact": {

},
"location": {
"address": "102 Willow St",
"lat": 40.698023159650134,
"lng": -73.99568889745463,
"distance": 425,
"postalCode": "11201",
"cc": "US",
"city": "Brooklyn",
"state": "NY",
"country": "United States",
"formattedAddress": [
"102 Willow St",
"Brooklyn, NY 11201",
"United States"
]
},
"categories": [
{
"id": "4bf58dd8d48988d132941735",
"name": "Church",
"pluralName": "Churches",
"shortName": "Church",
"icon": {
"prefix": "https:\/\/ss3.4sqi.net\/img\/categories_v2\/building\/religious_church_",
"suffix": ".png"
},
"primary": true
}
],
"verified": false,
"stats": {
"checkinsCount": 106,
"usersCount": 71,
"tipCount": 0
},
"specials": {
"count": 0,
"items": [

]
},
"hereNow": {
"count": 0,
"summary": "Nobody here",
"groups": [

]
},
"referralId": "v-1429381004"
}
],
"confident": true
}
}

最佳答案

请查看foursquare venues search参数正确,您使用了“category”参数,但正确的参数是“categoryId”(不是categoryid)。所以你应该将你的网址更改为:

https://api.foursquare.com/v2/venues/search?client_id=PUT_YOUR_CLIENT_ID_HERE&client_secret=PUT_YOUR_CLIENT_SECRET_HERE&v=20140714&ll=40.7,-74&radius=1000&categoryId=4d4b7105d754a06374d81259

关于java - 使用 Foursquare 进行类别搜索返回错误类别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29721177/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com