question

murtaza-1 avatar image
murtaza-1 asked

Not Able to Fetch Bundles by searchItemsAsync Method Unity C#

I'm trying to use the searchItemsAsync method to Fetch the Bundles from playfab but it's not working.

I tried to get this same data with the REST API "Catalog/SearchItems" on Postman and it works but not with Unity.

The difference i noticed is that 1. In postman i got the Entity Token from other REST API "Authentication/GetEntityToken" which works to search and get bundles 2. In Unity i SignIn with Email and Password that user's Entity token doesn't get the bundle

so there is some difference in how the entity token that is generated through Auth API which has maybe more permission etc so it fetches bundle but the signIn user Token doesn't.

Please help me !,I'm trying to use the searchItemsAsync method to Fetch the Bundles from playfab but it's not working.

I tried to get this same data with the REST API "Catalog/SearchItems" on Postman and it works but not with Unity.

The difference i noticed is that 1. In postman i got the Entity Token from other REST API "Authentication/GetEntityToken" which works to search and get bundles 2. In Unity i SignIn with Email and Password that user's Entity token doesn't get the bundle

so there is some difference in how the entity token that is generated through Auth API which has maybe more permission etc so it fetches bundle but the signIn user Token doesn't.

Please help me !

unity3dsdksIn-Game Economy
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

·
Xiao Zha avatar image
Xiao Zha answered

If you call GetEntityToken API in Postman with SecretKey and empty request body, the token you get is a title-level entity token, which does have more permissions than the entity token (player-level token) you get through the Login API. If you use SessionTicket to call GetEntityToken API, the permissions of the token you get are the same as the token obtained through the Login API. --

Since the title level entity token can get all bundles, including expired ones, but the player level token can only get non-expired bundles, you may check the bundle's end date in the GameManager to see if the bundle has expired. And below is the code in Unity to get bundles.

  void GetBundles()
         {
             PlayFabEconomyAPI.SearchItems(new SearchItemsRequest
             {
                 Filter = "Type eq 'bundle'",
                 Count = 50
             }, re =>
             {
                 Debug.Log(re.Items.Count);
             }, er =>
             {
                 Debug.Log(er.GenerateErrorReport());
             });
         }
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.