question

Cristian Bontas avatar image
Cristian Bontas asked

how to obtain master_player_account from title_player_account?

Hello

From a cloud script function, having some title_player_account id's (from GetMatch), I want to call

for each of them GetUserReadOnlyData and other functions that require the playfabId, i.e. the master_player_account.

Or is there another way to access that data using only the title_player_account?

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

·
Citrus Yan avatar image
Citrus Yan answered

Hi @Cristian Bontas,

You can utilize entity API GetProfile/GetProfiles to obtain master_player_account_id from title_player_account_id, which is returned in the Lineage property field, here is a sample response:

 "Lineage": {
                    "NamespaceId": "B858C3EF9CE3F195",
                    "TitleId": "2C1CC",
                    "MasterPlayerAccountId": "29EBD5013B37FEE2",
                    "TitlePlayerAccountId": "37E23F7F8E3CBC92"
            },

And, you could also pass the players’ (including the creator and other members ) master_player_account_id in the form of <title_account_player_id, master_player_account_id> directly to the MatchmakingPlayerAttributes property when calling CreateMatchmakingTicket. GetMatch will then return such data for you to utilize in the CloudScript function, saving the need to issue the GetProfile/GetProfiles API call in the function.

By the way, it looks like you are going to iterate all the players (calling GetUserReadOnlyData and other APIs for each of them) in a match from CloudScript. However, it’s not recommended to do that if the number of players is potentially big because it will certainly hit PlayFab service with far more calls that are allowed by the Terms of Service. Therefore, a better way to do that is to enable PlayFab SDK in your game server build to issue calls such as GetUserReadOnlyData and other APIs, this will allow you to issue API calls more frequently rather than being limited by Cloudscript's restricted resources(execution time, API request limit).

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.

Cristian Bontas avatar image Cristian Bontas commented ·

This is very helpful, thank you!

I was thinking about the option of passing the master player account ID in the ticket, but didn't realize that calling the API's directly from the server was a better option.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Cristian Bontas commented ·

Glad it helped:)

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.