getItemResource
FunctiongetItemResource(itemId: string, requestOptions: IGetItemResourceOptions): Promise<any>
Fetches an item resource and optionally parses it to the correct format.
Provides JSON parse error protection by sanitizing out any unescaped control characters before parsing that would otherwise cause an error to be thrown.
import { getItemResource } from "@esri/arcgis-rest-portal";
// Parses contents as blob by default
getItemResource("3ef", { fileName: "resource.jpg", ...})
.then(resourceContents => {});
// Can override parse method
getItemResource("3ef", { fileName: "resource.json", readAs: 'json', ...})
.then(resourceContents => {});
// Get the response object instead
getItemResource("3ef",{ rawResponse: true, fileName: "resource.json" })
.then(response => {})
Parameters
Parameter | Type | Notes |
---|---|---|
item | string | |
request | IGetItemResourceOptions |
Returns
Promise<any>