question

dev-12 avatar image
dev-12 asked

Bad request calling GetUserData on another Player

Hi i am trying to call GetUserData for the players connected in the session but i keep getting bad request. It works when i call it without a PlayFabId to get my local player UserData. I have public permission set for the keys i am requesting. Is there something else i am missing?

Example:

             var remotePlayers = PlayFabMultiplayerManager.Get().RemotePlayers;
             foreach(PlayFabPlayer player in remotePlayers)
             {
              PlayFabClientAPI.GetUserData(new GetUserDataRequest()
                     {
                         PlayFabId = player .EntityKey.Id,
                         Keys = new List<string>(){ "Data1", "Data2"},
                
                     }, result =>
                     {
                         Debug.Log("Got user data:");
                    }, error =>
                    {
                       // Here i get BadRequest response
                    }
             });
apisunity3d
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

·
Neils Shi avatar image
Neils Shi answered

According to the Entities quickstart - PlayFab | Microsoft Learn, the EntityID corresponds to a player‘s title account id and the PlayFabId corresponds to a player’s master account id. And the API GetUserData needs you provide a PlayFabId instead of the EntityId. Since the Party only provides player’s entity id info, you can call API GetProfile to obtain the PlayFabId via EntityID. In the response, the PlayFabId could be found as Profile.Lineage.MasterPlayerAccountId.

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.

dev-12 avatar image dev-12 commented ·

Thanks for response!

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.