four square api doesn't work properly - foursquare

I am using four square API to display the auto suggestions when user types a word. I use:
$http.get('https://api.foursquare.com/v2/venues/search?&near='+input+'&query=' +input+'&intent=gloabal&limit=5&oauth_token=D5STL1YLFPPGLOF121W....&v=2016...')
But I am not getting the exact results. Sometimes it shows nothing giving empty objects and also in different languages like tamil, urdu, etc...
Then I tried with an example - taj mahal. If I type taj,taj ma, taj maha like that... It doesn't show anything... API suggests taj mahal only when i type taj mahal fully in the search box.
Can anyone provide some insight?

Just trying to debug this for you. Here are some glaring things that might be the issue here:
a) It appears that your intent specifies gloabal vs global, which would likely default to the intent checkin via https://developer.foursquare.com/docs/venues/search
b) Could be an issue with your search e.g. searching for the taj mahal near the taj mahal.
To get into the details more, it might help to dig into some of the raw HTTP requests being sent to Foursquare.
Here is a sample CURL command for finding 'food' near the Taj Mahal.
curl -v 'https://api.foursquare.com/v2/venues/search?&near=taj%20mahal&query=food&intent=global&limit=5&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=20160828'
To diagnose the issue, it might make sense to try and simulate both inputs e.g. near and query params using curl above to diagnose whether the response is what you are looking for.
In addition it's worthwhile noting that near must be a string representing a place in the world. If the near string is not geocodable you should see a failed_geocode error. Specific to your question if you use the the param near=taj%20ma you'll likely get a failed_geocode probably as expected. More details via https://developer.foursquare.com/docs/venues/search
For specifics on language, my understanding is that you can set the locale in the Accept-Language HTTP header in your request (preferred) or alternatively specify parameter locale. If nothing is specified my assumption is that the language that's most popular in the country for that venue will likely be used. More details via https://developer.foursquare.com/overview/versioning

Related

2sxc Content App - Locations - How to convert to Canadian and US Addresses with region/state

I am using the latest versions on 2sxc (11.05) and the Content App on DNN 9.06. The Content-Type for Locations does not have a field for Region (or State). Is there already something in place to account for that to get Canadian or US addresses to output normally? I realize I can add the field and then maybe use the Dropdown from Query to hook it up to DNN's list of Regions, and then modify the Views accordingly...
But that seems like a lot of work for something that might already be built in (and I just don't see it?). Or is there another easy way to tackle this?
Truth be told - we never needed that so far, so it doesn't exist.
Is this necessary for maps to work, or just another field which a standard us-address needs? I'm curious because neither outlook nor SharePoint seem to require such a field, so I never really thought about it.
BUT: if you do implement it, please do share it back with us, so we can publish it.
Note that if this is important, a possibly nicer solution would be to use a public api somewhere which provides this information, as it's most certainly more complete & up to date for this purpose. If this is the case, ping me and I'll implement a string-dropdown-from-json or something like that :)

Instagram - Obtaining data in realtime

I am trying to get the recent post from a particular location. using this url.
https://api.instagram.com/v1/media/search?lat=34.0500&lng=-118.2500&distance=50&MAX_ID=max_id&access_token=XXXX
So when I use this URL for the first time, I get 20 results. I obtain the max ID from the list of 20 results and modify my url .
But when I use the modified URL, I obtain the same result as the first one.
How do I go about solving this?
Contrary to what I thought, the media search endpoint doesn't return a pagination object. Sorry. It also doesn't support the min_id/max_id parameters, which is why you are having problems..
If you want to get different data you are going to have to use the time based request parameter MIN_TIMESTAMP. However it looks like that parameter doesn't work for that endpoint either (though the documentation says it is supported). Indeed, a quick search on the internet reveals it might be a long standing bug with the api.

Google Docs Zoom Querystring Parameter

