question

Bryan Matsui Pierce avatar image
Bryan Matsui Pierce asked

What is the "PlayerProfileViewConstraints" of GetProfiles?

I have a custom friend system that requires the player to call GetProfiles for their friends on login. I am worried that the return value of the function would be quite large due to the function also returning the Objects and Files of each player. Is there a way to prevent this? Is this where I use global policies? All I need is the DisplayName and AvatarURL

apisentities
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

If you just need the DisplayName and the AvatarURL of your friends, you can call GetFriendList API and set the properties: ShowDisplayName and ShowAvataURL in the ProfileConstraints to true to get the DisplayName and the AvatarURL of your friends. Please note that you also need to check the ShowDisplayName and ShowAvataURL option in the Title Settings->Client Profile Options.

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.

Bryan Matsui Pierce avatar image Bryan Matsui Pierce commented ·

I used to use the built-in PlayFab Friend API but moved away from it and made a custom system with Azure functions to support friend Invitations and a few other small features. It relies on EntityKeys so calling GetProfiles is required. In terms of global policies, would it be possible to restrict the read access of GetProfiles?

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha Bryan Matsui Pierce commented ·

Currently, PlayFab classic model and the entity mode doesn’t share the same DisplayName, which means you cannot get the DisplayName that in the Player Overview page through calling GetProfiles API.

If you only need DisplayName and AvatarURL, as a workaround, you can store the DisplayName and the AvatarURL of player’s friends into the player’s Object when they become friends, then use GetObjects API with Title EntityToken in Azure Function to get the entity Objects. In this case, you will not get other information you don’t want, but it’s difficult to update the Objects when friends change their information.

Or you can call AddFriends API when you custom friends system add friends, then you can simply call Server API Friend List Management - Get Friends List - REST API (PlayFab Server) | Microsoft Learn in Azure Function and and set the properties: ShowDisplayName and ShowAvataURL in the ProfileConstraints to true to get the DisplayName and the AvatarURL of your friends.

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.