question

mitchell avatar image
mitchell asked

UpdateSharedGroupData KeysToRemove Error code 400

Hello, I am trying to remove data from an existing SharedGroupData

When Using the Try It option from the server API documentation or using the C# Unity SDK I get the same error 400

Is there a know issue with this api?

Mitch

Shared Group Data
playfaberror2.png (31.7 KiB)
playfaberror.png (37.0 KiB)
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 answered

Can you clarify your steps? When I try removing a Key from a Shared Group in the Game Manager, I click on the box next to the Key, click Remove above (right below "Data"), then click Save Shared Group Data, and it successfully removes the data. The screenshot above shows the Game Manager view of the Shared Group and its data, but "Remove" isn't checked in your example.

For the Try It call, can you clarify the Title ID, and do you mind if we test in your title directly? We're unable to reproduce that error, using valid values in our testing.


capture.png (32.0 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mitchell avatar image
mitchell answered

Hello @Brendan,

I have tried using the C# api call to remove the data and the Try It button on the website like you did in your screenshot. Neither works properly for me. The test I have set up is on the project '656B - witchy'. The project is used for live production but the account (8BAD5E51F6DEE8D5) and GroupData (Visiting_8BAD5E51F6DEE8D5) in this example are for testing only, you are welcome to run tests against them. The second test account used in my repro steps below was (1C035B20AEE5E461) and has the same issue with that players SharedGroupData (Visiting_1C035B20AEE5E461) this account is also safe to run tests against.

The steps I followed to get into this state:

1. Use PlayFabClientAPI.CreateSharedGroup from the Unity C# api to create the group with the current user as a member

SharedGroupId = Visiting_8BAD5E51F6DEE8D5,

2. from a different account I make a cloudscript call which adds data to the SharedGroup

handlers.ProvideAssistance = function(args, context) {
  var updateGroupRequest = {
    SharedGroupId: "Visiting_" + args.targetPlayerId,
    Permission: "Public",
    Data: {}
  };
  updateGroupRequest.Data[currentPlayerId] = JSON.stringify({
    featureId: args.featureId,
    guid: args.guid
  });
  var updateStatisticsRequest = {
    PlayFabId: args.targetPlayerId,
    Statistics: [
        {
          StatisticName: "Visiting",
          Value: -2147483648,
        }
      ]
  };
  server.UpdatePlayerStatistics(updateStatisticsRequest);
  return server.UpdateSharedGroupData(updateGroupRequest);
}

3. from the account that created the SharedGroup I use PlayFabClientAPI.GetSharedGroupData to retrieve all data from the SharedGroup

SharedGroupId = Visiting_8BAD5E51F6DEE8D5,

GetMembers = true,

4. using the data keys retrieved in step 3 i call PlayFabClientAPI.UpdateSharedGroupData with

SharedGroupId = Visiting_8BAD5E51F6DEE8D5,

Data = null,

KeysToRemove = ["1C035B20AEE5E461 "]

Permission = null,

5. The update call fails.

PlayFabError.ToString()

/Client/UpdateSharedGroupData PlayFabError(InvalidParams, Invalid input parameters, 400 BadRequest - Details: Data: The value for key 1C035B20AEE5E461 was not valid JSON. | )

PlayFabError.GenerateErrorReport()

/Client/UpdateSharedGroupData: Invalid input parameters
Data: The value for key 1C035B20AEE5E461 was not valid JSON.
6 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.

brendan avatar image brendan commented ·

Well first, in your example above, the KeysToRemove is incorrect, as there's an added space in the ID. But more importantly, what PlayFab ID is making the call to UpdateSharedGroupData in step 4?

0 Likes 0 ·
mitchell avatar image mitchell brendan commented ·

@Brendan the account that created the sharedData is the one removing keys (8BAD5E51F6DEE8D5)

0 Likes 0 ·
brendan avatar image brendan mitchell commented ·

Thanks - do you mind if I try reproducing this, by making the same call using the same player account in your title?

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.