question

mmoussalli avatar image
mmoussalli asked

How to filter Inventory (V2) Item on Content Type

How to filter items on Content Type using inventory V2? I talk about the content type defined in the catalogue v2. I can filter it with SearchItem request: https://learn.microsoft.com/en-us/gaming/playfab/features/economy-v2/catalog/search#filter. But it's not supported on for the inventory query.

In the game I am working on, there is mini-games where only some type of items will be shown to user depending on the mini-game he's playing. My initial plan was to query only those items from inventory when the player enter the first time in the mini-game.

Without this kind of filter, the only way I can use inventory in my game is to retrieve the whole player inventory at start of the game by doing multiple pagination queries on the whole inventory and then filter them myself, it seems very inefficient from my point of view if the player have a big inventory.

Is there an alternative to query only specific items from the player inventory?

Player Inventory
10 |1200

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

1 Answer

·
kylemc@microsoft.com avatar image
kylemc@microsoft.com answered

You can currently filter by InventoryItem type, id, and stackId. If you'd like to filter by other properties (like contentType) please open (or vote for) a feature suggestion in the forum.

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.

mmoussalli avatar image mmoussalli commented ·
0 Likes 0 ·
Neils Shi avatar image Neils Shi mmoussalli commented ·

I'm glad you solved it, feel free to let us know if there are any other questions.

0 Likes 0 ·
fito avatar image fito commented ·

Can the inventory be filtered by stack id and type? I'm using this filter by I'm getting an error type eq 'catalogItem' and stackId eq 'default'

0 Likes 0 ·
kylemc@microsoft.com avatar image kylemc@microsoft.com fito commented ·

No. Unfortunately our OData implementation here is a little hacky. We'd like to improve it, but only specific property combinations work right now. (multiple types, multiples ids, multiple stackids, id and stackid)

0 Likes 0 ·

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.