Mark userId nullable (Breaking Change)
In rare cases userId is null. I'm usure why but it seems to represent a linked account which doesn't started a game.
Raw API response to nameOnPlatform search:
{
"profileId": "d3dde2ca-7c92-468e-89b4-9dab253225ce",
"userId": null,
"platformType": "psn",
"idOnPlatform": "2072355385337540186",
"nameOnPlatform": "AreYouAhueliTut"
}
Library response to idOnPlatform search:
{
"id": "07c8acb0-542a-4ad0-b0b0-0a714e346584",
"userId": null,
"idOnPlatform": "76561198106338458",
"platform": "steam",
"nameOnPlatform": "76561198106338458",
"avatar": {
"146": "https://ubisoft-avatars.akamaized.net/null/default_146_146.png",
"256": "https://ubisoft-avatars.akamaized.net/null/default_256_256.png",
"500": "https://ubisoft-avatars.akamaized.net/null/default_tall.png"
}
}
https://public-ubiservices.ubi.com/v3/profiles?platformType=psn&namesOnPlatform=AreYouAhueliTut
Returns:
{
"profiles": [
{
"profileId": "d3dde2ca-7c92-468e-89b4-9dab253225ce",
"userId": "c4fdcaf8-3282-45ec-826b-8f91b4dd1794",
"platformType": "psn",
"idOnPlatform": "2072355385337540186",
"nameOnPlatform": "AreYouAhueliTut"
}
]
}
For second case it does indeed returns null for userId
I took the PSN example from my Postman collection, it is outdated. But null is still possible, and it should be represented in types.
Is there a reason we use userId instead of profileId while building avatar url? Can't remember.
Ubisoft doesn't proxy platform avatar behind profileId URL, there's a blank avatar. All trackers (e.g. R6DB) display userId avatar for console profiles.
I went down a rabbit hole, even more lost now. How does r6tracker displays pfp for this user: https://r6.tracker.network/profile/xbox/Mono%20wins
Looks like they're using some Xbox API to retrieve platform avatar by idOnPlatform. But this is not r6api.js business, IMHO. Also, I sure there's no similar API for PSN.