Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Foursquare API deprecated /users/self/friends endpoint #1357

Open
WASD42 opened this issue Dec 10, 2022 · 4 comments
Open

Foursquare API deprecated /users/self/friends endpoint #1357

WASD42 opened this issue Dec 10, 2022 · 4 comments

Comments

@WASD42
Copy link

WASD42 commented Dec 10, 2022

Bug

Exception raised when calling getUserContacts() function:

Signed API request to https://api.foursquare.com/v2/users/self/friends has returned an error. HTTP error 404. Raw Provider API response: {"meta":{"code":404,"errorType":"endpoint_error","errorDetail":"No matching user action or aspect.","requested":"<...>"},"notifications":[{"type":"notificationTray","item":{"unreadCount":0}}],"response":{}}.

Version and provider

Version 3.7.1, Foursquare provider.

Reproduction

Just try to call getUserContacts() function.

@WASD42
Copy link
Author

WASD42 commented Dec 10, 2022

While I could not find any mentions that /users/self/friends endpoint will be deprecated, it's not in the documentation anymore. The only partial workaround is to request /users/self and look for friends item which contains the total number of friends and a few profiles of the actual friends:

"friends": { "count": 191, "groups": [ { "type": "friends", "name": "Common friends", "count": 0, "items": [] }, { "type": "others", "name": "Other friends", "count": 191, "items": [ { "id": "123456", "firstName": "name", "lastName": "surname", "gender": "male", "address": "", "city": "", "state": "", "countryCode": "GB", "relationship": "friend", "photo": { "prefix": "https://fastly.4sqi.net/img/user/", "suffix": "/12345.jpg" }, "tips": { "count": 17 }, "lists": { "groups": [ { "type": "created", "count": 3, "items": [] } ] }, "homeCity": "", "bio": "", "contact": { "twitter": "twitname", "facebook": "fbid" } }]}]}

Have no idea how to fetch the rest of the list though.

@RiverVanRain
Copy link
Contributor

Try

$response = $this->apiRequest('users/self', 'GET', [
    'group' => 'friends',
]);

as suggested

@WASD42
Copy link
Author

WASD42 commented Mar 31, 2023

@RiverVanRain Unfortunately, the endpoint you are referencing is '/users/self/lists' and it returns venues lists, not users.

@RiverVanRain
Copy link
Contributor

@WASD42 My bad. Try this:

$response = $this->apiRequest('users/self/lists', 'GET', [
    'group' => 'friends',
]);

Quote from reference:

QUERY PARAMS

group
can be created (lists created by this user), edited (other people's lists this user has edited), followed (lists this user follows), friends (lists from this user's friends), and suggested (lists relevant to the user's current location).

So you can choose friends param in this case to get the user's friends list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants