sorry... to much beer after a day spending on this:
code:
var HerbiListRequest = { CustomId: CustomID, };
EmptyHerbiList = PlayFabClientSDK.GetUserInventory(HerbiListRequest);
EmptyHerbiList.then(function(EmptyHerbiList){
JavaHerbi = JSON.parse(EmptyHerbiList.item);
console.log(JavaHerbi);
}
in the console I can read every data I want :-)
but I can't acsess by code... :-)
seems the promise is a JS.Object with a Json inside...?
I've tried everything.
.Data
.data
.Item
.item
.Items
and so on...
but I can't reach the data
What should I do :-(( ?
Firstly, according to the API reference of the client API GetUserInventory. You do not need to add “CustomId” field in the request body. You can modify the line 1 to “var HerbiListRequest = {};”. Secondly, you need to navigate to “EmptyHerbiList.data.Inventory” to get the Inventory field in the response. Finally, the Inventory of GetUserInventoryResult is an array, so you can use array.forEach() method to get the items in it.
var getUserInventoryRequest = {}; inventoryList = PlayFabClientSDK.GetUserInventory(getUserInventoryRequest); inventoryList.then(function (inventoryList) { inventoryList.data.Inventory.forEach(item => console.log(item)); });
2 People are following this question.