get a list of all the layers id that are in a PortalItem

237
1
03-12-2023 05:41 AM
eyalj
by
New Contributor II

hey everyone im trying to retrive all reosureces that are in a portal item using the fetchResources function but it return

 

nextStart : -1
resources: []
total: 0

 



although there is resources in the portal item
what im doing wrong?

 

const item = new PortalItem({
id: "0890f410a5314b448528f059e3083261",
portal
});
await item.load();
console.log(item.fetchResources());

 



Resources:

eyalj_0-1678706920324.png

 

0 Kudos
1 Reply
BrianLeroux
Occasional Contributor III

I am not familiar with fetchResources but couldn't you just use the item resources REST endpoint? https://developers.arcgis.com/rest/users-groups-and-items/item-resources.htm

0 Kudos