Idea

planetorigin avatar image
planetorigin suggested

Get a single item from the inventory

I have a game where items are added to the player's PlayFab inventory rather frequently. After an item has been added, the game will request the player's inventory then store a cached version of all items. When a player has a few hundred items in the inventory, fetching their whole inventory uses a lot of data. Instead of having to re-download the whole inventory, it would be really convenient and save a lot of data if there was a way to request a single ItemInstance (or possibly a list of ItemInstances) using an ItemInstanceID or some other identifier.

Player Inventory
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.

Jeremy Rose avatar image Jeremy Rose commented ·

A way even to say does player have item in inventory would be useful.

2 Likes 2 ·

4 Comments

·
rima avatar image
rima commented

I think it's extremely strange that we can't Query a Single Item. I couldn't believe it so i searched the API documentation Multiple times because i thought i was missing something.

In Order for Dedicated Servers to Validate Entitlement , We have to Get All the User Inventory Of Hundreds of Items Iterate Through each one and Find the One with the ID for just a Simple Entitlement check. we have to do it for 10 Players per match so it'll add up to a lot of query.

10 |1200

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

Derek Reese avatar image
Derek Reese commented

Economy v2 supports filtering your GetInventoryItems request: https://learn.microsoft.com/en-us/rest/api/playfab/economy/inventory/get-inventory-items


"Filter": "Id eq '{ItemGuIdHere}'"

See https://learn.microsoft.com/en-us/gaming/playfab/features/economy-v2/catalog/search#filter for more info.

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

Matt Rochon avatar image Matt Rochon commented ·

Hmm seems to only work on the Type param for GetInventoryItems:

"errorMessage": "Not supported filter: Id eq '{GUID}'. Supported filter format: type eq 'type'.",

Were you able to get this working?

0 Likes 0 ·
kylemc@microsoft.com avatar image kylemc@microsoft.com Matt Rochon commented ·

We finally got started on that work this week. :) I'd expect for it to be available early-to-mid February.

1 Like 1 ·
Matt Rochon avatar image Matt Rochon kylemc@microsoft.com commented ·

Will I be able to filter on stackid too? sometimes i want to omit certain specific stack ids from results.

0 Likes 0 ·
Show more comments
kylemc@microsoft.com avatar image
kylemc@microsoft.com commented

With the Economy V2 GA release, you can query by 'type', 'id', and 'stackId'. This should allow you to get one or more items from the inventory that match your Filter query.

https://learn.microsoft.com/en-us/rest/api/playfab/economy/inventory/get-inventory-items?view=playfab-rest#request-body

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

Matt Rochon avatar image Matt Rochon commented ·

Thanks Kyle, looks like it is in GA already?

0 Likes 0 ·
kylemc@microsoft.com avatar image kylemc@microsoft.com Matt Rochon commented ·

Yep! I hope it helps.

0 Likes 0 ·
Matt Rochon avatar image Matt Rochon kylemc@microsoft.com commented ·

only 'eq' is supported as a condition it seems. this doesnt make it a super useful 'filter'...

0 Likes 0 ·
Show more comments
Matt Rochon avatar image
Matt Rochon commented

{ "code": 400, "status": "BadRequest", "retryAfterSeconds": null, "error": "InvalidRequest", "errorCode": 1071, "errorMessage": "Not supported filter: stackId ne 'myStackId'. Only 'type', 'id', 'stackId' and 'eq' are supported.", "errorHash": "950da524193049a0abc54638fe83b36d", "errorDetails": null }

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 a Comment

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

Your Opinion Counts

Share your great idea, or help out by voting for other people's ideas.