Is there a way to set the zoom level in google docs by using a querystring parameter?
eg- https://docs.google.com/a/getsatisfaction.com/document/d/q3ljkasdlfgkjsdflgkj/edit?zoom=fit
I know there's other querystring parameters you can set, like how "render mode" can be set with the rm parameter (eg - rm=demo). I also found this related SO question, which doesn't mention zoom options.
I have been searching for a while now and have not found any concrete way to manipulate the user's view setting of a document when it's embedded into a webpage via iframe. The only options I have found for getting a doc to adjust within the given frame are as follows:
/pub? - This removes any toolbar display and displays a rough view of the doc. If you use tabs or spaces to line things up, they will not look pretty with this option. I have tried adding the "rm=full" and/or "ui=2" parameters (and other combinations) but those did not do anything.
/preview? - This also removes any ui elements and just straight-up shows the doc. This one doesn't work for me because I need users to be able to print the doc.
I even thought that perhaps the view setting was determined in the doc itself, but anything I tried in that direction (setting to Fit, looking in doc settings, etc) produced no results. So the parameters I am using now are:
/edit?usp=viewing&chrome=false&rm=demo (still overflows in the iframe in Firefox & Chrome)
I hope this info helps anyone else at least a little bit. (I would have provided all this as a comment but I needed more points in order to do that.) It's disappointing that one of the most obvious and relied-upon Docs options cannot be adjusted through parameters.

Tower : Localizing with an unanticipated dictionary

I'm working with the Tower library for i18n and l10n in my web application.
I have the problem of having to localize "just-in-time", i.e with an unanticipated dictionary, and in particular unanticipated supported locales.
I receive HTTP request, from which I can extract the accepted locales in preference order, e.g :
[:de :en-UK :en :fr-FR :fr]
On the other hand, I have to localize from micro-dictionaries which are fetched from a database, in the form :
{:fr "En Français"
:en "In English"
:en-Uk "In English from UK"}
What I would like to do in my program is to find the best matching translations from these 2 elements (in the example, it is :en-UK; note that I may not know in advance that :de is unavailable).
I haven't found a way to do that with the Tower library (and I'd like to avoid reinventing the wheel).
Does anyone know how I might proceed?
Thanks in advance!
Just added native support for arbitrary locale fallbacks in Tower v2.1.0-SNAPSHOT, as per discussion here: https://github.com/ptaoussanis/tower/issues/43#issuecomment-42014418
So it'll now be possible to request a translation like (t [:fr-FR :en-US] :example/foo).
Cheers! :-)
You could get a sequence of keys from the map, get all the values that are common to both sequences, and then choose whatever one is preferred based on whatever logic fits your requirements.

Grouping operators in Spotify advanced search

I'm trying to use the Spotify web API to return multiple specific results in one response.
For example, maybe I want Spotify's detailed information for "Thriller", by Michael Jackson, and "Highway Star", by Deep Purple.
Since I don't already have the Spotify uris I need to use the Search method. And there's a page describing Spotify's advanced search syntax here. They support searching against specific fields, like track, artist, and album. They also support the basic boolean operators.
But there's nothing on that page (or anywhere else on the internet, as far as I can tell) describing how the boolean operator precedence works, or how you might go about grouping your search criteria.
I would need something effectively the same as (track:Thriller AND artist:"Michael Jackson") OR (track:"highway star" AND artist:"Deep Purple").
Using similar criteria to pull in just one track at a time works:
http://ws.spotify.com/search/1/track?q=track:"thriller"+AND+artist:"michael+jackson"
I tried to jump right in with the parentheses, even though they're not mentioned in the docs. No luck:
ws.spotify.com/search/1/track?q=(track:"thriller"+AND+artist:"michael+jackson")+OR+(track:"highway+star"+AND+artist:"deep+purple")
Then I thought I'd try playing with precedence. Maybe they don't just process left-to-right - maybe the ORs are all resolved, and then the ANDs:
ws.spotify.com/search/1/track?q=track:"thriller"+OR+track:"highway+star"+AND+artist:"michael+jackson"+OR+artist:"deep+purple"
That seemed promising, and returned 185 results, but it's not quite right. I'm seeing tracks named "Highway Star" from other bands. That seems to rule out "left-to-right", "OR-before-AND" AND "AND-before-OR". Which doesn't make any sense - what else is left?
Can anyone with more Spotify experience shed some light on how a query like this should work?
Unfortunately, there's not really much support for this in Spotify's Web API (I've tried myself, with the same outcome as you've had). And from the looks of it, the API's been worked on for a couple of years, so I wouldn't expect much to change.
However, I strongly recommend that you have a look at the Echo Nest API's instead; they support quite powerful queries and have a bunch of awesome stuff in their API.
Furthermore, they've also got support for getting Spotify URI:s for the search results (tracks, artists etc). This means that you could probably stick to the EN API altogether.
Also, The Echo Nest are continuously adding more features to their API, so it's really become the go-to API for music (outperforming Last.fm and similar by far).

Resources