How to only get places having phone numbers via Foursquare api? - ios

i am trying to implement forsquare api in my project to get nearby places, but i want the places with phone numbers only.
The following url is created when searching for some places:
https://api.foursquare.com/v2/venues/search?client_id=NUAAA4QFSP...MEW5QYULV&client_secret=FIGD...X0LQBAB&v=20131109&locale=en&categoryId=4d4b7105d754a06374d81259,4d4b7105d754a06376d81259&ll=33.85982057734948,35.55264679015678&radius=2000
The problem is the result will contains all the places corresponding to the categories I checked and within the radius 2000.
I tried to add "query", but this will only search in the result name
So how to get only the places with phone numbers?
Thank you

Related

How can I get Only Health related Data from Google API?

I want to get only results that are related to health and for that I used below api.
https://maps.googleapis.com/maps/api/place/search/json?location=23.0225,72.5714&radius=500&types=hospital&sensor=false&key="API_KEY"
Above API gives me the results related to Health but I don't want to pass location lat long Parameter.
Actually I want to search it with "input" Param like below.
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Ahmedabad&types=hospital&radius=500&key="API_KEY"
But above give me error like below
{
"predictions" : [],
"status" : "INVALID_REQUEST"
}
How can I get this type of results?
Thanks in Advance.
The places autocomplete request from your question has several issues.
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Ahmedabad&types=hospital&radius=500&key=API_KEY
If you remove the location parameter, you should remove the radius parameter as well. It doesn't make sense without location.
hospital is not allowed value in types filter of autocomplete. If you check the documentation, you will see that the only possible values are:
geocode
address
establishment
(regions)
(cities)
Place autocomplete might return only 5 suggestions. I think you are looking for something different.
Also, be aware that radar search mentioned in the comments is now deprecated and will stop working in June 2018.
https://maps-apis.googleblog.com/2017/06/announcing-deprecation-of-place-add.html
I would suggest having a look at Places API text search. Your query with Places API text search might be
https://maps.googleapis.com/maps/api/place/textsearch/json?query=Ahmedabad&type=hospital&key=YOUR_API_KEY
The text search can return up to 60 results divided into pages of 20 results. For your particular example, I got the following output
Hope this helps!

Find Country Code from Phone Number

In my app , I am using phone numbers like +17896786788,+322657579849.
I would like to retrieve only the country code i.e, +1 or +322 by passing any phone number, that is I will send phone number and it will return the country code of that number.
Is there any API or anything available to get the country code from the phone number?
How can I find that?
I dont know about an API for splitting country code from a phone number,
But you can use this link to get all countries and their corresponding codes. Its a json file. You first parse all codes to an array from this json and then compare each element wth your phone number by using "range" funtion along with + symbol
Try it. U will get it.

Get random address/coordinates in a specified town

Is there any way to give Google Maps API or a similar API a town name and have it return a random address inside the town? I was hoping to be able to get the data as a JSON so I could parse it with SwiftyJSON in XCode and use it, but I can't seem to find any way to get the address in the first place. If coordinates would be easier to get, then those would work too, as long as its random and inside the town borders.
You can try to use Google Places API Web Service. It allows you to query for place information on a variety of categories, such as: establishments, prominent points of interest, geographic locations, and more. You can search for places either by proximity or a text string. A Place Search returns a list of places along with summary information about each place.
A Nearby Search lets you search for places within a specified area. You can refine your search request by supplying keywords or specifying the type of place you are searching for.
A Nearby Search request is an HTTP URL of the following form:
https://maps.googleapis.com/maps/api/place/nearbysearch/output?parameters
where output may be either xml or JSON values.
And if you want either address or coordinates, you can use Geocoding for it. Here i found a tutorial on how to use Geocoding in IOS.

Is it possible to limits google places to one or two places like restaurants or coffeeshops?

I'm building an app in swift that can filter places to one or two types of locations e.g restaurants or coffeeshops is that possible and how its done ?
The app fetch data only from these places.
YES you can search via Types in the google places like in this example
https://maps.googleapis.com/maps/api/place/textsearch/json?query=Mexican+Restaurant&sensor=true&location=40.846,-73.938&radius=20&key=yourKeyHere
Explanation:
This will give you result in the radius of 20km with all types of restaurants in Mexico. you can also check this documentation for a lot of different variation.
https://developers.google.com/places/?csw=1#PlaceSearchResults

Twitter Stream api filter by location AND track

I'm using the following line in order to get geolocated tweets that contain a certain keyword. (I'm using the word Madonna)
https://stream.twitter.com/1.1/statuses/filter.json?track=Madonna&locations=-180,-90,180,90
My problem is that result is not consisted by geolocated tweets that contain the keyword Madonna, but is consisted by geolocated tweets in general.
Any help on what I'm doing wrong here?
"-180,-90,180,90" - it is worldwide location;
Currently for use "AND" instead of "OR" in Twitter stream API you need make request like this: https://stream.twitter.com/1.1/statuses/filter.json?locations=-74,40,-73,41 and filtered results by "Madonna" inside your app after. Unfortunatly, I can not find another way for today;
Filtering by locations can contain:
If coordinates is empty but place is populated, the region defined in
place is checked for intersection against the locations bounding box.
Any overlap will match.
Another, somewhat hack-y solution to this, is you can have a track key work that would never match, such as "dkghaskldfnascjkawenaf", and add a location bounding box.
The API does an OR relationship between tracking and location, you'll only receive tweets from within (or very nearby) the bounding box

Resources