Foursquare API - Search By Address - ios

I am using the venues/search API in my app and I am getting some strange results: https://developer.foursquare.com/docs/venues/search.
If I send in the query "1 Irving", as if a user is searching for an address, the list of results returned by Foursquare contains irrelevant venues. From looking at the documentation, I would guess that this is because the "query" parameter of the API is only searching against venue names, and not addresses.
If that is the case, does anyone know if there is any way to get the API to search against address information also? It seems the Foursquare and Swarm apps both do this when searching, as the results for "1 Irving" are much more relevant when I try there.
Edit: including screenshot from Foursquare app

In the venues/search documentation it mentions that if you set intent=match you can include an address parameter.
Finds venues that are are nearly-exact matches for the given
parameters. This intent is highly sensitive to the provided location.
We recommend using this intent only when trying to correlate an
existing place database with Foursquare's. The results will be sorted
best match first, taking distance and spelling mistakes/variations
into account.
query and ll are the only required parameters for this intent, but
matching also supports phone, address, city, state, zip, and twitter.
There's no specified format for these parameters—we do our best to
normalize them and drop them from the search if unsuccessful.
However you still need to provide a query parameter that would be the venue name. I don't believe an endpoint exists to lookup a venue with nothing but an address.

Just from taking a quick look at the docs, it seems like you can just pass the location in as the near object rather than the query object. The docs specifically say "A search term to be applied against venue names."

Related

In Microsoft Graph API, what filters are supported in people search query?

Microsoft graph provides a people query that can receive $search url parameter e.g.
https://graph.microsoft.com/beta/me/people/?$search="topic: work"
what search parameters are supported in the people query?
what is the exact meaning of the topic filter?
The $search parameter searches across the displayName and emailAddress properties of a person.
Searches on people occur on both the displayName and emailAddress properties of the person resource. Searches implement a fuzzy matching algorithm. They will return results based on an exact match and also on inferences about the intent of the search.
The topic: attempts to match people who are interested in a given topic by looking through the user's mail history. If you're emailing with someone about avocados then topic:avocado would surface that person.
You can also perform searches for people who are interested in a particular topic. Searches are performed based on inferences derived from the user's mail conversations. .
"Topics" are just words that have been used most by users in email conversations. Microsoft extracts such words and creates an index for this data to facilitate fuzzy searches.
A search like the following:
GET https://graph.microsoft.com/v1.0/me/people/?$search="topic:windows"
is a fuzzy search in this topic data index. Topics in this data are context free, so a search for "windows" can include instances that mean the Windows operating system, an opening in a building wall, or other definitions.

Find all comments matching a query on different youtbue videos

I know it is possible to list comments for a single video on youtbue but is it possible to find all comments on youtbue data api v3 that match a query?
For example if I search for "BMW" I find all comments on different videos with "BMW" in it. If it is not supported what would be a work around?
I am using python.
Comments: list Returns a list of comments that match the API
request parameters.
There is a filter parameter which will return the only certain comment ids, (why you would want to do this no idea)
id string The id parameter specifies a comma-separated list of
comment IDs for the resources that are being retrieved. In a comment
resource, the id property specifies the comment's ID.
For the Google methods that do allow you to do a string search (Which is what I think you are looking for) the parameter is normally q.
search.list has this option you can search for videos by text string, Google drive file.list also has it you can search for files that start with a name or type.
Answer: by checking the documentation we can see that it is not possible to find all comments on YouTube Data API v3 that match a string query.

Insights for Twitter service in IBM Bluemix: Search case-sensitive string and other questions

