question

Amar avatar image
Amar asked

UpdateUserInternalData needs a PlayFabID and has to be MasterPlayerID

We have an application where some of our external services need to update some data on player accounts. And to achieve this we are using ServerAPI. An to user server API, we have created multiple secrets for each of our internal service that needs access to our PlayFab Title, so that they can login with a ServerCustomID, and once they login they can call our CloudScripts that take data from these services and update the layer/USerData. (Server/UpdateUserInternalData)

1) The challenge or confusion I now have is that this external services needs to know the PlayerID of the user it needs to UpdateUserInternalData. This API https://docs.microsoft.com/en-us/rest/api/playfab/server/player-data-management/updateuserinternaldata?view=playfab-rest

This API requires: and is not clear if this PlayFabId is masterID or TitleId.

PlayFabId True
  • string
Unique PlayFab assigned ID of the user on whom the operation will be performed.

When tries from Postman, I was only able to updateUSerInternalData, when I pass in MasterPlayFabId and not TitlePlayFabId. Does this mean, our external services need to keep track of both Master and Title PlayerId of all the platers in the system?

2) I understand the how Master and Title ID work, but for a external Service logged into a Title Using: /Server/LoginWithServerCustomId, why cant we just use TitleID? Also is there a way to retrieve the MasterID from TitleID as part of ServerAPI?

3) What is the right scenario for using MasterId vs TitleId? Why does the API documentation not make it clear that it is supposed to be a MasterId and not a TitleId on the (Server/UpdateUserInternalData)..

4) Finally, if my external service has to update or set a flag on 10k userId's (MasterId), is this the right way to do it? by having the Service login with ServerCustomID, and perform CloudScripts, if not what is a better way to do it?

Player Data
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

·
Sarah Zhang avatar image
Sarah Zhang answered

>> Does this mean, our external services need to keep track of both Master and Title PlayerId of all the players in the system?

We would suggest you only track the PlayFabId (MasterPlayerId). Because you can get the TitlePlayerId form PlayFabId using this API GetTitlePlayersFromMasterPlayerAccountIds.

>> why cant we just use TitleID? Also is there a way to retrieve the MasterID from TitleID as part of ServerAPI?

If you mean TitlePlayerId, as the above answer said, you can get the TitlePlayerId from PlayFabId.

>> What is the right scenaio for using MasterId vs TitleId? Why does the API documentation not make it clear that it is supposed to be a MasterId and not a TitleId on the (Server/UpdateUserInternalData)

PlayFab API is divided into Entity API and Classic API. The API methods that need to use EntityToken are Entity API. Title player account and master player account are the concepts of Entity API model. PlayFabId is the concept of Classic API. And PlayFabId is corresponding to MasterPlayerId.
UpdateUserInternalData is Classic API, so you need to pass the PlayFabId(MasterPlayerId) to request it. So at all scenarios that you want to call Classic API for players, you need to use PlayFabId(MasterPlayerId).

MasterPlayerId and TitlePlayerId both can be used in the Entity API, MasterPlayerId means the Player’s unique Id in the Game Studio, TitlePlayerId means the Player’s unique Id in the Game Title.

As the documentation -- Entity Programming Model said we need to maintain backward compatibility with all released APIs. So these two types of API now coexist.

>> Finally, if my external service has to update or set a flag on 10k userId's (MasterId), is this the right way to do it? by having the Service login with ServerCustomID, and perform CloudScripts, if not what is a better way to do it?

If you need to set the same flags for 10k users, you can consider putting the corresponding users in one Player Segment and using Scheduled tasks to run the CloudScript for them in batches. Besides, you can call the Server API ExecuteCloudScript in the custom server directly too.

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.