question

pajlombaard avatar image
pajlombaard asked

,GetFriendsList not returning FriendInfo parameters when ProfileConstraints is activated

Hi there,

When executing GetFriendsList and you set some flags in ProfileConstraints, the result will not return FriendInfo.Tags, FriendInfo.TitleDisplayName and FriendInfo.Username amongst others but if you leave out the ProfileConstraints it will return these values but ofcourse without the Profile data.

Is this how the API is supposed to work because I cannot confirm this from the documentation? It is a problem though because now I have to issue two GetFriendsList requests to get all the data, one for FriendInfo.Tags and one for Profile data.

To be clear, this code returns FriendInfo.Tags:

PlayFab.ClientModels.GetFriendsListRequest request = new PlayFab.ClientModels.GetFriendsListRequest();
PlayFabClientAPI.GetFriendsList(request, OnGetFriendsListSuccess, OnGetFriendsListFailure);

But this code does not return FriendInfo.Tags:

PlayFab.ClientModels.GetFriendsListRequest request = new PlayFab.ClientModels.GetFriendsListRequest();
request.ProfileConstraints = new PlayFab.ClientModels.PlayerProfileViewConstraints();
request.ProfileConstraints.ShowDisplayName = true;
request.ProfileConstraints.ShowStatistics = true;
request.ProfileConstraints.ShowTags = true;
PlayFabClientAPI.GetFriendsList(request, OnGetFriendsListSuccess, OnGetFriendsListFailure);

Now as far as I understand profile constraints should only affect what is shown in FriendInfo.Profile (my Client Profile Options for Tags, Statistics and Display Name is set by the way)

I even tested and confirmed this with the CALL API functionality on the documentation pages.

So is this correct or am I missing something?

Regards

Pieter

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.

pajlombaard avatar image pajlombaard commented ·

Sorry for posting the question twice, If I could I would edit and fix it.

0 Likes 0 ·
brendan avatar image brendan pajlombaard commented ·

No worries - the way the system works, new users have zero reputation. This is to prevent spammers from loading the forums with junk postings (which we saw a long time ago). Once you have some reputation (which is gained through forum participation), you'll be able to edit your posts (and post without moderation).

0 Likes 0 ·
brendan avatar image
brendan answered

What is the Title ID you're using, and what's a PlayFab ID for a user you're testing? I'd like to do some testing on specifically what you're seeing.

14 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.

pajlombaard avatar image pajlombaard commented ·

Title ID:45F0

Logged in with player:51B6C1A69F587F29

Running GetFriendList returns friend FBB80B0313BEEFBC but if ProfileConstraints are set, the Friend Tag "Confirmed" is not returned amongst other things.

0 Likes 0 ·
brendan avatar image brendan pajlombaard commented ·

Thanks - much appreciated! I have reproduced what you're seeing, and I've opened a bug on this to get it fixed as soon as possible.

0 Likes 0 ·
Nazariy Tymkiv avatar image Nazariy Tymkiv brendan commented ·

I have this bug too. Please fix it

0 Likes 0 ·
Show more comments
chris-3 avatar image chris-3 commented ·
@Brendan

Trying to use the Server version of this to get Tags from another playFabID and it doesn't return tags either.

response.Friends = server.GetFriendsList({PlayFabId: args.otherID}).Friends;

Get the player info sans Tags and Stats by the looks of it. Any suggestions on getting Tags from that or Stats?

,

@Brendan I wanted the Friends list of another user, so used:

response.Friends = server.GetFriendsList({PlayFabId: args.playerID}).Friends;

And Tags are not returned (verified in the dashboard that they are set)

Is there a way to get Tags returned?

0 Likes 0 ·
brendan avatar image brendan chris-3 commented ·

Are you describing something different from what's above? The bug here is that if you specify any ProfileConstraints, the Friend Tags are not returned. If you mean anything else, can you clarify what your request is asking for, and what ProfileConstraints you have set in the call?

0 Likes 0 ·
chris-3 avatar image chris-3 commented ·

Sorry, The call I put in the original request does not return Tags. to get Tags, I call GetFriendsTags and fill in the Tags element of the Friend structure myself rather than having it return from the GetFriendsList call. So yes it's a little different. I'm just passing the playerID with no constraints (unless there are default ones) and it doesn't return any tags.

So my code now looks like this :


response.Friends = server.GetFriendsList({PlayFabId: args.playerID, IncludeFacebookFriends: false, IncludeSteamFriends: false}).Friends;

for(var i=0;i<response.Friends.length;i++){
tags = server.GetPlayerTags({PlayFabId: response.Friends[i].FriendPlayFabId}).Tags; response.Friends[i].Tags = tags; }
0 Likes 0 ·
brendan avatar image brendan chris-3 commented ·

So, two things:

