question

Aman Kumar avatar image
Aman Kumar asked

Content is empty when searching item

I am following process to create a draft item:

  • CreateUrl for uploading a text file

  • Upload txt file on that url

  • CreateDraftItem and setting the value of content uploadId and upload Url.

  • publishing the draft item

After following the above process, I am able to create an item successfully but when I am running SearchItems or GetDraftItems to get the item list, content list seems to be empty even I have provided the id and url for the content.

Below is the code I am using to createDraft Item :

 private void CreateLayout(int layoutNumber, string uploadUrl, string uploadId)
     {
         List<Content> con = new List<Content>();
         Content tempCon = new Content();
         tempCon.Url = uploadUrl;
         tempCon.Id = uploadId;
    
         con.Add(tempCon);
    
    
         PlayFabEconomyAPI.CreateDraftItem(new CreateDraftItemRequest
         {
             Publish = true,
             Item = new PlayFab.EconomyModels.CatalogItem
             {
                 Type = "ugc",
                 Title = new Dictionary<string, string>
                 {
                     {
                         "neutral","UGCTest"
                     }
                 },
                 Description = new Dictionary<string, string>
                 {
                     {
                         "neutral","A ugc item"
                     }
                 },
                 ContentType = "MapLayout",
                 IsHidden = false,
    
                 Contents = con
    
             }
         },
         (result) =>
         {
             Debug.Log(JsonConvert.SerializeObject(result));
             Debug.Log(result.Item.CreatorEntity.Id);
         },
         OnErrorWhileCreatingUGC);
     }

Below is the code for getting all the items

 PlayFabEconomyAPI.SearchItems(new SearchItemsRequest
             {
                 Entity = new PlayFab.EconomyModels.EntityKey
                 {
                     Id = entityKey.Id,
                     Type = entityKey.Type
                 },
                 Count = 10,
                 Search = "UGCTest"
             },
             (result) =>
             {
                 Debug.Log(JsonConvert.SerializeObject(result));
             },
             OnErrorWhileCreatingUGC);
apis
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 need to set the Select parameter to retrieve fields like Contents and Images.

https://learn.microsoft.com/en-us/gaming/playfab/features/economy-v2/catalog/search#select

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.