question

xigmasuji avatar image
xigmasuji asked

How to access a player's AvatarUrl using their TitleDisplayName in Server using Server/Admin API Models

This is a follow up to the question I have already asked in How do I use a unique displayname of a user to get his profile or playfabID ?, the suggestion I received there was great but it uses the Client API but I want something that uses Admin API or the Server API since I will be handling it in the server.

I tried the following code it did not work

          PlayFab.ServerModels.GetUserAccountInfoRequest request = new PlayFab.ServerModels.GetUserAccountInfoRequest
          {
              PlayFabId = "Theactualdisplayname"
          };
        
          PlayFabResult<PlayFab.ServerModels.GetUserAccountInfoResult> result = await serverAPI.GetUserAccountInfoAsync(request);

and this also

    PlayFab.ServerModels.GetPlayerProfileRequest  profileRequest = new PlayFab.ServerModels.GetPlayerProfileRequest
              {
                  PlayFabId = "Theactualdisplayname"
              };
        
          PlayFabResult<PlayFab.ServerModels.GetPlayerProfileResult> profileResult = await serverAPI.GetPlayerProfileAsync(profileRequest);

Neither of them work by using TitleDisplayName they'd require a PlayFabID kindly suggest me an API that I can use over the server that takes title name in the request of a player and gives back the avatar URL

Player Dataapisunity3dmultiplayer
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Xiao Zha avatar image
Xiao Zha answered

The PlayFabId, which is also the master_player_account Id, is not equivalent to the TitleDisplayName. Server APIs: GetUserAccountInfo and GetPlayerProfile do not support the use of TitleDisplayName in the request body, and this is also the case for Admin APIs. And there are no Server or Admin APIs that use TitleDisplayName in the request body and return the avatar URL. Also, may I know the reason why you don’t use PlayFabId on the server? And if you pass the TitleDisplayName to the server, you may also pass the PlayFabId and use it.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

xigmasuji avatar image xigmasuji commented ·

The basic Idea is for a player to find other players by searching them in our system using their TitleDisplayName, which would obtain them the other player's profile picture and other relevant data, more like how you'd find your friend in any multiplayer service using their call tag in call of duty and other relevant games.

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha xigmasuji commented ·

The Client API GetAccountInfo can be used to search for other players with TitleDisplayName, but this can be done only if you leave the TitleDisplayName setting to requiring they are unique (the default for all titles). If you have checked the “allow non-unique player display names” option in Title Settings General page, there is no such way to search the non-unique TitleDisplayNames with PlayFab APIs now. In this case, you may consider using Database such as Cosmos DB to store all players' Display Name and other related info in your Database, and then use query language to do the search.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.