pythonfoursquarecheckin

Foursquare API returns zero checkinsCount check-in counts in Python, but returns non-zero value in online trial interface


I use the following code to get details of a venue (with venue ID: 412d2800f964a520df0c1fe3) in my local PyCharm Edu:

import json, requests
url = 'https://api.foursquare.com/v2/venues/'
CLIENT_ID = 'XYZ' # I replace "XYZ" using my real CLIENT ID
CLIENT_SECRET = 'XYZ' # I replace "XYZ" using my real CLIENT SECRET
id='412d2800f964a520df0c1fe3'
params = dict(
  client_id=CLIENT_ID,
  client_secret=CLIENT_SECRET,
  v='20180323'
)
resp = requests.get(url=url+id, params=params)
data = json.loads(resp.text)
with open('resp_detail.json', 'a') as the_file:
    dumped=json.dumps(data)
    the_file.write("%s\n" % dumped)

The returned checkin statistics are: "stats": { "tipCount": 1672, "usersCount": 0, "checkinsCount": 0, "visitsCount": 0}.

However, when I use the online trial interface (https://foursquare.com/developers/explore#req=venues%2F49eeaf08f964a52078681fe3%3F) to get details of a venue for the same venue ID, the return results are: "stats": { "tipCount": 389 "usersCount": 16762 "checkinsCount": 25938 "visitsCount": 32866 }

The online results should be correct since this venue is Central Park, New York and it should get lots of checkins. I don't know what is wrong with my code.

Foursquare even didn't post a sample code for "get details of a venue".

Could anyone help to correct my code? Thank you so much!!


Solution

  • Beginning on May 31st, foursquare made five changes in order to simplify their API and maintain the quality of their service as their developer community grows.

    https://developer.foursquare.com/docs/announcements#start-up-tier-launch

    Access to check-in counts, visit counts, chain details, and key tastes will be removed

    So you can not get checkinsCount. I think the online trial interface is exception.