Portal Class

  • Portal
  • class Esri::ArcGISRuntime::Portal

    Represents a view into a portal by a user, either anonymous or with a Credential. More...

    Header: #include <Portal.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::Object, Esri::ArcGISRuntime::Loadable, and Esri::ArcGISRuntime::RemoteResource

    This class was introduced in Esri::ArcGISRuntime 100.0.

    Public Functions

    Portal(const QUrl &url, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)
    Portal(Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)
    Portal(const QUrl &url, bool loginRequired, QObject *parent = nullptr)
    Portal(const QUrl &url, QObject *parent = nullptr)
    Portal(bool loginRequired, QObject *parent = nullptr)
    Portal(QObject *parent = nullptr)
    virtual ~Portal() override
    Esri::ArcGISRuntime::BasemapListModel *basemaps() const
    QString culture() const
    Esri::ArcGISRuntime::BasemapListModel *developerBasemaps() const
    Esri::ArcGISRuntime::PortalGroupListModel *featuredGroups() const
    Esri::ArcGISRuntime::PortalItemListModel *featuredItems() const
    void fetchBasemaps()
    void fetchDeveloperBasemaps()
    void fetchFeaturedGroups()
    void fetchFeaturedItems()
    void fetchHomepageFeaturedContent()
    Esri::ArcGISRuntime::TaskWatcher fetchLicenseInfo()
    void fetchStyles()
    void fetchSymbolSets()
    void findGroups(const Esri::ArcGISRuntime::PortalQueryParametersForGroups &queryParameters)
    void findItems(const Esri::ArcGISRuntime::PortalQueryParametersForItems &queryParameters)
    Esri::ArcGISRuntime::PortalItemListModel *homepageFeaturedContent() const
    bool isLoginRequired() const
    Esri::ArcGISRuntime::PortalInfo *portalInfo() const
    Esri::ArcGISRuntime::PortalUser *portalUser() const
    void setCredential(Esri::ArcGISRuntime::Credential *credential)
    void setCulture(const QString &culture)

    Reimplemented Public Functions

    virtual void cancelLoad() override
    virtual Esri::ArcGISRuntime::Credential *credential() const override
    virtual void load() override
    virtual Esri::ArcGISRuntime::Error loadError() const override
    virtual Esri::ArcGISRuntime::LoadStatus loadStatus() const override
    virtual Esri::ArcGISRuntime::RequestConfiguration requestConfiguration() const override
    virtual void retryLoad() override
    virtual void setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration) override
    virtual QUrl url() const override

    Signals

    void basemapsChanged()
    void developerBasemapsChanged()
    void doneLoading(Esri::ArcGISRuntime::Error error)
    void featuredGroupsChanged()
    void featuredItemsChanged()
    void fetchLicenseInfoCompleted(QUuid taskId, const Esri::ArcGISRuntime::LicenseInfo &licenseInfo)
    void fetchStylesCompleted(Esri::ArcGISRuntime::PortalQueryResultSetForItems *result)
    void fetchSymbolSetsCompleted(Esri::ArcGISRuntime::PortalQueryResultSetForItems *result)
    void findGroupsCompleted(Esri::ArcGISRuntime::PortalQueryResultSetForGroups *result)
    void findItemsCompleted(Esri::ArcGISRuntime::PortalQueryResultSetForItems *result)
    void homepageFeaturedContentChanged()
    void loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)

    Detailed Description

    The Portal class is the main entry point into the API used to work with portals and organization subscriptions. It implements all the operations to interface with the backend ArcGIS REST API. Use Portal to search for items and groups and see the contents of the portal, such as services, layers, and so on.

    Portals allow users and organizations to publish and share content over the web. A portal can support subscriptions which provides organizations a sandboxed area on the portal. The website www.arcgis.com (ArcGIS Online) is an example of a portal.

    Load the portal by calling load before using it.

    This class is not a singleton and returns a new Portal object whenever the constructor is called.

    Organizations

    A Portal may contain multiple organizations. An organization has users in different roles including administrators, publishers, and other users.

    • Administrators can add users to their organization subscriptions and have access to all content within the organization.
    • Publishers within an organization can in addition create hosted services based on data files that they upload.
    • All users can create web maps based on mashing up services that they have access to and can register services running on external servers.

    Content

    Users create and share content that organized into Items. A Portal can contain different types of content items including:

    • Web maps
    • Map services (that can be used as layers in web maps)
    • Applications (that are built around web maps)
    • Data files (that can be uploaded and downloaded)

    Users can choose to keep the content they create private, or share it with other members of the same group, or make content public and accessible to everyone.

    Users and Groups

    A user of the Portal sees the view of the Portal that corresponds to their organization's subscription. This view includes users, groups, and items that belong to the organization or have been shared with them. This view may also include users, groups, and items that are external to the user's organization and have been shared with the user. A Portal can have users who are affiliated with an organization or users who are not.

    Users can create and join groups.

    Portal Constructors

    Constructors are available that take some combination of these parameters.

    • url - The URL of the portal to access. If not present, this defaults to {https://www.arcgis.com/}{www.arcgis.com} (ArcGIS Online).
    • loginRequired - Determines whether the user is asked to log in (optional).
      • Set to false if you intend to access the portal anonymously or true if you want to use a credential.
      • If set to true, an authentication challenge will be issued.
      • If set to false, the portal will be accessed anonymously. If the portal does not permit anonymous access, an authentication challenge will be issued.

      When the credential property is set, the credential will be used regardless of the value of the loginRequired parameter.

    • credential - The credential to use when accessing the portal (optional).
    • parent - The parent QObject (optional).

    Example: Create a portal anonymously:

    Portal* portalAnon = new Portal(QUrl("http://www.arcgis.com"), parent);

    Example: Create and load a portal with a credential:

    Credential* ucPortal = new Credential(myUserName, myPassword, parent);
    Portal* myPortal = new Portal(QUrl(myPortalUrl), ucPortal, parent);
    connect(myPortal, &Portal::doneLoading, this, [](Esri::ArcGISRuntime::Error loadError)
    {
      if (!loadError.isEmpty())
        qDebug() << loadError.message();
    });
    myPortal->load();

    See also PortalUser and PortalGroup.

    Member Function Documentation

    Portal::Portal(const QUrl &url, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)

    Constructor that accepts the parameters url, credential and parent.

    Portal::Portal(Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)

    Constructor that accepts the parameters credential and parent.

    Portal::Portal(const QUrl &url, bool loginRequired, QObject *parent = nullptr)

    Constructor that accepts the parameters url, loginRequired, and parent.

    Portal::Portal(const QUrl &url, QObject *parent = nullptr)

    Constructor that accepts the parameters url and parent.

    Portal::Portal(bool loginRequired, QObject *parent = nullptr)

    Constructor that accepts the parameters loginRequired and parent.

    Portal::Portal(QObject *parent = nullptr)

    Default constructor with optional parent object.

    [signal] void Portal::basemapsChanged()

    Signal emitted when the fetchBasemaps task is completed.

    See also Basemap.

    [signal] void Portal::developerBasemapsChanged()

    Signal emitted when the fetchDeveloperBasemaps task is completed.

    This function was introduced in Esri::ArcGISRuntime 100.12.

    See also Basemap.

    [signal] void Portal::doneLoading(Esri::ArcGISRuntime::Error error)

    Signal emitted when this object is done loading.

    • error - Details about any error that may have occurred.

    See also Loadable and Object.

    [signal] void Portal::featuredGroupsChanged()

    Signal emitted when the fetchFeaturedGroups task is completed.

    See also PortalGroup.

    [signal] void Portal::featuredItemsChanged()

    Signal emitted when the fetchFeaturedItems task is completed.

    See also PortalItem.

    [signal] void Portal::fetchLicenseInfoCompleted(QUuid taskId, const Esri::ArcGISRuntime::LicenseInfo &licenseInfo)

    Signal emitted when the fetchLicenseInfo task is completed.

    • taskId - The task ID of the asynchronous task.
    • licenseInfo - The LicenseInfo for the current user on the portal.

    This function was introduced in Esri::ArcGISRuntime 100.7.

    [signal] void Portal::fetchStylesCompleted(Esri::ArcGISRuntime::PortalQueryResultSetForItems *result)

    Signal emitted when the fetchStyles operation completes.

    The returned PortalQueryResultSetForItems contains the PortalItem objects with styles, and the signal includes the result.

    This function was introduced in Esri::ArcGISRuntime 100.12.

    [signal] void Portal::fetchSymbolSetsCompleted(Esri::ArcGISRuntime::PortalQueryResultSetForItems *result)

    Signal emitted when the fetchSymbolSets operation completes.

    The returned PortalQueryResultSetForItems contains the PortalItem objects with symbol sets, and the signal includes the result.

    This function was introduced in Esri::ArcGISRuntime 100.12.

    [signal] void Portal::findGroupsCompleted(Esri::ArcGISRuntime::PortalQueryResultSetForGroups *result)

    Signal emitted when the findGroups task is completed. The signal includes the result.

    The returned PortalQueryResultSetForGroups object has the Portal as its parent.

    See also Returned QObjects Parenting and PortalQueryResultSetForGroups.

    [signal] void Portal::findItemsCompleted(Esri::ArcGISRuntime::PortalQueryResultSetForItems *result)

    Signal emitted when the findItems task is completed. The signal include the result.

    The returned PortalQueryResultSetForItems object has the Portal as its parent.

    See also Returned QObjects Parenting and PortalQueryResultSetForGroups.

    [signal] void Portal::homepageFeaturedContentChanged()

    Signal emitted when the fetchHomepageFeaturedContent task is completed.

    See also PortalItem.

    [signal] void Portal::loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)

    Signal emitted when the loadStatus changes for this object.

    See also Loadable.

    [override virtual] Portal::~Portal()

    Destructor.

    Esri::ArcGISRuntime::BasemapListModel *Portal::basemaps() const

    Returns the list of portal basemaps.

    See also Basemap and Portal::fetchBasemaps.

    [override virtual] void Portal::cancelLoad()

    Reimplements: Loadable::cancelLoad().

    See Loadable.

    [override virtual] Esri::ArcGISRuntime::Credential *Portal::credential() const

    Reimplements: RemoteResource::credential() const.

    Returns the Credential for this portal.

    This is the security credential to access the remote resource. Only applies if the resource is secured.

    Returns nullptr if no credential has been set.

    See also setCredential().

    QString Portal::culture() const

    Returns the culture code currently in use for this portal.

    Gets a code that specifies the culture-specific formatting to use when accessing portal content.

    The culture code provides localized content when viewing featured groups or items, adding or updating an item, and so on. If not explicitly set, the culture used by the device/machine is used.

    The format for the culture code is based on a language code and a country code, separated by a dash. Example: "en-US".

    This function was introduced in Esri::ArcGISRuntime 100.11.

    See also setCulture().

    Esri::ArcGISRuntime::BasemapListModel *Portal::developerBasemaps() const

    Returns the list of portal developer basemaps.

    This function was introduced in Esri::ArcGISRuntime 100.12.

    See also Basemap and Portal::fetchDeveloperBasemaps.

    Esri::ArcGISRuntime::PortalGroupListModel *Portal::featuredGroups() const

    Returns the list of groups featured for the portal.

    This property will be nullptr until the groups are successfully fetched with the fetchFeaturedGroups method.

    Subsequently it contains PortalGroup objects that are fully populated and have a load status of LoadStatus::Loaded.

    See also PortalGroup.

    Esri::ArcGISRuntime::PortalItemListModel *Portal::featuredItems() const

    Returns the list of items featured for the portal.

    See also PortalItem.

    void Portal::fetchBasemaps()

    Retrieves the set of basemaps available from the portal.

    After the basemaps have been retrieved, the results are available via the basemaps method.

    Example:

    Fetch the basemaps for a portal:

    int basemapsCount = 0;
    connect(portal, &Portal::basemapsChanged, this, [portal, &basemapsCount]()
    {
      if (portal && portal->basemaps())
        basemapsCount = portal->basemaps()->rowCount();
    });
    
    portal->fetchBasemaps();

    See also Basemap, Portal::basemaps, and PortalInfo::basemapGalleryGroupQuery.

    void Portal::fetchDeveloperBasemaps()

    Retrieves a set of developers basemaps available from the portal.

    A Portal instance may contain a set of associated basemaps, called developer basemaps, which are accessible and metered via API keys. These are equivalent to basemaps constructed via a BasemapStyle.

    This function was introduced in Esri::ArcGISRuntime 100.12.

    See also Basemap, Portal::developerBasemaps, and PortalInfo::developerBasemapGalleryGroupQuery.

    void Portal::fetchFeaturedGroups()

    Retrieves the set of featured groups available from the portal.

    After the groups have been retrieved, the results are available via the featuredGroups method.

    See also PortalGroup.

    void Portal::fetchFeaturedItems()

    Retrieves the set of featured items available from the portal.

    After the items have been retrieved, the results are available via the featuredItems method.

    See also PortalItem.

    void Portal::fetchHomepageFeaturedContent()

    Retrieves the set of items featured on the homepage of the portal.

    After the content has been retrieved, the results are available via the homepageFeaturedContent method.

    See also PortalItem.

    Esri::ArcGISRuntime::TaskWatcher Portal::fetchLicenseInfo()

    Executes a portal query that gets the current user's LicenseInfo including the entitlements and extensions.

    The fetchLicenseInfoCompleted signal will emit once the operation is complete, giving access to the resulting LicenseInfo.

    This function was introduced in Esri::ArcGISRuntime 100.7.

    void Portal::fetchStyles()

    Executes a portal query with the PortalInfo::stylesGroupQuery query string.

    This function was introduced in Esri::ArcGISRuntime 100.12.

    void Portal::fetchSymbolSets()

    Executes a portal query with the PortalInfo::symbolSetsGroupQuery query string.

    This function was introduced in Esri::ArcGISRuntime 100.12.

    void Portal::findGroups(const Esri::ArcGISRuntime::PortalQueryParametersForGroups &queryParameters)

    Performs a query to fetch groups matching specified criteria.

    • queryParameters - Definition of the query to be executed.

    After the query has completed, the results are returned via the findGroupsCompleted signal. If the task is unsuccesful, an error is emitted.

    Example:

    Use findGroups to retrieve all of the groups for a portal:

    // example query to return all groups
    QString groupsQuery = "1==1";
    PortalQueryParametersForGroups findGroupsQueryParameters(groupsQuery);
    portal->findGroups(findGroupsQueryParameters);
    
    int numberOfGroups = 0;
    connect(portal, &Portal::findGroupsCompleted, this, [&numberOfGroups](PortalQueryResultSetForGroups* results)
    {
      if (results)
        numberOfGroups = results->totalResults();
    });

    See also PortalQueryParametersForGroups.

    void Portal::findItems(const Esri::ArcGISRuntime::PortalQueryParametersForItems &queryParameters)

    Performs a query to fetch items matching specified criteria.

    • queryParameters - Definition of the query to be executed.

    After the query is complete, the results are returned via the findItemsCompleted signal. If the query task was unsuccessful, an error is emitted.

    Example:

    Use findItems to retrieve web maps with specific tags from a portal:

    // webmaps authored prior to July 2nd, 2014 are not supported
    // so search only from that date to the current time (in milliseconds)
    QString fromDate = QString("000000%1").arg(QDateTime(QDate(2014, 7, 2)).toMSecsSinceEpoch());
    QString toDate = QString("000000%1").arg(QDateTime::currentDateTime().toMSecsSinceEpoch());
    
    PortalQueryParametersForItems query;
    query.setSearchString(QString("tags:\"%1\" AND +uploaded:[%2 TO %3]")
                          .arg(keyword, fromDate, toDate));
    query.setTypes(QList<PortalItemType>() << PortalItemType::WebMap);
    
    m_portal->findItems(query);
    connect(m_portal, &Portal::findItemsCompleted, this, [this](PortalQueryResultSetForItems *webmapResults)
    {
      m_webmapResults = webmapResults;
      m_webmaps = m_webmapResults->itemResults();
      emit webmapsChanged();
      emit hasMoreResultsChanged();
    });

    See also PortalQueryParametersForItems.

    Esri::ArcGISRuntime::PortalItemListModel *Portal::homepageFeaturedContent() const

    Returns the list of items featured on the homepage of the portal.

    See also PortalItem.

    bool Portal::isLoginRequired() const

    Returns whether you may access the portal anonymously or use a Credential.

    [override virtual] void Portal::load()

    Reimplements: Loadable::load().

    See Loadable.

    [override virtual] Esri::ArcGISRuntime::Error Portal::loadError() const

    Reimplements: Loadable::loadError() const.

    See Loadable.

    [override virtual] Esri::ArcGISRuntime::LoadStatus Portal::loadStatus() const

    Reimplements: Loadable::loadStatus() const.

    See Loadable.

    Esri::ArcGISRuntime::PortalInfo *Portal::portalInfo() const

    Returns information about the portal, upon successful initialization of the portal.

    A PortalInfo object represents details of the portal/organization as seen by the current user, anonymous or logged in. If the current user is a member of an organization on this portal, information about the user and organization is included.

    This property will be a nullptr until the portal is loaded.

    Esri::ArcGISRuntime::PortalUser *Portal::portalUser() const

    Returns the registered user of the portal.

    This information is available after successful initialization of the portal with a credential and load completes.

    [override virtual] Esri::ArcGISRuntime::RequestConfiguration Portal::requestConfiguration() const

    Reimplements: RemoteResource::requestConfiguration() const.

    Returns the RequestConfiguration in use by this Portal object.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also setRequestConfiguration().

    [override virtual] void Portal::retryLoad()

    Reimplements: Loadable::retryLoad().

    See Loadable.

    void Portal::setCredential(Esri::ArcGISRuntime::Credential *credential)

    Sets the portal's Credential to credential.

    The Credential is used when calling Portal::load().

    See also credential().

    void Portal::setCulture(const QString &culture)

    Sets the culture code that specifies the culture-specific formatting to use when accessing portal content.

    The culture code provides localized content when viewing featured groups or items, adding or updating an item, and so on. If not explicitly set, the culture used by the device/machine is used. Set it to empty string if you want to see portal content in the language corresponding to the culture set in the portal/organization settings.

    The format for the culture code is based on a language code and a country code, separated by a dash. Example: "en-US".

    This function was introduced in Esri::ArcGISRuntime 100.11.

    See also culture().

    [override virtual] void Portal::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration)

    Reimplements: RemoteResource::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration).

    Sets configuration parameters used for network requests sent by this Portal object to requestConfiguration.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also requestConfiguration().

    [override virtual] QUrl Portal::url() const

    Reimplements: RemoteResource::url() const.

    Returns the URL of the portal. If no URL has been set, it defaults to https://www.arcgis.com (ArcGIS Online).

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.