1. That's the player profile tags, not the friend tags. So what you're describing is unrelated. To get the player profile tags, you need to use the profile constraints. Have a look at the ProfileConstraints in the call (https://api.playfab.com/documentation/server/method/GetFriendsList.

2. You cannot iterate across all the players friends and make a call to the service. That's guaranteed to get your title throttled or even blocked, as you would be trying to make potentially hundreds or even thousands of API calls in a short period for a single player. In general, your design should be to make only a few calls per minute, per player, over the lifetime of the player session. Bursts of calls in a short period are fine, as long as the average works out to be lower.

0 Likes 0 ·
chris-3 avatar image chris-3 commented ·

I'll go back and change things. Thanks

0 Likes 0 ·
chris-3 avatar image chris-3 commented ·
@Brendan

I


server.GetFriendsList({PlayFabId: args.playrID, IncludeFacebookFriends: false, IncludeSteamFriends: false, PlayerProfileViewConstraints:[ {ShowTags: true, ShowStatistics: true, ShowDisplayName: true} ]});

Does this look right to you? I'm trying to roll up another call later (to get our Ranking leaderboard data with the rest of it based on constraints you pointed out to me.

I ask because all I got back was FriendPlayFabID, TitleDisplayName and an empty FacebookInfo block. Running the api via the try it now button, I get a different result. It shows FriendPlayFabID and a Profile block containing TitleId, PublisherID and PlayerID (repeat of Friend ID) only.

Is it that I really need to have all the options in the constraints block or did I do something else wrong?

0 Likes 0 ·
brendan avatar image brendan chris-3 commented ·

This is to query for another player's friends, then (otherwise, you could just use the built-in currentPlayerId to get the info for the player calling ExecuteCloudScript)? The one change you need to make is that the parameter name is "ProfileConstraints". The name of the class is "PlayerProfileViewConstraints".

0 Likes 0 ·
Show more comments
chris-3 avatar image
chris-3 answered

yes its to get the profile info from another player. I can get the info i want via separate calls in the loop (as per above). there would be a limit to the number of friends because I control that player.

changed to profileconstraints and got the same results. am i blocked from other players profiles?

Didn't know if i should leave actual IDs so removed them. but this is what I get back (AAAA is actually my profile and only friend at this time):

{
    "FunctionResult": {
        "Friends": [
            {
                "FriendPlayFabId": "AAAA",
                "Profile": {
                    "PublisherId": "BBBB",
                    "TitleId": "CCCC",
                    "PlayerId": "AAAA"
                }
            }
        ]
    },
    "Logs": [
        {
            "Level": "Info",
            "Message": "{\"PlayFabId\":\"XXXX\",\"IncludeFacebookFriends\":false,\"IncludeSteamFriends\":false,\"ProfileConstraints\":[{\"ShowAvatarUrl\":false,\"ShowBannedUntil\":false,\"ShowCampaignAttributions\":false,\"ShowContactEmailAddresses\":false,\"ShowCreated\":false,\"ShowDisplayName\":true,\"ShowLastLogin\":false,\"ShowLinkedAccounts\":false,\"ShowLocations\":false,\"ShowMemberships\":false,\"ShowOrigination\":false,\"ShowPushNotificationRegistrations\":false,\"ShowStatistics\":true,\"ShowTags\":true,\"ShowTotalValueToDateInUsd\":false,\"ShowValuesToDate\":false}]}",
            "Data": null
        }
    ],
    "ExecutionTimeSeconds": 0.1029181,
    "MemoryConsumedBytes": 43224,
    "APIRequestsIssued": 1,
    "HttpRequestsIssued": 0,
    "Error": null
}

as you can see from the log output, I set everything in the constraints at this point.

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.

brendan avatar image brendan commented ·

If you're requesting additional info for a very small number of players (as in, three or four) and you're only doing this once in a while (and not calling repeatedly to get info for all their friends), that should be fine, but please keep in mind what I said above. Too many calls on a per-player basis could get your title throttled or blocked, which we'd prefer to avoid.

PlayFab IDs and Title IDs aren't secret, and can be left in posts. It's the Session Tickets and especially the Secret Key you need to remove.

I'm not clear on what the specifics are of the call you're making, or what you're expecting in the results that's not there. Also, please see above - if you are calling GetFriendsList and want profile info, use ProfileConstratints. If you want the Friend Tags (note that this is not the same as the Player Tags), don't use ProfileConstraints. So with that understood, what is the specific API call you're making, what parameters are you passing in, what are you getting back, and what are you expecting to get back, but not getting?

0 Likes 0 ·
chris-3 avatar image
chris-3 answered

What I'm doing and maybe it's wrong is using a player as a holder for effectively a clan. Friends of that player are the members of the clan (so I can control the limits on how many are in it). Tags were used to the define the roles (owner, member, etc).

The statistic (Ranking) is an ELO that shows how well each player is doing in the game. The creation and management of members works. That looping call above where I iterate over the players works. I can get the ranking data from a friends leaderboard call.

I was trying to get the tags in the friends list initially (the example output lead me to think it was a default thing -my bad), then I fixed it with the iteration over the friends and now I was trying to get it with the single call to getFriendsList (per your suggestion to avoid the loop).

going back to the loop then everything seems to be good BUT for i'd likely be iterating over about 30 players not 3 or 4. It would only be once in a while (likely boot and maybe a refresh when they went to a clan page).

Oh and the call is the same as I posted before just with all the constraints defined (tried to see if it would make a difference). All I really want is Tags but Tags and Stats would be nice too.

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.

brendan avatar image brendan commented ·

You are correct in thinking that's not going to work. Attempting to hack a clan system in this way is going to run into quite a few issues. First, as you've already seen, it's going to run into the limits on API calls. I'm working on a performance guidelines write-up right now that I'll post to the site soon (it's in review right now), but a key point is that there's no such thing as a "clever workaround" to the limits - trying to bypass them will always cause a problem for your title. Second, you're going to run into collision issues in the data anytime you have more than one player acting on the data at the same time.

We are working on a Guild/Clan/Team system right now, and expect to be making it broadly available this quarter. If you have an urgent need and cannot wait on our new guild feature, I would have to recommend using an external data store for this.

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.