[PR #93] [CLOSED] fix(people): correct friends list API endpoints and contract version #93

Closed
opened 2026-02-28 01:19:28 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/tr4nt0r/python-xbox/pull/93
Author: @misiektoja
Created: 2/7/2026
Status: Closed

Base: mainHead: friends-list-fix


📝 Commits (3)

  • 4825142 fix(people): correct friends list API endpoints and contract version
  • 70a6f8d fix(people): revert get_friends_own URL to maintain established behavior
  • 6243bc5 test(people): add compatibility test for contract v5 response format

📊 Changes

4 files changed (+127 additions, -23 deletions)

View changed files

📝 src/pythonxbox/api/provider/people/__init__.py (+24 -9)
📝 src/pythonxbox/api/provider/people/models.py (+14 -14)
tests/data/responses/people_friends_by_xuid_v5.json (+74 -0)
📝 tests/test_people.py (+15 -0)

📄 Description

Hi, I switched my project from xbox-webapi-python to python-xbox and noticed that my code for fetching the list of friends was not working anymore.

It turned out the get_friends_by_xuid() method was not working correctly:

  1. It had a broken URL path /users/me/people/xuids({xuid})/... which returns the authenticated user's info, not the target user's friends list. The correct path is /users/xuid({xuid})/people/social/...

  2. Contract version 7 returns empty results for get_friends_by_xuid(). When querying another user's friends list, contract v7 returns {"people": []} while v5 returns the actual friends list.

I compared behavior across contract versions:

Version get_friends_own get_friends_by_xuid
v3 (original xbox-webapi) OK OK
v5 OK OK
v7 OK NOT OK

I noticed contract v7 was introduced in PR #1 to provide additional relationship fields (isFriend, canBeFriended etc.). However, these fields are only returned when querying your OWN friends list - get_friends_by_xuid() returns empty with v7 when querying another user.

I implemented usage of different contract versions per method to get the best of both worlds:

Method Contract Version Reason
get_friends_own v7 Full relationship fields
get_friends_by_xuid v5 v7 returns empty for other users

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/tr4nt0r/python-xbox/pull/93 **Author:** [@misiektoja](https://github.com/misiektoja) **Created:** 2/7/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `friends-list-fix` --- ### 📝 Commits (3) - [`4825142`](https://github.com/tr4nt0r/python-xbox/commit/4825142e6a9ffd64b99c99c6ca7e12f4c7e0d30e) fix(people): correct friends list API endpoints and contract version - [`70a6f8d`](https://github.com/tr4nt0r/python-xbox/commit/70a6f8d7218022df2ac0da40b684a0bb737d45c3) fix(people): revert get_friends_own URL to maintain established behavior - [`6243bc5`](https://github.com/tr4nt0r/python-xbox/commit/6243bc5f93856f346450db251f5518b3576434a0) test(people): add compatibility test for contract v5 response format ### 📊 Changes **4 files changed** (+127 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `src/pythonxbox/api/provider/people/__init__.py` (+24 -9) 📝 `src/pythonxbox/api/provider/people/models.py` (+14 -14) ➕ `tests/data/responses/people_friends_by_xuid_v5.json` (+74 -0) 📝 `tests/test_people.py` (+15 -0) </details> ### 📄 Description Hi, I switched my project from **xbox-webapi-python** to **python-xbox** and noticed that my code for fetching the list of friends was not working anymore. It turned out the `get_friends_by_xuid()` method was not working correctly: 1. It had a broken URL path `/users/me/people/xuids({xuid})/...` which returns the authenticated user's info, not the target user's friends list. The correct path is `/users/xuid({xuid})/people/social/...` 2. **Contract version 7 returns empty results** for `get_friends_by_xuid()`. When querying another user's friends list, contract v7 returns `{"people": []}` while v5 returns the actual friends list. I compared behavior across contract versions: | Version | `get_friends_own` | `get_friends_by_xuid` | |---------|------------------|----------------------| | v3 (original xbox-webapi) | OK | OK | | v5 | OK | OK | | v7 | OK | NOT OK | I noticed contract v7 was introduced in PR #1 to provide additional relationship fields (`isFriend`, `canBeFriended` etc.). However, these fields are only returned when querying your OWN friends list - `get_friends_by_xuid()` returns empty with v7 when querying another user. I implemented usage of **different contract versions per method** to get the best of both worlds: | Method | Contract Version | Reason | |--------|------------------|--------| | `get_friends_own` | v7 | Full relationship fields | | `get_friends_by_xuid` | **v5** | v7 returns empty for other users | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 01:19:28 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/python-xbox#93
No description provided.