FourSquare Venues API - foursquare

I am a bit shaky on how to use the venues API in forusquare. My main question is related to OAuth. I want to be able to do venue searches on the server side of the system, and i need the server to login into foursquare automatically. It says on the website that foursquare doesn't require user authentication to use some of the venue functions, however whenever i try to do a call to: venues/categories without specifying an oath_token I get a permission error.
How can i do venue calls without having to use a user login?
Thanks in advance.

It would help if you had given the exact url you are trying to call, but in general:
The userless requests to Foursquare still require the client id and client secret that you get when you register the OAuth Consumer in foursquare.
Using the id + secret you can access Venue API endpoints without authenticating with a user.
So if I got to the Venues Categories endpoint you can see that it does not require and acting user and thus accessing:
https://api.foursquare.com/v2/venues/categories?client_id={0}&client_secret={1}&v={2}
Will get the categories list.
In that example, replace {0} with your client id, {1} with your client secret and {2} with whatever version date you feel comfortable with, today would be 20111218
More can be found here https://developer.foursquare.com/overview/auth#userless

you can use https://developer.foursquare.com/docs/explore#req=/venues/categories and in the view box use /venues/categories to see a list of all of the venue codes to use. then simply use:
https://api.foursquare.com/v2/venues/search?ll="+ ll+"&radius=10000&limit=50&categoryId="+catID+"&client_secret=xxx&client_id=xxx
in your call to load the url based upon ll which is long and lat and it will create a response of json object to parse. The App/Web site does not need to be authorized for such a search, and the limit goes to 5000 calls per hour, and you can increase this by emailing Foursquare with the application information and screen image of the app showing you credit Foursquare with the info, like a Foursquare button, etc. - Hope this helps.

Visit https://foursquare.com/developers/apps to get your API keys. Once you click "Create A New App", your Client ID and Client Secret should be visible.
Once you have your keys, try plugging them into this search:
https://api.foursquare.com/v2/venues/search?near=seattle,wa&query=coffee&v=20150214&m=foursquare&client_secret=xxx&client_id=xxx

Related

What endpoint in the Instagram API do I use to retrieve data from followed accounts such as the amount of followers they have?

I want to create an app that can show you the amount of followers and the amount of accounts followed by particular user that your account follows. Confusing I know....
What endpoint do I use to retrieve such data from followed accounts?
I have tried reading through the Instagram API documentation but it only shows a small amount of endpoints to be used. I know there are much more endpoints to be used, for example by apps such as "Unfollowers" where it can specifically list the accounts that you follow and that don't follow you back.
You can use the following endpoint of the unofficial Instagram API
https://www.instagram.com/graphql/query/?query_hash=c76146de99bb02f6415203be841dd25a&variables={"id":"USER_ID","include_reel":true,"fetch_mutual":true,"first":10}
to retrieve the first 10 followers.
The data of the followers is in the edges array:
data.user.edge_followed_by.edges
Since the API limits the data per request, you should make any subsequent requests as follows:
https://www.instagram.com/graphql/query/?query_hash=c76146de99bb02f6415203be841dd25a&variables={"id":"USER_ID","include_reel":true,"fetch_mutual":true,"first":10,"after":"END_CURSOR"}
where end_cursor is the value in the response:
data.user.edge_followed_by.page_info.end_cursor
Then for each of the users you follow can extract their USER_ID and use:
https://i.instagram.com/api/v1/users/USER_ID/info/
to get the count of each user.
Please note that you need to supply all the cookies for instagram.com for the requests. You can find a full list in the developer tools of the browser.
document.cookie does not deliver all the cookies, since some are sent automatically by the browser, so please look them up in the developer tools.
Hope it helps !

how to solve the instagram api tag limit?

I want to use instagram api like Tinder app. (but Tinder uses one specific person's account, but I want to use tags.)
so, if I call #travel, then it showes 30 of #travel hashtag pics.
But there is API call limit 5000/hour,
do you know how Tinder use instagram api call ?
Thanks.
5000/hr is per access_token, so if you make the user connect using Instagram in your app, then each user will have 5000/hr.
If you dont want to make your users connect with Instagram, then you have to cache the results on server using your access_token and then serve results from your server

Retrieve tagged photos from Instagrams API without forcing user to login?

I want to retrieve a list of recent photos with a given tag to display on a website in a very simple gallery.
For that, the doc says I need an access token. However, it seems that the only way to authenticate against Instagram is through OAuth; which involves sending the user to instagram and allowing my application access to their basic data. However, I don't want my users to do anything; I'd like my application to authenticate against Instagram for me and then retrieve the data I want.
Sounds simple, but all online documentation seems to end up in "Redirect your user to...". And I find no sensible ways to do this programatically; it's all about sending users away, letting them authenticate, and then receiving the access token afterwards. I could of course scrape the HTML, parse the forms (for example, the unique-per-session csrfmiddlewaretoken field which needs to be posted along with login requests etc) and let my server side application pretend to be my own user and login/authorize the app, but that doesn't seem like the way to go.
I could also just authenticate manually in the browser, pick up the auth token and paste into my application; but as the doc says: "do not assume your access_token is valid forever." - so I'd like this to be fully automated.
If I try to create a WebClient and POST to https://www.instagram.com/oauth/authorize/?client_id={clientId}&redirect_uri={redirectUri}&response_type=code&scope=basic it just returns a 403 Forbidden which is of no use. (For what it's worth, I'm using C# and have found instasharp, but this problem is not tied to any given platform...)
Am I completely overlooking something, or am I right that server side authentication against Instagram has become really complicated? Most other social media platform API's I've touched lets me get some form of authentication token just by posting a combination of the application id and secret.

Get list or count of registered users for application

Using Instagram's API, is there any way to request a list or count of an application's registered users?
Instagram's real-time subscriptions can send notifications whenever a registered user posts to their feed, but I haven't found a way to get a list of those users, or even a count. This is easy enough to store server-side, but seems like something which should be discoverable.
Your Question
Using Instagram's API, is there any way to request a list of an application's registered users?
A quick search yielded no results for such a functionality. This make sense, though, since Instagram wouldn't want to open up all its users to any app designer.
Your App
If you want the number of users using your app, then you can easily track this yourself.
Instagram App
As mentioned before, Instagram probably won't provide even basic count information about its registered users. Presumably, this is valuable information.
Your Example
Instagram's real-time subscriptions can send notifications whenever a registered user posts to their feed...
This is true, but with very limited scope. The subscriptions below are based on users who are using your app or other simple criteria such as tags or geographic data.
Users: receive notifications when users who have registered with your application post new photos.
Tags: receive notifications when a new photo is tagged with tags of your choosing
Locations: receive notifications when new photos are posted and tagged with a specific location
Geographies: receive notifications when a new photos are posted in an arbitrary geographical location as defined by a center point
and radius
As far as I have found this far there is no IG API, however as already indicated you can keep track on your app. HOWEVER, what has not been pointed out is that you won't be made aware if users terminate their account or revoke your app so the count's might be a little off. (or worse if you didnt start keeping track since the public launch of your app)
You could test on a periodic basis if you still have access, but that would require additional code, and a lot of API calls if you app has a lot of users. I hope that IG will add this function at some point.

How can I retrieve the check-in object from foursquare by querying with a checkin id?

I have obtained the 4sq checkin id from twitter streaming api and I want to get the details of the checkin such as userid, time, venueid etc.
However, when I check the 4sq api, I find that the related endpoint requires an acting user. So can anybody suggest what could be an alternative way to get this information? (especially user_id)
Thanks!!
Right now there is no alternative way:
The Checkin endpoint requires authentication, it will return the data you are looking for.
Foursquare requires you to act as a user (via OAuth) to get user related information.
The only thing that does not require authentication is the Venues Platform, but you cannot get information about checkins from it, just number of people who checked in a place.

Resources