How to use the @esri/arcgis-rest-portal.getItemData function in @esri/arcgis-rest-portal

To help you get started, we’ve selected a few @esri/arcgis-rest-portal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Esri / arcgis-rest-js / demos / webmap-checker-sapper / src / routes / webmaps / [webmapId].html View on Github external
const { webmapId } = params;

      // if we are on the server we won't have an actuall UserSession just a
      // JSON representation of one. So we need to hydrate a UserSession.
      const userSession = process.browser ? session : new UserSession(session);

      // next we can request both the webmap item and the webmap data (the JSON)
      // and process the data to get a list of layers.
      return Promise.all([
        getItem(webmapId, {
          authentication: userSession
        }).catch(error => {
          return retryWithNewSession(error, this.fetch);
        }),
        getItemData(webmapId, {
          authentication: userSession
        }).catch(error => {
          return retryWithNewSession(error, this.fetch);
        })
      ]).then(([item, webmap]) => {
        const layers = webmap.operationalLayers
          .concat(webmap.baseMap.baseMapLayers)
          .map(layer => {
            return {
              title: layer.title || layer.id,
              url: layer.url,
              itemId: layer.itemId
            };
          });
        return {
          item,
github Esri / arcgis-rest-js / demos / ago-node-cli / lib / item-export-command.js View on Github external
.then((item) => {
      model.item = item;
      if (this.shouldFetchData(item.type)){
        console.info(`...Fetching ./data for item of type ${item.type}`);
        return getItemData(id);
      } else {
        console.info(`...Items of type ${item.type} do not have json ./data - skipping`);
        return Promise.resolve();
      }
    })
    .then((maybeData) => {
github roemhildtg / vscode-arcgis-assistant / src / lib / PortalConnection.ts View on Github external
public async getItem(itemId : string) : Promise{
        const item = await getItem(itemId, {
            portal: this.restURL,
            authentication: this.authentication,
        });
        const itemData = await getItemData(itemId, {
            authentication: this.authentication,
            portal: this.restURL,
        });

        let data;
        if(typeof itemData === 'string'){
            try {
                data = JSON.parse(itemData);
            } catch(e){
                data = itemData;
            }
        } else {
            data = itemData;
        }

        return {item, data};