getContentFromPortal

Function

Fetch content using the ArcGIS REST API

Parameters

Parameter Type Default Notes
idOrItem Required string | IItem
requestOptions Optional IFetchEnrichmentOptions

Available requestOptions

Property Type Notes
enrichments Optional string[]

comma separated list of enrichment (property) names to fetch if omitted, the default enrichments will be fetched to skip fetching enrichments, pass an empty array []

authentication Optional Inherited UserSession
credentials Optional Inherited RequestCredentials

A string indicating whether credentials (cookies) will be sent with the request. Used internally for authentication workflows.

fetch Optional Inherited function(input: RequestInfo, init: RequestInit) : Promise<Response>

The implementation of fetch to use. Defaults to a global fetch.

headers Optional Inherited [key: string]: any

Additional Headers to pass into the request.

hideToken Optional Inherited boolean

Prevents the token from being passed in a URL Query param that is saved in browser history. Instead, the token will be passed in POST request body or through X-Esri-Authorization header. NOTE: This will force POST requests in browsers since auth header is not yet supported by preflight OPTIONS check with CORS.

httpMethod Optional Inherited HTTPMethods

The HTTP method to send the request with.

hubApiUrl Optional Inherited string
isPortal Optional Inherited boolean
maxUrlLength Optional Inherited number

If the length of a GET request's URL exceeds maxUrlLength the request will use POST instead.

params Optional Inherited IParams

Additional parameters to pass in the request.

portal Optional Inherited string

Base url for the portal you want to make the request to. Defaults to authentication.portal if authentication exists, otherwise to 'https://www.arcgis.com/sharing/rest'.

portalSelf Optional Inherited IHubRequestOptionsPortalSelf
rawResponse Optional Inherited boolean

Return the raw response

Returns

Promise<IHubContent>
Property Type Notes
isDownloadable boolean

Whether the content is downloadable in the Hub app

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

Content visibility and access control, including groups

publishedDate Date

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

created Inherited number
createdDate Inherited Date

Date the item was created

hubType Inherited HubType

Type of Hub resource

id Inherited string
modified Inherited number
name Inherited string

Generic term for the primary label (title, fullname, username, etc.)

numViews Inherited number
owner Inherited string
size Inherited number
tags Inherited string[]
title Inherited string
type Inherited string
updatedDate Inherited Date

Date the item was last updated

data Optional [key: string]: any

The item data associated w/ most types of content the format of the data depends on the item type

errors Optional IEnrichmentErrorInfo[]

Any errors encountered when indexing or composing the content see https://github.com/ArcGIS/hub-indexer/blob/master/docs/errors.md#response-formatting-for-errors

family Optional HubFamily
groupIds Optional string[]

The ids of any groups that the item 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

itemCategories Optional string[]

Item categories are the original, non-flattened item category strings.

layer Optional Partial<ILayerDefinition>

layer information (geometryType, fields, etc)

layers Optional Array<Partial<ILayerDefinition>>

layer information (geometryType, fields, etc) for related layers in the service

metrics Optional {
visibility:
Visibility | "updateGroups"
}
normalizedType Optional string

The normalized item type (we run normalizeItemType on the item in order to compute this prop)

org Optional Partial<IPortal>

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

orgId Optional string

The owner's organization id

portalDataUrl Optional string

URL of the Portal API data endpoint for the resource

publishedDateSource Optional string

Description of the source of the published date

recordCount Optional number
server Optional Partial<IFeatureServiceDefinition>

service information (currentVersion, capabilities, maxRecordCount etc)

slug Optional string

The content's unique URL slug in the Hub app

structuredLicense Optional IStructuredLicense

The content's structured license info

updateFrequency Optional string
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

categories Optional Inherited string[]
createdDateSource Optional Inherited string

description of what was used for this attribute the item key, e.g. item.created or item.metadata.created_date

culture Optional Inherited string
description Optional Inherited string
documentation Optional Inherited string
extent Optional Inherited number[][]
metadata Optional Inherited any

Additional metadata from a metadata document using a formal or custom schema. For example, item metadata in ArcGIS Online Metadata stored in XML format is parsed into JSON.

portalApiUrl Optional Inherited string

URL of the Portal API endpoint for the resource

portalHomeUrl Optional Inherited string

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

properties Optional Inherited any
protected Optional Inherited boolean
snippet Optional Inherited string
spatialReference Optional Inherited ISpatialReference
summary Optional Inherited string

Content snippet or other summary

thumbnailUrl Optional Inherited string

Fully qualified URL for the item's thumbnail, including current user's token if authenticated and required

typeKeywords Optional Inherited string[]
updatedDateSource Optional Inherited string

description of what was used for this attribute the item key, e.g. item.modified or item.metadata.modified_date

url Optional Inherited string

Function defined in packages/content/src/portal.ts:50