question

Marc avatar image
Marc asked

Limitation on UpdateUserInventoryItemCustomData?

Hi,

I'm having the error "PlayFabAPIError InvalidParams: Invalid input parameters" when I try to update the customdata from an item of the player inventory.

I realized that when I add more than 10 elements on the dictionary<string, string> the error appears. 

Is there a limitation on the function or is a bug?

 

Marc

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

Actually, "Invalid Input Parameters" usually means there was something wrong in the call itself. Can you provide the details of the call as you made it?

10 |1200

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

Marc avatar image
Marc answered

It's a very simple call. Just define a dictionary and a call to a servercript. When I call it without "11" element, runs ok. When I include it, fails.

Dictionary<string, string> d = new Dictionary<string, string> ();

d.Add ("1", "1");
d.Add ("2", "2");
d.Add ("3", "3");
d.Add ("4", "4");
d.Add ("5", "5");
d.Add ("6", "6");
d.Add ("7", "7");
d.Add ("8", "8");
d.Add ("9", "9");
d.Add ("10", "10"); // --> ok so far
d.Add ("11", "11"); // --> fail from here

RunCloudScriptRequest request = new RunCloudScriptRequest()
{
   ActionId = "UpdateUserInventoryItemCustomData",
   Params = new {
     ItemInstanceId = itemInstanceId,
     data = d
   }
};

PlayFabClientAPI.RunCloudScript(request, (result) =>
{
   Debug.Log("Updated item "+itemInstanceId);
   if( onInventoryUpdateComplete != null )
      onInventoryUpdateComplete();

},(error) => {

   Debug.LogError(error.ErrorMessage);

   if( onInventoryUpdateFailed != null )
      onInventoryUpdateFailed(error.ErrorMessage);
});

And in the serverscript:

handlers.UpdateUserInventoryItemCustomData = function(args){

   var result = server.UpdateUserInventoryItemCustomData({
      PlayFabId: currentPlayerId,
      ItemInstanceId: args.ItemInstanceId,
      Data: args.data
   });

   return result;
}

Let me know if you need something more

Marc

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

Yes, there's currently a limit of 10 keys in the custom data of an inventory item instance. The error details, if you make this call locally, or pass that element back in a log.info would detail this. However, I need to point out that we'll be updating the limit shortly to allow you to have however many keys you desire, though the total size limit for custom data on an inventory item instance will remain the same (under 1KB).

10 |1200

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

Marc avatar image
Marc answered

Thank you Brendan

I'll keep in mind. Just a final thought, maybe it could be interesting putting that info in the "UpdateUserInventoryItemCustomData" api documentation.

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

Yes, we've been trying to avoid having the same information replicated in multiple places, since that's a good way for them to get out of sync, but I'll talk to the tools team about the possibility of having both query the limits from the same place.

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.