我正在为android编写一个httpget请求,查询附近事件的foursquare api.我收到的JSON响应是
{"groups": [
{
"type": "Nearby",
"venues": [
{
"id": 2587838,
"name": "Marriott Druids Glen Hotel Newtownmountkennedy",
"primarycategory": {
"id": 79281,
"fullpathname": "Travel:Resort",
"nodename": "Resort",
"iconurl": "http://foursquare.com/img/categories/travel/resort.png"
},
"address": "Newtownmountkennedy",
"city": "Newtownmountkennedy",
"state": "",
"verified": false,
"geolat": 53.091717,
"geolong": -6.079162,
"stats": {
"herenow": "0"
},
"distance": 5596
},
Run Code Online (Sandbox Code Playgroud)
这些场地可以有很多.我可以使用此代码打印出场地信息
InputStream instream = entity.getContent();
String result= convertStreamToString(instream);
Log.i("Hoosheer0",result);
// A Simple JSONObject Creation
JSONObject json=new JSONObject(result);
JSONArray venues = json.getJSONArray("groups");
//JSONArray docsArray = jObject.getJSONArray("docs");
for (int i = 0; i<venues.length();i++){ …
Run Code Online (Sandbox Code Playgroud) 关于如何在forusquare中使用场地API,我有点不稳定.我的主要问题与OAuth有关.我希望能够在系统的服务器端进行场地搜索,我需要服务器自动登录foursquare.它在网站上说foursquare不需要用户身份验证来使用一些场地功能,但是每当我尝试呼叫:场地/类别而没有指定oath_token我得到一个权限错误.
如何在不使用用户登录的情况下进行场地通话?
提前致谢.
我使用twitter API搜索所有公共推文"4sq.com":
所以我在Foursquare上获得了实际在Twitter上分享的所有登机手续.
{"created_at":"Sun, 08 Jan 2012 20:05:27 +0000","from_user":"fenavergara","from_user_id":50876086,"from_user_id_str":"50876086","from_user_name":"Fernanda Vergara Ch","geo":null,"id":156104246239051776,"id_str":"156104246239051776","iso_language_code":"lt","metadata":{"result_type":"recent"},"profile_image_url":"http://a2.twimg.com/profile_images/1708744785/image_normal.jpg","profile_image_url_https":"https://si0.twimg.com/profile_images/1708744785/image_normal.jpg","source":"<a href="http://foursquare.com" rel="nofollow">foursquare</a>","text":"I'm at Roca Roja (Antofagasta) http://t.co/DIKdYGwD","to_user":null,"to_user_id":null,"to_user_id_str":null,"to_user_name":null},{"created_at":"Sun, 08 Jan 2012 20:05:27 +0000","from_user":"Fabioland76","from_user_id":357326176,"from_user_id_str":"357326176","from_user_name":"Fabio Landini","geo":null,"id":156104246104821760,"id_str":"156104246104821760","iso_language_code":"no","metadata":{"result_type":"recent"},"profile_image_url":"http://a3.twimg.com/profile_images/1506958638/profiloJPG_normal.jpg","profile_image_url_https":"https://si0.twimg.com/profile_images/1506958638/profiloJPG_normal.jpg","source":"<a href="http://foursquare.com" rel="nofollow">foursquare</a>","text":"I'm at Burger King (Gallerie Cantoni, Legnano) http://t.co/rU1jIJ4A","to_user":null,"to_user_id":null,"to_user_id_str":null,"to_user_name":null}
Run Code Online (Sandbox Code Playgroud)
通过这些推文,Foursquare提供了一个链接(如下所示:http: //t.co/DIKdYGwD),我可以在地图上看到办理登机手续的位置(如果我在网页上显示链接).
如何直接从推文列表中以编程方式获取经度和纬度?
想法:我是否需要获取网页上的链接并进行分析以获得经度和纬度?
编辑:我不想使用Twitter地理编码
我正在开展一个非常具有挑战性的项目(至少对我有挑战性和我的谦虚技能),这是基于Buddypress.基本上,我有这个Buddypress安装,我修改,以满足我的需求,这是大多数本地化服务.
我的群组组件现在已进行地理定位,一切看起来都很好.问题是,我希望我的用户能够在他们到达时登记该组,就像在Foursquare上一样.我想知道是否有人可以帮助我.有插件可以做这样的事吗?或者也许是如何制作一个教程?有人可能已经做过这个,或者知道如何让它在Buddypress中运行.
我很感激任何有关这方面的见解,因为我真的不知道在哪里先看.我瞥了一眼foursquare API,但我希望能够使用它的功能而无需通过foursquare来办理登机手续.
非常感谢提前!
如果可以在api查询字符串中传递"order_by"和"sort"参数,那将非常有用.
"order_by"应接受以下选项:distance | 签到| 名称
"sort"应该接受以下选项:asc | 降序
匹配的结果集应该在将结果集缩小到返回的最大"50"结果之前应用order_by和sort参数.
这是在foursquare上的雷达还是不会提供的东西?
我们正在构建一个应用程序,允许用户根据设备的地理位置找到离他们最近的"餐馆".
我们遇到的问题是设置默认半径.我们首先将半径设置为3200米,希望这将为稀疏位置返回一些结果,同时还返回密集位置的最接近结果.
这适用于返回小于50的位置,因为我们可以对post响应进行排序,但是在华盛顿特区这样的密集区域中,当有超过50个结果时,api决定返回的50不是最接近ll的.
因此,我们必须构建我们的查询,如下所示(这很糟糕,因为它需要最多7次点击到api)才能找到不到50个结果的"最佳点".
这是我们在应用中遇到"靠近我"位置的问题.我们在尝试在应用程序中显示"热门"场地时遇到类似问题,但我会将其保存在另一篇文章中.
ob_start();
require_once 'includes/EpiCurl.php';
require_once 'includes/EpiFoursquare.php';
$clientId = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$clientSecret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$fsObjUnAuth = new EpiFoursquare($clientId, $clientSecret);
$time_start2 = microtime(true);
$result = $fsObjUnAuth->get('/venues/search', array(
'categoryId' => '4d4b7105d754a06374d81259',
'limit' => '50',
'radius' => '100',
'intent' => 'checkin',
'll' => $ll,
'v' => '20120211'
));
$result_count1 = count($result->response->venues);
if ($result_count1 < 30) {
$result = $fsObjUnAuth->get('/venues/search', array(
'categoryId' => '4d4b7105d754a06374d81259',
'limit' => '50',
'radius' => '200',
'intent' => …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用以下地址在场地中显示签到列表:
https://api.foursquare.com/v2/venues/VENUE_ID/stats?oauth_token=OAUTH_TOKEN
我已经注册了 Foursquare 应用程序并将我的网站的 URL 指定为重定向 URL。我获得了我的客户凭据并按照https://developer.foursquare.com/overview/auth上的说明创建了我的代码和 access_token。
但是,当我尝试访问这些统计信息时,我的网络浏览器出现错误:
{
"meta":
{
"code":403,
"errorType":"not_authorized",
"errorDetail":"User is not authorized to view venue stats"
},
"response":{}
}
Run Code Online (Sandbox Code Playgroud)
在没有统计信息的情况下查询场地/VENUE_ID 工作正常并返回场地信息,因此我认为错误必须与 OAuth 令牌有关。
我不是我要查询的场地的所有者。
我该如何解决这个问题?我可以向场地所有者索要申请凭证吗?还是我的回调 URL 有问题?或者我应该从服务器运行查询,而不是通过网络浏览器?
最近场地类别的API响应似乎发生了变化:https://developer.foursquare.com/docs/explore#req=venues/categories
"icon"字段现在只返回"prefix"和"suffix",而不是"prefix","sizes"和"name".要获取要加载的类别图标,您必须连接前缀+"bg_32"+后缀,将32替换为您想要的任何大小:32,44,64,88,256.
Google 提供了 google 地方 API ( https://developers.google.com/places/documentation/ ) 来获取本地列表信息。
前网址:http : //www.google.com/maps/place? source = uds&q = Priority+Computer+Solutions,&cid= 13222445107995448542
Bing 是否有提供列表信息的类似机制?我尝试使用 BingMaps REST Locations API
但它仍然缺少一些信息,如电话号码、企业网址等......
甚至 Bing 也使用以下 url 提供了足够的信息:
bing local 是否有提供上述 URL 信息的 API?
基本上我需要任何商业列表地址,包括它的电话号码和 URL。我只想尝试使用 Bing。
谢谢!
Instagram的位置是从foursquare场地列表中选出的,并且我可以在给出foursquare场地ID的情况下搜索Instagram位置,但我有一个Instagram帖子,想找到它对应的foursquare场地 - 这可能吗?
我尝试从一个javascript客户端发送一个POST调用到一个名为addvenue的foursquare API.这是API端点文档链接.
但服务器返回405 - 方法不允许.这是拨打电话的片段
var postdata = {'oauth_token':$scope.access_token_foursquare,
'v':'20141217','name':'randomlisting',
'll':'44.3,37.2','m':'foursquare'};
var req = {
method: 'POST',
url: 'https://api.foursquare.com/v2/venues/add',
headers: {
'content-type': 'application/x-www-form-urlencoded'
},
data: postdata
}
$http(req).then(function(response){
console.log(response);
});
Run Code Online (Sandbox Code Playgroud)
以下是上述呼叫的请求和响应数据包.
Remote Address:103.245.222.185:443
Request URL:https://api.foursquare.com/v2/venues/add
Request Method:OPTIONS
Status Code:405 Method Not Allowed
**Request Headers**
Accept:*/*
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8
Access-Control-Request-Headers:accept, authorization, content-type
Access-Control-Request-Method:POST
Connection:keep-alive
Host:api.foursquare.com
Origin:http://localhost:9000
Referer:http://localhost:9000/foursquare
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36
**Response Headers**
Accept-Ranges:bytes
Access-Control-Allow-Origin:*
Connection:Keep-Alive
Content-Length:90
Content-Type:application/json; charset=utf-8
Date:Wed, 17 Dec …
Run Code Online (Sandbox Code Playgroud) foursquare ×10
api ×3
json ×2
php ×2
android ×1
angularjs ×1
bing-maps ×1
buddypress ×1
checkin ×1
cors ×1
geolocation ×1
google-maps ×1
http-post ×1
instagram ×1
javascript ×1
oauth ×1
twitter ×1
wordpress ×1