question

xigmasuji avatar image
xigmasuji asked

How do I use a unique displayname of a user to get his profile or playfabID ?

I would like to have the functionality in our game where users could use the display name(unique) to find other players. Could that be achieved ? (P.S : all player displaynames in our title are unique) So far I could not be able to find an API that would allow me to procure the MasterPlayerAccountId/PlayFabID using the display names(unique) or even the PlayerProfile if that is a possiblity, The end goal is to show the player's DisplayPicture and their Avatar URL when a player tries to search for another player.

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.

Infer Wang avatar image
Infer Wang answered

You can use this Api GetAccountInfo, put TitleDisplayName in your request body. The result contains PlayFabID ana AvatarUrl.

1 comment
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 ·

Thank you it helps, but I would love to do this in our server, your suggestion is great but 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 worked 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

0 Likes 0 ·
xigmasuji avatar image
xigmasuji answered

Thank you and a follow up question, I am trying to pull this off using Azure Servers and that would require me the

 PlayFabServerInstanceAPI api = new PlayFabServerInstanceAPI(
          new PlayFabApiSettings
          {
                  TitleId = context.TitleAuthenticationContext.Id,
                  DeveloperSecretKey = Environment.GetEnvironmentVariable("PLAYFAB_DEV_SECRET_KEY", EnvironmentVariableTarget.Process)
          },
          new PlayFabAuthenticationContext
          {
              PlayFabId = context.CallerEntityProfile.Entity.Id,
              EntityToken = context.TitleAuthenticationContext.EntityToken
          }
      );

And there is no API in the PlayFabServerInstanceAPI that helps me set the TitleDisplayName of a player. Can you suggest me any for getting it I am using

      PlayFab.ServerModels.GetPlayerProfileRequest  profileRequest = new PlayFab.ServerModels.GetPlayerProfileRequest
      {
      PlayFabId = context.CallerEntityProfile.Lineage.MasterPlayerAccountId
      };
      PlayFabResult profileResult = await api.GetPlayerProfileAsync(profileRequest);

Even what you have suggested is using the ClientAPI not the server API I need help with this, appreciate if you guide me in the right way

10 |1200

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

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.