Okay, so now that I've posted the title...here's what's up:
In the documentation for GrantItemsToUser, the returned value for GrantItemsToUserResult should contain an array of GrantedItemInstance. These are stated to contain values for UnitPrice and CustomData, but they don't.
I've stringified the resulting JSON objects and those fields simply don't exist. Since that's the case, I then have to spend another API call to request the user inventory again to simply get these values. Anyway those return values could be fully fleshed out?
Alternatively, maybe I'm missing something along the way, but I don't think so. The documentation is pretty clear, it's just that it seems to be inaccurate.
Thanks,
Shaun
Specific link I'm looking at for GrantItemsToUser: https://docs.microsoft.com/en-us/rest/api/playfab/server/player-item-management/grantitemstouser?view=playfab-rest#grantediteminstance
May be worth adding the same type of note (also, maybe in bold or some other color to stand out) that exists in https://docs.microsoft.com/en-us/rest/api/playfab/server/player-item-management/getuserinventory?view=playfab-rest#iteminstance :
A unique instance of an item in a user's inventory. Note, to retrieve additional information for an item instance (such as Tags, Description, or Custom Data that are set on the root catalog item), a call to GetCatalogItems is required. The Item ID of the instance can then be matched to a catalog entry, which contains the additional information. Also note that Custom Data is only set here from a call to UpdateUserInventoryItemCustomData. |
Also would be good to expand this comment to include all fields that aren't actually returned/populated, such as UnitPrice, which is also the case for ItemInstance returned via GetCatalogItems.
And while we're on it, having to either build a lookup structure or linearly traverse the resulting catalog items seems less than idea when you're having to cross reference and itemid returned from either of the GrantItemsToUser or GetInventory calls. :)
We have noticed this issue and will have a discussion with our team about expected behavior of GrantItemsToUserResult.
This issue as some fields' value of GrantedItemInstance is missing in the response of GrantItemsToUser API should have been fixed, please let us know if it still exists
3 People are following this question.