I am trying to search for a case-sensitive string in Twitter. I know the standard query is case-insensitive. How can I do case-sensitive search?
Also, the search arguments are "AND". Is there a way that I can write arguments and treat them as "OR"? To say it more clear, for illustration, I would like to search for tweets with either one of the following arguments: bio_location:"Philippines" or country_code:PH. I don't want to use "AND" because I am aware that there are users without bio_location and also some users only have country_code populated. So I want to get those who will satisfy any one of these arguments.
Another question, is there a way that I can filter out retweets?
Thank you!
2) "OR" is supported. See Query language for usage of the OR operator. Searching for "bio_location:"Philippines" OR country_code:PH" should work.
In answer to your questions....
1) You can use an 'exact phrase match' for case-sensitivity - see API docs for more on this. Not sure what your use case is, so this may or may not work for you.
2) Currently the 'OR' conditional is not supported by the API, or at least it is not documented in the API. I will get in touch with our developers to see if it is possible but not documented. In the mean time, you can do an two API calls and process the data server side (such as removing duplicates).
3) Filtering out retweets is possible. See API docs here under
get /v1/messages/search. Look specifically under the message.bodywhere it states: For Retweets, Twitter modifies the value of the body at the root level. Your application should look at the object.body to ensure that it is extracting the non-modified text.
Hope this helps!

Parsing Wikipedia countries, regions, cities

Is it possible to get a list of all Wikipedia countries, regions and cities with relations between them? I couldn't find any API appropriate for this task.
What is be the easiest way to parse all the information I need?
PS: I know, that there are another datasources I can get this information from. But I am interested in Wikipedia...
[2020 update] this is now best done using the Wikidata Query Service, you can run super specific queries with a bit of SPARQL, example: Find all countries and their label. See Wikidata Query Help
It might be a bit tedious to get the whole graph but you can get most of the data from the experimental/non-official Wikidata Query API.
I suggest the following workflow:
Go to an instance of the kind of entities you want to work with, say Estonia (Q191) and look for its instance of (P31) properties, you will find: country, sovereign state, member of the UN, member of the EU, etc.
Use the Wikidata Query API claim command to output every entity
that as the chosen P31 property. Lets try with country (Q6256):
http://wdq.wmflabs.org/api?q=claim[31:6256]
It outputs an array of numeric ids: that's your countries! (notice that the result is still incomplete as there are only 141 items found: either countries are missing from Wikidata, or, as suggested by Nemo in comments, some countries are to be found in country (Q6256) subclasses(P279))
You may want more than ids though, so you can ask Wikidata Official API for entities data:
https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q16&format=json&props=labels|claims&languages=en|fr
(here Canada(Q16) data, in json, with only claims and labels data, in English and French. Look at the documentation to adapt parameters to your needs)
You can query multiple entities at a time, with a limit of 50, as follow:
https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q16|Q17|Q20|Q27|Q28|Q29|Q30|Q31|Q32|Q33|Q34|Q35|Q36|Q37|Q38|Q39|Q40|Q41|Q43|Q45|Q77|Q79|Q96|Q114&format=json&props=labels|claims&languages=en|fr
From every countries data, you could look for entities registered as administrative subdivisions (P150) and repeat on those new entities.
Aternatively, you can get all the tree of administrative subdivisions with the tree command. For instance, for France(Q142) that would be http://wdq.wmflabs.org/api?q=tree[142][150] Tadaaa, 36994 items! But that's way harder to refine given the different kinds of subdivision you can encounter from a country to another. And avoid doing this kind of query from a browser, it might crash.
You now just have to find cities by countries by refining this last query with the claim command, and the appropriate sub-class(P279) of municipality(Q15284) entity (all available here): for France, that's commune (Q484170), so your request looks like
http://wdq.wmflabs.org/api?q=tree[142][150] AND claim[31:484170]
then repeat for all the countries: have fun!
You should go with Wikidata and/or dbpedia.
Personally I'd start with Wikidata as it's directly using MediaWiki, with the same API so you can use similar code. I would use pywikibot to get started. Like that you can still request pages from Wikipedia where that makes sense (e.g. list pages or categories).
Here's a nice overview of ways to access Wikidata

How the country code of a venue is generated?

I'm developing an APP using FS API and I need to geolocalize a venue. Nothing particularly difficult, just "US" or "Non-US".
I though of using the country code (CC fields) which come with every venue object, but I'm not sure how this country code is calculated:
a) Is something you infer using the lat and lon of the venue, and therefore something FS calculates directly with Geospatial queries?
b) Is something the user insert manually (not only the CC but the country itself) and therefore is something which can be missing of be mispelled / misinserted?
Cheers,
Alfredo
The country information is built up from a variety of sources, including geolocation and user input. The input is validated though, so there should not be any invalid country codes. You can expect that the country code will be an accurate representation of where the venue is located.

Resources