fetchContent
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')
| Property | Type | Notes |
|---|---|---|
| string |
The preferred identifier to use for Hub URLs. This will be either the slug, hubId, or item id. |
|
| boolean |
Whether the content is downloadable in the Hub app |
|
| IItem |
The underlying portal item referenced by this content |
|
{
|
Content visibility and access control, including groups NOTE: this needs to be reconciled with Hub permission system |
|
| Date |
Date the content was published (formal metadata), defaults to the date the content was created |
|
| Inherited | number | |
| Inherited | string | |
| Inherited | number | |
| Inherited | number | |
| Inherited | string | |
| Inherited | number | |
| Inherited | string[] | |
| Inherited | string | |
| Inherited | string | |
| Optional | IActionLink[] |
Optional links to show in the Hub application for this content |
| Optional | IHubAdditionalResource[] |
links to additional resources specified in the formal item metadata |
| Optional | string[] |
Parsed item categories (see parseItemCategories) |
| Optional | HubFamily |
The the family of related types that this content belongs to. |
| Optional | Record<stringunknown> |
Configure which Hub application actions (i.e. create web map) are available for this content |
| 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 |
| Optional | boolean |
Whether or not the layer or table is actually a proxied CSV |
| Optional | Partial<ILayerDefinition> |
Information about the layer referenced by this content (geometryType, fields, etc) |
| Optional | string |
URL of the Portal API endpoint for the resource |
| Optional | string |
URL of the Portal API data endpoint for the resource |
| Optional | string |
URL of the resource's page in the Portal Home application |
| Optional | string |
Description of the source of the published date |
| Optional |
{
|
Info to display about the content's publisher. Follows this fallback pattern:
|
| Optional | string |
Slug that can be used to lookup an entity by something other than it's id |
| Optional | IStructuredLicense |
The content's structured license info |
| Optional | string |
Frequency at which the content is updated |
| Optional |
{
|
definition for content that refers to a client-side layer view |
| Optional Inherited | string | |
| Optional Inherited | string | |
| 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 |
| Optional Inherited | string | |
| Optional Inherited | [key: string]: any |
The portal item's data (if any) |
| Optional Inherited | string | |
| Optional Inherited | string | |
| 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 |
| Optional Inherited | number[][] | |
| Optional Inherited | string[] |
The ids of any groups that the item belongs to |
| Optional Inherited | Array<Partial<ILayerDefinition>> |
Detailed information about the service's layers (geometryType, fields, etc) for related layers in the service |
| Optional Inherited | string | |
| Optional Inherited | any |
The content's formal metadata |
| Optional Inherited | Partial<IPortal> |
The owner's organization (portal) details (id, name, extent, etc) |
| Optional Inherited | string | |
| Optional Inherited | IUser |
The user that owns the item |
| Optional Inherited | any | |
| Optional Inherited | boolean | |
| Optional Inherited | number | null |
The count of records for the layer referenced by this content |
| Optional Inherited | Partial<IFeatureServiceDefinition> |
Information about the service referenced by this content (currentVersion, capabilities, maxRecordCount etc) |
| 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 |
| Optional Inherited | string | |
| Optional Inherited | ISpatialReference | |
| Optional Inherited | any | |
| Optional Inherited | string[] | |
| Optional Inherited | string |
Function defined in packages/common/src/content/fetchContent.ts:203