Skip to content

portal

const portal: object

Defined in: src/portal.ts:16

Search a Portal and retrieve its configured basemaps, mirroring the native Portal class (com.arcgismaps.portal.Portal / ArcGIS.Portal).

All calls are anonymous — no authentication is required for public portals (ArcGIS Online by default). Secured portals (requiring a login) are out of scope; add a credential via setServiceCredential / setTokenCredential before calling these functions if the portal demands authentication.

The portal is loaded (portal.load() / portal.load()) before each query so that organisation-specific settings (like custom basemaps) are available.

fetchBasemaps: (params?) => Promise<BasemapInfo[]>

Fetches the organisation basemaps configured for the portal at params.portalUrl (default https://www.arcgis.com). Returns a flat list of { name, itemId } records. Pass itemId to <Map portalItem={{ itemId }}> to use a basemap in a map view.

BasemapQuery

Promise<BasemapInfo[]>

const basemaps = await portal.fetchBasemaps();
// basemaps: BasemapInfo[] — e.g. [{ name: 'World Topographic Map', itemId: '...' }, ...]

findItems: (query) => Promise<PortalItemInfo[]>

Searches the portal for items matching query.query, returning up to query.max results (default 10). Uses the portal at query.portalUrl (default https://www.arcgis.com).

PortalQuery

Promise<PortalItemInfo[]>

const items = await portal.findItems({
query: 'type:"Web Map" owner:esri',
max: 20,
});
// items: PortalItemInfo[] — each has { id, title, type, snippet, owner, thumbnailUrl }