fetchContent

Function

Fetch enriched content from the Portal and Hub APIs.

Fetch enriched content from the Portal and Hub APIs.

Parameters

Parameter Type Default Notes
identifier Required string

content slug or id

options Optional IFetchContentOptions

Request options with additional options to control how the content or enrichments are fetched

Returns

A content object composed of the backing item and enrichments

import { fetchContent } from '@esri/hub-common'
// fetch content by slug
const content = await fetchContent('my-org::item-name')
Promise<IHubContent>
Property Type Notes
identifier string

The preferred identifier to use for Hub URLs. This will be either the slug, hubId, or item id.

isDownloadable boolean

Whether the content is downloadable in the Hub app

item IItem

The underlying portal item referenced by this content

permissions {
control:
AccessControl
groups:
IGroup[]
visibility:
Visibility
}

Content visibility and access control, including groups NOTE: this needs to be reconciled with Hub permission system

publishedDate Date

Date the content was published (formal metadata), defaults to the date the content was created

created Inherited number
id Inherited string
modified Inherited number
numViews Inherited number
owner Inherited string
size Inherited number
tags Inherited string[]
title Inherited string
type Inherited string
additionalResources Optional IHubAdditionalResource[]

links to additional resources specified in the formal item metadata

categories Optional string[]

Parsed item categories (see parseItemCategories)

family Optional HubFamily

The the family of related types that this content belongs to.

hubActions Optional object

Configure which Hub application actions (i.e. create web map) are available for this content

hubId Optional string

The content's ID for use with the Hub API For most content this will be the item's id For layers this will be <itemId>_<layerId> This will be undefined for private items and in enterprise because only public online items are included in the Hub API

isProxied Optional boolean

Whether or not the layer or table is actually a proxied CSV

layer Optional Partial<ILayerDefinition>

Information about the layer referenced by this content (geometryType, fields, etc)

portalApiUrl Optional string

URL of the Portal API endpoint for the resource

portalDataUrl Optional string

URL of the Portal API data endpoint for the resource

portalHomeUrl Optional string

URL of the resource's page in the Portal Home application

publishedDateSource Optional string

Description of the source of the published date

publisher Optional {
isExternal:
boolean
name:
string
nameSource:
PublisherSource
orgId:
string
organization:
string
organizationSource:
PublisherSource
username:
string
}

Info to display about the content's publisher. Follows this fallback pattern:

  1. Formal Item Metadata > Resource > Citation > Contact
  2. Formal Item Metadata > Resource > Contact
  3. Formal Item Metadata > Contact
  4. Item’s Owner and Org Name
  5. Undefined (Item Owner / Org are private and we can't access additional info)
slug Optional string

Slug that can be used to lookup an entity by something other than it's id

structuredLicense Optional IStructuredLicense

The content's structured license info

updateFrequency Optional string

Frequency at which the content is updated

viewDefinition Optional {
definitionExpression:
string
}

definition for content that refers to a client-side layer view

boundary Optional Inherited IHubGeography

boundary will default to the item extent but can be overwritten by enrichments from the Hub API (inline) or fetched from a location such as /resources/boundary.json

culture Optional Inherited string
data Optional Inherited [key: string]: any

The portal item's data (if any)

description Optional Inherited string
documentation Optional Inherited string
errors Optional Inherited IEnrichmentErrorInfo[]

Any errors encountered when fetching enrichments see https://github.com/ArcGIS/hub-indexer/blob/master/docs/errors.md#response-formatting-for-errors

extent Optional Inherited number[][]
groupIds Optional Inherited string[]

The ids of any groups that the item belongs to

layers Optional Inherited Array<Partial<ILayerDefinition>>

Detailed information about the service's layers (geometryType, fields, etc) for related layers in the service

metadata Optional Inherited any

The content's formal metadata

org Optional Inherited Partial<IPortal>

The owner's organization (portal) details (id, name, extent, etc)

ownerUser Optional Inherited IUser

The user that owns the item

properties Optional Inherited any
protected Optional Inherited boolean
recordCount Optional Inherited number | null

The count of records for the layer referenced by this content

server Optional Inherited Partial<IFeatureServiceDefinition>

Information about the service referenced by this content (currentVersion, capabilities, maxRecordCount etc)

servicesDirectoryDisabled Optional Inherited boolean

If the server's services directory is disabled. See https://enterprise.arcgis.com/en/server/latest/administer/linux/disabling-the-services-directory.htm

snippet Optional Inherited string
spatialReference Optional Inherited ISpatialReference
statistics Optional Inherited any
typeKeywords Optional Inherited string[]
url Optional Inherited string

Function defined in common/src/content/fetch.ts:209