question

kennyroy avatar image
kennyroy asked

No SharedGroupData calls work for me.

I am having lots of trouble getting and updating shared group data at the moment.

In postman:

All client.GetSharedGroupData return 200: OK with empty data[] no matter what I put in for GroupId, etc. (Members:[] is present and returns an empty array if GetMembers:true, and is NOT present if GetMembers:false - so at least that is doing something)

All server.GetSharedGroupData returns InvalidSharedGroupId.

In CloudScript, the following function returns InvalidSharedGroupId:

handlers.writeGroupData = function(args, context)
{
    var writeData = server.UpdateSharedGroupData(
        {
            SharedGroupId: args.groupID,
            Data: args.Data
        }
    );
};

(I will be doing some data scrubbing and roles checks later, just trying to get the damn thing working right now.)

So I switched to Unity SDK, and the following :

public static void GetSharedGroupData(string ID, List<string> keys)
        {
            var request = new GetSharedGroupDataRequest
            {
                SharedGroupId = ID,
                GetMembers = true,
                Keys = keys
            };


            PlayFabClientAPI.GetSharedGroupData(request, OnGetSharedGroupData, OnPlayFabError);
        }

Returns same as client posts through Postman (200:OK and a blank Data object).

trying to UpdateSharedGroupData through Unity, this returns a different error (this is after login, and yes the player is an admin of the shared group). I've tried passing both the sharedgroup ID and the sharedgroup name (why do docs use group name? Is that valid <anywhere> !?)

 public static void UpdateSharedGroupData(string ID, Dictionary<string, string> data)
        {
            var request = new UpdateSharedGroupDataRequest
            {
                SharedGroupId = ID,
                Data = data,
                Permission = UserDataPermission.Public
            };


            PlayFabClientAPI.UpdateSharedGroupData(request, OnUpdateGroupData, OnPlayFabError);
        }
PlayFabError: {
    "ApiEndpoint": "/Client/UpdateSharedGroupData",
    "HttpCode": 401,
    "HttpStatus": "Unauthorized",
    "Error": 1089,
    "ErrorMessage": "NotAuthorized"
}

I am striking out all three ways I know how to test and implement this, what gives?

Shared Group Data
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.

kennyroy avatar image kennyroy commented ·

Wait just a gosh darn minute.

Shared Group Data != EntityGroup.Objects ?!?!?!!

I have been thinking this entire time that these were the same. It seems that a sharedgroup is kind of created "at runtime" (you can "search" for Shared Group Data in the dashboard and no matter what you search for it will display something, be it an empty shared group data object or an extant one).

This leads me to a TON of new questions, like how do we clean up shared group data for groups that no longer exist? Are most people creating a shared group data for their entity groups, using entity group objects instead, or not using entity groups at ALL (Seems shared group data is a bit more versatile than entity group objects!)

Head a little spinning right now sorry.

0 Likes 0 ·

1 Answer

·
Seth Du avatar image
Seth Du answered

The shared group is a relatively old group system in PlayFab. If you are using Postman, you may search for “sharedgroup” and all the result is APIs for this system. The modern one is entity group which can be managed in Game Manager. As you have tried, these 2 systems are separate and the shared group doesn’t have a GUI for management.

I think you may already have the answer but If you have more questions, please tell us.

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

kennyroy avatar image kennyroy commented ·

I am still a little head-spinning at the moment. Indeed I've sorted out the difference and am making calls in my game correctly now, but I am now re evaluating how I'm doing things.

I like the data model of shared group data, over entity group objects. Firstly, it seems arbitrarily created and named shared groups can be created for different purposes, they are subject to the same size and query limits as playerData (correct?) and the calls are very similar to the GetPlayerData calls, which works very neatly in my abstracted Playfab layer.

For example, I've been asking around here what would be a good way to save a bit of chat log between two people in an entity group. Well, shared group data seems perfect. The alphabetically first playfabID player would just write to the shared group named "playfabID1_playfabID2". This was GOING to be just one Key in a large Dict that was an entity group object before, but darn this sounds nicer.

The only thing I need to figure out is how does one clean up shared group data once it's been created?

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ kennyroy commented ·

Since there is no dedicated member permission/group management feature in shared group. you may use server API like DeleteSharedGroup to delete. In addition, if there are no memebers in a SharedGroup, it equals deleting the group, which means you may remove members either in client side or server side. However, be aware that anyone can remove any memebers in the group.

0 Likes 0 ·
kennyroy avatar image kennyroy Seth Du ♦ commented ·

Do you greatly recommend I don't use shared groups for that reason? I could write my own little panel that manages the shared groups (knowing the conditions that I am creating them I know how to find and delete ones that shouldn't exist anymore). Seems the best way to continue using them.

But if you are highly recommending I don't use them, for some oncoming reason like removal or deprecation, I'll go back to the idea of entity group objects. What do you think?

0 Likes 0 ·
Show more comments

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.