The gis module provides an information model for GIS hosted within ArcGIS Online or ArcGIS Enterprise, serving as an entry point to the GIS. This module, the most important in the ArcGIS API for Python, provides functionality to manage (create, read, update and delete) GIS users, groups and content. The module allows for access to the GIS services using Python and is an invaluable tool in the API.
GIS
- class arcgis.gis.GIS(url: str | None = None, username: str | None = None, password: str | None = None, key_file: str | None = None, cert_file: str | None = None, verify_cert: bool = True, set_active: bool = True, client_id: str | None = None, profile: str | None = None, **kwargs)
- The - GISclass is representative of a single ArcGIS Online organization or an ArcGIS Enterprise deployment. The- GISobject provides helper objects to manage (search, create, retrieve) GIS resources such as content, users, and groups.- Additionally, the - GISobject has properties to query its state, which is accessible using the properties attribute.- Note - The - GISprovides a mapping widget that can be used in the Jupyter Notebook environment for visualizing GIS content as well as the results of your analysis. To create a new map, call the- mapmethod. IE11 is no longer supported. Please use the latest version of Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Edge.- The constructor constructs a - GISobject given a url and user credentials to ArcGIS Online or an ArcGIS Enterprise portal. User credentials can be passed in using username/password pair, or key_file/cert_file pair (in case of PKI). Supports built-in users, LDAP, PKI, Integrated Windows Authentication (using NTLM and Kerberos) and Anonymous access.- If no url is provided, ArcGIS Online is used. If username/password or key/cert files are not provided, the currently logged-in user’s credentials (IWA) or anonymous access is used. - Persisted profiles for the GIS can be created by giving the GIS authorization credentials and specifying a profile name. The profile stores all of the authorization credentials (except the password) in the user’s home directory in an unencrypted config file named .arcgisprofile. The profile securely stores the password in an O.S. specific password manager through the keyring python module. - Note - Linux systems may need additional software installed and configured for proper security. - Once a profile has been saved, passing the profile parameter by itself uses the authorization credentials saved in the configuration file/password manager by that profile name. Multiple profiles can be created and used in parallel. - See Working with different authentication schemes in the ArcGIS API for Python guide for examples. - Note - Once a connection is made and a GIS object is initialized, you can retrieve the token with the following code: - # Retrieving a token from a GIS object >>> from arcgis.gis import GIS >>> gis = GIS( url="url to Web GIS", username="user_name", password="secure_password" ) >>> token = gis.session.auth.token >>> token '3BMHr9i ... RTxekAdWkSmF9cKQIkM7DLy.' - Parameter - Description - url - Optional string. If URL is None, then the URL will be ArcGIS Online. This should be a web address to either an ArcGIS Enterprise portal or to ArcGIS Online in the form: <scheme>://<fully_qualified_domain_name>/<web_adaptor>. An Enterprise example is formatted in the form: https://gis.example.com/portal - username - Optional string. The login user name (case-sensitive). - password - Optional string. If a username is provided, a password is expected. This is case-sensitive. If the password is not provided, the user is prompted in the interactive dialog. - key_file - Optional string. The file path to a user’s key certificate for PKI authentication - cert_file - Optional string. The file path to a user’s certificate file for PKI authentication. If a PFX or P12 certificate is used, a password is required. If a PEM file is used, the key_file is required. - verify_cert - Optional boolean or string. If a site has an invalid SSL certificate or is being accessed via the IP or hostname instead of the name on the certificate, set this value to - False. This will ensure that all SSL certificate issues are ignored. The default is- True.- Warning - Setting the value to - Falsecan be a security risk.- set_active - Optional boolean. The default is True. If True, the GIS object will be used as the default GIS object throughout the whole scripting session. - client_id - Optional string. Used for OAuth authentication. This is the client ID value. - profile - Optional string. the name of the profile that the user wishes to use to authenticate, if set, the identified profile will be used to login to the specified GIS. - In addition to explicitly named parameters, the GIS object supports optional key word arguments: - kwargs - Description - ca_bundles - list[str], str, or None. Users can pass verify_cert a path to a CA_BUNDLE file or directory with certificates of trusted CAs as well. This will use these certificates over the system’s certificates. The default is None. - proxy_host - (Deprecated, use proxy) Optional string. The host name of the proxy server used to allow HTTP/S access in the network where the script is run. - ex: 127.0.0.1 - use_gen_token - Optional Boolean. The default is False. Uses generateToken login over OAuth2 login. - proxy_port - (Deprecated, use proxy) Optional integer. The proxy host port. The default is 80. - token - Optional string. This is the Enterprise token for built-in logins. This parameter is only honored if the username/password is None and the security for the site uses BUILT-IN security. - Note - A token can be retrieved using gis.session.auth.token. - api_key - Optional string. This is a key generated by the developer site to allow for a limited subset of the REST API functionality. - trust_env - Optional Boolean. Trust environment settings for proxy configuration, default authentication and similar. If False the GIS class will ignore the netrc files defined on the system. - proxy - Optional Dictionary. If you need to use a proxy, you can configure individual requests with the proxy argument to any request method. See - `Usage Example 9: Using a Proxy`for example usage.- Usage Example:
 - {
- “http” : “http://10.343.10.22:111”, “https” : “https://127.343.13.22:6443” 
 - } - expiration - Optional Integer. The default is 60 minutes. The expiration time for a given token. This is used for user provided tokens and API Keys. - validate_url - Optional Boolean. The default is False. A user can choose to validate the URL on an Item’s url. - mutual_authentication - Optional String. Mutual authentication is a security feature in which a client process must prove its identity to a service, and the service must prove its identity to the client, before any application traffic is transmitted over the client/service connection. - REQUIRED - By default, the API will require mutual
- authentication from the server, and if a server emits a non-error response which cannot be authenticated. 
 
- OPTIONAL - This will cause the API to attempt mutual
- authentication if the server advertises that it supports it, and cause a failure if authentication fails, but not if the server does not support it at all. 
 
- DISABLED - Never attempts mutual authentication, this is not
- recommended. 
 
 - force_preemptive - If you are using Kerberos authentication, it can be forced to preemptively initiate the Kerberos GSS exchange and present a Kerberos ticket on the initial request (and all subsequent). By default, authentication only occurs after a 401 Unauthorized response containing a Kerberos or Negotiate challenge is received from the origin server. This can cause mutual authentication failures for hosts that use a persistent connection (eg, Windows/WinRM), as no Kerberos challenges are sent after the initial auth handshake. This behavior can be altered by setting force_preemptive=True. The default is False - hostname_override - Optional String. If communicating with a host whose DNS name doesn’t match its kerberos hostname (eg, behind a content switch or load balancer), the hostname used for the Kerberos GSS exchange can be overridden by setting this value. - delegate - Optional bool. Kerberos supports credential delegation (GSS_C_DELEG_FLAG). To enable delegation of credentials to a server that requests delegation, pass delegate=True. Be careful to only allow delegation to servers you trust as they will be able to impersonate you using the delegated credentials. - # Usage Example 1: Anonymous Login to ArcGIS Online gis = GIS() - # Usage Example 2: Built-in Login to ArcGIS Online gis = GIS(username="someuser", password="secret1234") - # Usage Example 3: Built-in Login to ArcGIS Enterprise gis = GIS(url="http://pythonplayground.esri.com/portal", username="user1", password="password1") - # Usage Example 4: Built-in Login to ArcGIS Enterprise, ignoring SSL errors gis = GIS(url="http://pythonplayground.esri.com/portal", username="user1", password="password1", verify_cert=False) - # Usage Example 5: Anonymous ArcGIS Online Login with Proxy gis = GIS(proxy={'http': 'http://127.0.0.1:8888', 'https': 'http://127.0.0.1:8887'}) - # Usage Example 6: PKI Login to ArcGIS Enterprise, using PKCS12 user certificate gis = GIS(url="https://pkienterprise.esri.com/portal", cert_file="/path/to/mycert.pfx", password="password1") - # Usage Example 7: Login with token (actual token abbreviated for this illustration) gis = GIS(token="3G_e-FSoJdwxBgSA0RiOZg7zJVVqlOG-ENw83UtoUzDdz4 ... _L2aQMrthrEq7vKYBn39HGSc.", referer="https://www.arcgis.com") - # Usage Example 8: Login with API Key (actual token abbreviated for this illustration) gis = GIS(api_key="APKSoJdwxBgSA0RiOZg7zJVVqlOG-ENw83UtoUzDdz4 ... _L2aQMrth39HGSc.", referer="https") - # Usage Example 9: Using a Proxy proxy = { 'http': 'http://10.10.1.10:3128', 'https': 'http://10.10.1.10:1080', } gis = GIS(proxy=proxy) - # Usage Example 10: Using a CA_BUNDLE specifying SSL certificates certs = r"./CA_CERTS/cacert.pem" gis = GIS(profile="your_enterprise_admin_profile", ca_bundles=certs) - # Usage Example 11: Using a CA_BUNDLE specifying multiple SSL certificates certs = [r"./CA_CERTS/cacert.pem", r"./CA_CERTS/cacert2.pem", ..., r"./CA_CERTS/cacertN.pem"] gis = GIS(profile="your_enterprise_admin_profile", ca_bundles=certs) - property api_keys
- The - api_keysproperty returns an instance of- APIKeyManagerobject which allows the User to generate, manage and modify API Keys for controlled application access.- Note - The API Key manager is only available for ArcGIS Online - Returns:
- An - APIKeyManagerobject
 
 - property content
- The - contentproperty is the resource manager for GIS content. See- ContentManagerfor more information.
 - property datastore
- The - datastoreproperty returns the manager for user-managed data store items.- Note - This is only available with ArcGIS Enterprise 10.7+. See - PortalDataStorefor more information.- Returns:
- A - PortalDataStoreobject
 
 - property groups
- The - groupsproperty is resource manager for GIS groups. See- GroupManagerfor more information.
 - property hosting_servers: list
- Provides access to representation of all the services running on the hosting server for an organizational deployment. See ArcGIS Server Services Directory REST API for full explanation. - Returns:
- ArcGIS Online: list of - AGOLServicesDirectoryobjects
- ArcGIS Enterprise and ArcGIS Enterprise on Kubernetes: list of - ServicesDirectoryobjects.
 
 - # Usage Example #1: ArcGIS Online: >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_online_admin_profile") >>> svc_directory_list = gis.hosting_servers >>> for svc_dir in svc_directory_list: >>> print(f"{svc_dir}") < AGOLServicesDirectory @ https://servicesX.arcgis.com/<org_id>/arcgis/rest/services > < AGOLServicesDirectory @ https://tiles.arcgis.com/tiles/<org_id>/arcgis/rest/services > # Usage Example #2: ArcGIS Enterprise: >>> gis = GIS(profile="your_enterprise_admin_profile") >>> for svc_dir in gis.hosting_servers: >>> print(f"{svc_dir}") < ServicesDirectory @ https://example.org_url.com/web_adaptor_name/rest/services > 
 - property languages: list[dict[str, Any]]
- Lists the available languages. - Returns:
- List[Dict[str, Any]] 
 
 - map(location: str | None = None, mode: str = '2D')
- The - mapmethod creates a map widget centered at the declared location with the specified zoom level. If an address is provided, it is geocoded using the GIS’s configured geocoder. Provided a match is found, the geographic extent of the matched address is used as the extent of the map. See- Mapfor more information.- Note - The map widget is only supported within a Jupyter Notebook. IE11 is no longer supported. Please use the latest version of Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Edge. - Parameter - Description - location - Optional string. The address or lat-long tuple of where the map is to be centered. - mode - Optional string of either ‘2D’ or ‘3D’ to specify map mode. Defaults to ‘2D’. - Note - If the Jupyter Notebook server is running over http, you need to configure your ArcGIS Enterprise portal or ArcGIS Online organization to allow your host and port; or else you will run into CORS issues when displaying this map widget. - This can be accomplished by signing into your ArcGIS Enterprise portal or ArcGIS Online organization in a browser, then navigating to: - Organization > Settings > Security > Allow origins > Add > http://localhost:8888 (replace with the host/port you are running on) - # Usage Example >>> gis = GIS(url="http://pythonplayground.esri.com/portal", username="user1", password="password1") >>> gis.map("Durham,NC") 
 - property notebook_server: list['NotebookServer'] | list['AGOLNotebookManager']
- The - notebook_serverproperty provides access to the- NotebookServerregistered with the organization or enterprise. :return: List [NotebookServer]
 - property org_settings
- The portal settings resource is used to return a view of the portal’s configuration as seen by the current users, either anonymous or logged in. Information returned by this resource includes helper services, allowed redirect URIs, and the current configuration for any access notices or information banners. - Parameter - Description - settings - Required Dict. A dictionary of the settings - Fields - Description - anonymousAccessNotice - Dict. A JSON object representing a notice that is shown to your organization’s anonymous users. Ex: {‘title’: ‘Anonymous Access Notice Title’, ‘text’: ‘Anonymous Access Notice Text’, ‘buttons’: ‘acceptAndDecline’, ‘enabled’: True} - authenticatedAccessNotice - Dict. A JSON object representing a notice that is shown to your organization’s authenticated users. Ex: {‘title’: ‘Authenticated Access Notice Title’, ‘text’: ‘Authenticated Access Notice Text’, ‘buttons’: ‘okOnly’, ‘enabled’: True} - informationalBanner - Dict. A JSON object representing the informational banner that is shown at the top of your organization’s page. Ex: {‘text’: ‘Header Text’, ‘bgColor’: ‘grey’, ‘fontColor’: ‘blue’, ‘enabled’: True} - clearEmptyFields - Bool. If True, any empty dictionary will be set to null. - Returns:
- Dictionary indicating ‘success’ or ‘error’ 
 
 - property pages
- The - pagesproperty is the resource manager for a Page of an Enterprise Site. See- pagesfor more information.
 - property properties
- propertiesmanages the actual properties of the GIS object.- To see all the properties that can be found in the GIS object, refer to the portal properties documentation at Portal Properties. - Returns:
- A dictionary-like object called a PropertyMap of the properties of the GIS object. 
 
 - property servers: dict
- Returns the servers registered with ArcGIS Enterprise. For ArcGIS Online, the return value is None. - Returns:
- dict 
 
 - property session: EsriSession
- Provides the raw Esri Session object - Returns:
- An - EsriSessionobject.
 
 - property sites
- The - sitesproperty is the resource manager for Enterprise Sites. See- sitesfor more information.
 - property subscription_information: dict
- Returns the ArcGIS Online Subscription Information for a Site. - Returns:
- dictionary 
 
 - property symbol_service: SymbolService | None
- Symbol service is an ArcGIS Server utility service that provides access to operations to build and generate images for Esri symbols to be consumed by internal and external web applications. - Returns:
- A - SymbolServiceobject or None
 
 - update_properties(properties_dict: dict[str, Any])
- The - update_propertiesmethod updates the GIS’s properties from those in- properties_dict. This method can be useful for updating the utility services used by the GIS.- Parameter - Description - properties_dict - Required dictionary. A dictionary of just those properties and values that are to be updated. - Returns:
- A boolean indicating success (True), or failure (False) 
 - Note - For examples of the property names and key/values to use when updating utility services, refer to the Common parameters page in the ArcGIS REST API. - # Usage Example: Update the geocode service gis = GIS(profile='xyz') upd = {'geocodeService': [{ "singleLineFieldName": "Single Line Input", "name": "AtlantaLocator", "url": "https://some.server.com/server/rest/services/GeoAnalytics/AtlantaLocator/GeocodeServer", "itemId": "abc6e1fc691542938917893c8944606d", "placeholder": "", "placefinding": "true", "batch": "true", "zoomScale": 10000}]} gis.update_properties(upd) 
 - property users
- The - usersproperty is the resource manager for GIS users. See- UserManagerfor more information.
 
Item
- class arcgis.gis.Item(gis, itemid, itemdict=None)
- Bases: - dict- The - Itemclass represents an item in the GIS, where an item is simply considered a unit of content in the GIS. Each item has a unique identifier and a well-known URL that is independent of the user owning the item. For a comprehensive list of properties of an item please see the REST API documentation here . Additionally, each item can have associated binary or textual data that’s available via the item data resource. For example, an item of type Map Package returns the actual bits corresponding to the map package via the item data resource.- Items that have layers (eg FeatureLayerCollection items and ImageryLayer items) and tables have the dynamic - layersand- tablesproperties to get to the individual layers/tables in this item.- add_comment(comment: str)
- The - add_commentmethod adds a comment to an item.- Note - The - add_commentmethod is only available only to authenticated users who have access to the item.- Parameter - Description - comment - Required string. Text to be added as a comment to a specific item. - Returns:
- Comment ID if successful, None if failure occurs. 
 - # Usage Example >>> item.add_comment("Detailed Comment on the Item") 
 - add_relationship(rel_item: Item, rel_type: str)
- The - add_relationshipmethod adds a relationship from the current item to- rel_item.- Note - Note: Relationships are not tied to an item. Instead, they are directional links from an origin item to a destination item and have a type. The type of the relationship defines the valid origin and destination item types as well as some rules. See Relationship types in REST API help for more information. Users don’t have to own the items they relate unless so defined by the rules of the relationship type. - Users can only delete relationships they create. - Relationships are deleted automatically if one of the two items is deleted. - Parameter - Description - rel_item - Required Item object corresponding to the related item. - rel_type - Required string. The type of the related item; is one of [‘Map2Service’, ‘WMA2Code’, ‘Map2FeatureCollection’, ‘MobileApp2Code’, ‘Service2Data’, ‘Service2Service’]. See Relationship Types in the REST API help for more information on this parameter. - Returns:
- A boolean indicating success (True), or failure (False) 
 - # Usage Example >>> item.add_relationship(reL_item=item2, rel_type='Map2FeatureCollection') <True> 
 - property app_info
- The - app_infoproperty is a resource for accessing application information. If the parent item is registered using the register app operation,- app_inforeturns information pertaining to the registered app. Every registered app gets an App ID and App Secret, which are titled client_id and client_secret, respectively, in the terminology of OAuth.- Returns:
 
 - property attachments_size: int | None
- The - attachments_sizeproperty returns the total size of the attachments for the item. The item has to support this property.- Note - The size is returned in bytes. To get the size in megabytes, divide the size by 1024*1024. This is only supported for ArcGIS Online. - Returns:
- The size in bytes. 
 
 - can_reassign(target_user: str | User) tuple[bool, dict[str, Any]]
- Checks if the Item can be reassigned to a new user. Users assigned the default administrator role, or a custom role with administrative privileges, can perform this operation. The item owner can also use this operation; if the item owner that performs this operation is not a default administrator, or assigned a custom role with administrative privileges, they must have the portal:user:reassignItems privilege assigned to them to transfer content to another user. - Parameter - Description - target_user - Required string or - User. The string must be a username value. This will be the user receiving the item.- Returns:
- tuple[bool, dict[str,Any]] 
 
 - property content_status
- The content_status property states if an Item is authoritative or deprecated. This givens owners and administrators of Item the ability to warn users that they should be either this information or not. - Parameter - Description - value - Optional string or None. Defines if an Item is deprecated or authoritative. If a value of None is given, then the value will be reset. - Allowed Values: - authoritative 
- org_authoritative 
- public_authoritative 
- deprecated 
 - Note - See Organization verification for requirements to use public_authoritative status. Also, authoritative will be converted to org_authoritative status. - #Usage Example: Setting status to org_authoritative: >>> gis = GIS(profile="your_organization_profile") >>> dep_item = gis.content.get("<item_id>") >>> dep_item.content_status = "org_authoritative" >>> print(dep_item.content_status) org_authoritative 
 - copy(title: str | None = None, tags: list[str] | str | None = None, snippet: str | None = None, description: str | None = None, layers: list[int] | None = None)
- The - copymethod allows for the creation of an item that is derived from the current Item.- For layers, - copywill create a new item that uses the URL as a reference. For non-layer based items, these will be copied and the exact same data will be provided.- If title, tags, snippet of description is not provided the values from item will be used. The - copymethod can be used in a variety of situations, such as:- Vector tile service sprite customization 
- Limiting feature service exposure 
- Sharing content by reference with groups 
- Creating backup items. 
 - Parameter - Description - title - Optional string. The name of the new item. - tags - Optional list of string. Descriptive words that help in the searching and locating of the published information. - snippet - Optional string. A brief summary of the information being published. - description - Optional string. A long description of the Item being published. - layers - Optional list of integers. If you have a layer with multiple and you only want specific layers, an index can be provided those layers. If nothing is provided, all layers will be visible. - Returns:
- An - Itemobject- **Usage Example** >>> item.copy() <Item title:"gisslideshow - Copy 94452b" type:Microsoft Powerpoint owner:geoguy> >>> item.copy(title="GIS_Tutorial") <Item title:"GIS_Tutorial" type:Microsoft Powerpoint owner:geoguy> >>> item.copy() <Item title:"NZTiles - Copy 021a06" type:Vector Tile Layer owner:geoguy> 
 
 - copy_feature_layer_collection(service_name: str, layers: list[int] | str | None = None, tables: list[int] | str | None = None, folder: str | None = None, description: str | None = None, snippet: str | None = None, owner: str | User | None = None)
- The - copy_feature_layer_collectionmethod allows users to copy existing Feature Layer Collections and select the layers/tables that the user wants in the service. It is quite similar to the- copymethod, but only copies the selected Feature Layer Collections.- Parameter - Description - service_name - Required string. It is the name of the service. - layers - Optional list/string. This is a either a list of integers or a comma seperated list of integers as a string. Each index value represents a layer in the feature layer collection. - tables - Optional list/string. This is a either a list of integers or a comma seperated list of integers as a string. Each index value represents a table in the feature layer collection. - folder - Optional string. This is the name of the folder to place in. The default is None, which means the root folder. - description - Optional string. This is the Item description of the service. - snippet - Optional string. This is the Item’s snippet of the service. It is no longer than 250 characters. - owner - Optional string/User. The default is the current user, but if you want the service to be owned by another user, pass in this value. - Returns:
- If successful, returns an - Itemobject. Otherwise, returns None on failure.
 - # Usage Example >>> item.copy_feature_layer_collection(service_name="service_name", layers="1,4,5,8") 
 - copy_item(*, title: str | None = None, tags: list[str] | str | None = None, folder: str | None = None, include_resources: bool = False, include_private: bool = False)
- The - copy_itemoperation creates a new- Itemthat is a copy of the original- Itemon the server side. It is quite similar to the- copymethod, but only creates a new- Item.- The copy_item method is allowed for the following: - Additionally, there are several caveats to the - copy_itemmethod. First, the new item created by the- copy_itemoperation will have a system generated itemID. Additionally, hosted services are copied as reference only. Reserved keywords, ratings, views, comments and listing properties are reset for the new item. Sharing access of the original item is not preserved and sharing access of new item is set to private. Lastly, relationships and dependencies of the original item are not maintained in the new item.- Note - This method is only available on ArcGIS Online or ArcGIS Enterprise 10.9 or higher - Returns:
- An - Itemobject
 
 - create_thumbnail(update: bool = True)
- The - create_thumbnailmethod creates a Thumbnail for a feature service portal item using the service’s symbology and the print service registered for the enterprise.- Parameter - Description - update - Optional boolean. When set to True, the item will be updated with the thumbnail generated in this call, else it will not update the item. The default is True. - Returns:
- A - DataFileobject
 
 - create_tile_service(title: str, min_scale: float, max_scale: float, cache_info: dict[str, Any] | None = None, build_cache: bool = False, *, extent: list[float] | None = None)
- The - create_tile_servicemethod allows publishers and administrators to publish hosted feature layers and hosted feature layer views as a tile service.- Parameter - Description - title - Required string. The name of the new service. - min_scale - Required float. The smallest scale at which to view data. This is the furthest zoom level out that a layer will display. - Note - This number should be larger than max_scale. - max_scale - Required float. The largest scale at which to view data. This is is the furthest zoom level in that a layer will display. - Note - This number should be less than min_scale. - See Note on scale properties for more information. - cache_info - Optional dictionary defining the tiling scheme. See Map caching for full details, including information on defining a scheme. - Note - If none provided, the cache defaults to the the ArcGIS Online tiling scheme. - build_cache - Required boolean. If not provided, True will be used. - Note - The cache will always be built if in ArcGIS Online. - Returns:
- The Tile Layer - Itemobject if successfully added, None if unsuccessful.
 - # Usage Example >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_organization_profile") >>> flyr_item = gis.content.get("<item id of feature layer>") >>> tile_lyr_item = flyr_item.create_tile_service( >>> title="SeasideHeightsNJTiles", >>> min_scale=36978596, >>> max_scale=9244648 >>> build_cache=True >>> ) 
 - delete(force: bool = False, dry_run: bool = False, permanent: bool = False)
- The - deletemethod deletes the item. If the item is unable to be deleted , a RuntimeException is raised. To know if you can safely delete the item, use the optional parameter ‘dry_run’ in order to test the operation without actually deleting the item.- Parameter - Description - force - Optional boolean. Available in ArcGIS Enterprise 10.6.1 and higher. Force deletion is applicable only to items that were orphaned when a server federated to the ArcGIS Enterprise was removed accidentally before properly unfederating it. When called on other items, it has no effect. - dry_run - Optional boolean. Available in ArcGIS Enterprise 10.6.1 and higher.If True, checks if the item can be safely deleted and gives you back either a dictionary with details. If dependent items are preventing deletion, a list of such Item objects are provided. - permanent - Optional boolean. Available in ArcGIS Online, setting to True will permanently delete the item rather than sending it to the recycle bin. - Returns:
- A boolean indicating success (True), or failure (False). When - dry_runis used, a dictionary containing details of the item is returned.
 - USAGE EXAMPLE: Successful deletion of an item item1 = gis.content.get('itemId12345') item1.delete() >> True - USAGE EXAMPLE: Failed deletion of an item item1 = gis.content.get('itemId12345') item1.delete() >> RuntimeError: Unable to delete item. This service item has a related Service item >> (Error Code: 400) - USAGE EXAMPLE: Dry run to check deletion of an item item1 = gis.content.get('itemId12345abcde') item1.delete(dry_run=True) >> {'can_delete': False, >> 'details': {'code': 400, >> 'message': 'Unable to delete item. This service item has a related Service item', >> 'offending_items': [<Item title:"Chicago_accidents_WFS" type:WFS owner:sharing1>]}} - Note - During the dry run, if you receive a list of offending items, attempt to delete them first before deleting the current item. You can in turn call - dry_runon those items to ensure they can be deleted safely.
 - delete_info(file: str)
- This is available for all items and allows you to delete an individual file from an item’s esriinfo folder. - Parameter - Description - file - Required String. The file to be deleted. 
 - delete_rating()
- The - delete_ratingmethod removes the rating the calling user added for the specified item.
 - delete_relationship(rel_item: Item, rel_type: str)
- The - delete_relationshipmethod deletes a relationship between this item and the rel_item.- Parameter - Description - rel_item - Required Item object corresponding to the related item. - rel_type - Required string. The type of the related item; is one of [‘Map2Service’, ‘WMA2Code’, ‘Map2FeatureCollection’, ‘MobileApp2Code’, ‘Service2Data’, ‘Service2Service’]. See Relationship Types in the REST API help for more information on this parameter. - Returns:
- A boolean indicating success (True), or failure (False) 
 - # Usage Example item.delete_relationship(item2, 'Map2FeatureCollection') 
 - property dependencies
- The - dependenciesproperty returns a class to manage an item’s dependencies.- Returns:
- ItemDependencyobject.
 
 - dependent_to()
- The - dependent_tomethod returns items, urls, etc that are dependent to this item.- Note - This method only available for items in an ArcGIS Enterprise organization. 
 - dependent_upon()
- The - dependent_uponmethod returns items, urls, etc that this item is dependent on.- Note - This method only available for items in an ArcGIS Enterprise organization. 
 - download(save_path: str | None = None, file_name: str | None = None)
- The - downloadmethod downloads the data to the specified folder or a temporary folder, if a folder is not provided.- Parameter - Description - save_path - Optional string. Folder location to download the file to. - file_name - Optional string. The name of the file. - Returns:
- The download path if data was available, otherwise None. 
 - # Usage Example >>> item.download("/path/to/output", "hurricane_data") 
 - download_metadata(save_folder: str | None = None)
- The - download_metadatamethod is similar to the- downloadmethod but only downloads the item metadata for the specified item id. Items with metadata have ‘Metadata’ in their typeKeywords.- Parameter - Description - save_folder - Optional string. Folder location to download the item’s metadata to. - Returns:
- A file path, if the metadata download was successful. None if the item does not have metadata. 
 
 - download_thumbnail(save_folder: str | None = None)
- The - download_thumbnailmethod is similar to the- downloadmethod but only downloads the item thumbnail.- Parameter - Description - save_folder - Optional string. Folder location to download the item’s thumbnail to. - return:
- A file path, If the download was successful. None if the item does not have a thumbnail. 
 
 - export(title: str, export_format: str, parameters: str | None = None, wait: bool = True, enforce_fld_vis: bool | None = None, tags: list[str] | str | None = None, snippet: str | None = None)
- This method exports an - Itemto the format specified in the export_format argument.- Note - Only the item owner or a user with an administrator role can run this method, unless a Location Tracking Service or Location Tracking View is used. - This method is particularly useful for long running exports that could hold up a script since it can be run ansynchronously. - Parameter - Description - title - Required string. The desired name of the exported service item. - export_format - Required string. The format to export the data to. Allowed values: - Shapefile 
- CSV 
- File Geodatabase 
- Feature Collection 
- GeoJson 
- Scene Package 
- KML 
- Excel 
- geoPackage 
- Vector Tile Package 
 - parameters - Optional string. A JSON object describing the layers to be exported and the export parameters for each layer. See the Export Item in the REST API for guidance on structuring the object. - # Usage Example: Parameters object entered as string argument >>> import json >>> from arcgis.gis import GIS >>> flyr_item = gis.content.get("<feature_lyr_item_id>") >>> for flyr in flyr_item.layers: >>> print(f"{flyr.properties.id:<5}{flyr.properties.name}") 0 city_streets 1 city_river_boundary 3 city_parks >>> lyr_obj = { >>> "layers": [ >>> {"id": 3, "designated_owner": "County Parks and Rec"} >>> ] >>> } >>> lyr_str = json.dumps(lyr_obj) >>> export_output = flyr_item.export( >>> .... >>> parameters = lyr_str >>> ) - wait - Optional boolean. Default is True, which forces a wait for the export to complete; use False for when it is okay to proceed while the export continues to completion. - enforce_fld_vis - Optional boolean. Be default all attribute columns are exported. If the operation is in a view, set this value to True to ensure only the view’s columns are exported. When the value is set to False, all data and columns will be exported. - tags - Optional String. A comma seperated value of item descriptors. - snippet - Optional String. A short descriptive piece of text. - Returns:
- An - Itemobject or a dictionary. Item is returned when wait=True. A dictionary describing the status of the item is returned when wait=False. See the- statusmethod for more information.
 - # Usage Example: Export Feature Layer item to csv item >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_online_profile") >>> hurricane_item = gis.content.search( >>> query=f"Hurricane * AND owner:{gis.users.me.username}", >>> type="Feature Layer", >>> max_items=1 >>> )[0] >>> hurrican_csv_item = hurricane_item.export( >>> title="hurricane_src_data_item", >>> export_format="CSV", >>> wait=True, >>> tags="Hurricane, Natural Disasters, source_content" >>> ) 
 - generate_api_token(slot: int = 1, regenerate: bool = False, expiration: datetime | None = None) dict
- Generates a Developer Token from an Developer Token Item. - Parameter - Description - slot - Optional int. API keys support 2 API tokens. The slot allows users to specifiy which API Key to create or regenerate. - regenerate - Optional bool. When True, this will re-create the API token. The default is False. - expiration - Optional datetime.datetime. The time when the expiration expires. The maximum value is 1 year from the time you create the API Key. - Returns:
- dict 
 
 - get_data(try_json: bool = True)
- The - get_datamethod retrieves the data associated with an item.- Note - This call may return different results for different item types: some item types may even return None. See Working with users, groups, and items in the ArcGIS REST API for more information. - Parameter - Description - try_json - Optional string. Default is True. For JSON/text files, if try_json is True, the method tries to convert the data to a Python dictionary (use json.dumps(data) to convert the dictionary to a string), otherwise the data is returned as a string. - Returns:
- Dependent on the content type of the data. For non-JSON/text data, binary files are returned and the path to the downloaded file. For JSON/text files, a Python dictionary or a string. All others will be a byte array, that can be converted to string using data.decode(‘utf-8’). Zero byte files will return None. 
 
 - get_dependencies(deep: bool = False, outside_org: bool = False, out_format: str = 'item')
- Gets the dependencies of the - Item. The method can return the immediate dependencies, meaning other- itemsthe item contains in its structure, or the full deep dependency list, which contains all items that must exist for the item to function, including dependencies of dependencies.- Note - Not all items/item types have dependencies. - Parameter - Description - deep - Optional boolean. - When True, every - itemneeded for the item to exist is contained in the result.
- When False, only immediate dependendencies of the item or those referenced directy within the item’s structure are in the results. Default is False. 
 - outside_org - Optional boolean. - When True, the output list will include items from outside the - GIS. Default is True.
- When False, only items in the same organization as the item are returned. 
 - out_format - Optional string. Determines the format of the output list. Options: - item - results are - Itemobjects
- id, - results are item id strings 
- graph - result is an ~arcgis.apps.itemgraph.ItemGraph object. 
 - Default is item. 
 - get_thumbnail()
- The - get_thumbnailmethod retrieves the bytes that make up the thumbnail for this item.- Returns:
- Bytes that represent the item’s thumbnail. 
 - Example - >>> response = item.get_thumbnail() >>> f = open(filename, 'wb') >>> f.write(response) 
 - get_thumbnail_link()
- The - get_thumbnail_linkmethod is similar to the- get_thumbnailmethod, but retrieves the link to the item’s thumbnail rather than the bytes that make up the thumbnail for this item.- Returns:
- The link to the item’s thumbnail. 
 
 - property item_card: str
- Returns an XML representation of the Item - Returns:
- A string path to the downloaded XML file. 
 
 - property metadata
- The - metadataproperty gets and sets the item metadata for the specified item.- metadatareturns None if the item does not have metadata.- Note - Items with metadata have ‘Metadata’ in their typeKeywords. 
 - move(folder: str | Folder)
- The - movemethod moves the current item to the name of the folder passed when- moveis called.- Parameter - Description - folder - Required string or Folder instance. The name of the folder to move the item to or the Folder class instance representing this folder. Use ‘/’ for the root folder. For other folders, pass in the folder name as a string, or a dictionary containing the folder ID, such as the dictionary obtained from the folders property. - Returns:
- A json object in the following format: { “success”: true | false, “itemId”: “<item id>”, “owner”: “<owner username>”, “folder”: “<folder id>” } 
 - # Usage Example >>> folder = gis.content.folders.get(folder="my folder") >>> item.move(folder) 
 - package_info(folder: str | None = None) str
- Items will have a package info file available only if that item is an ArcGIS package (for example, a layer package or map package). It contains information that is used by clients (ArcGIS Pro, ArcGIS Explorer, and so on) to work appropriately with downloaded packages. Navigating to the URL will result in a package info file (.pkinfo) being downloaded. - Parameter - Description - folder - Optional string. The save location of the pkinfo file. - Returns:
- str 
 
 - protect(enable: bool = True)
- The - protectmethod enables or disables delete protection on this item, essentially allowing the item to be deleted or protecting it from deletion.- Parameter - Description - enable - Optional boolean. Default is True which enables delete protection, False to disable delete protection. - Returns:
- A json object in the following format: {“success”: true | false} 
 
 - property proxies
- The - proxiesproperty gets the ArcGIS Online hosted proxy services, set on a registered app, item with the Registered App type keyword. Additionally, this resource is only available to the item owner and the organization administrator.
 - publish(publish_parameters: dict[str, Any] | None = None, address_fields: dict[str, str] | None = None, output_type: str | None = None, overwrite: bool = False, file_type: str | None = None, build_initial_cache: bool = False, item_id: str | None = None, geocode_service=None, future: bool = False) Item | Future
- The - publishmethod is used to publish a hosted service based on an existing source item (this item). Publishers can then create feature, tiled map, vector tile and scene services. Feature services can be created from input files of various types, including- csv files 
- shapefiles 
- service definition files 
- feature collection files 
- file geodatabase files 
 - CSV files that contain location fields (i.e. address fields or XY fields) are spatially enabled during the process of publishing. Shapefiles and file geodatabases should be packaged as *.zip files. - Tiled map services can be created from service definition (*.sd) files, tile packages, and existing feature services. - Vector tile services can be created from vector tile package (*.vtpk) files. - Scene services can be created from scene layer package (*.spk, *.slpk) files. - Service definitions are authored in ArcGIS Pro or ArcGIS Desktop and contain both the cartographic definition for a map as well as its packaged data together with the definition of the geo-service to be created. - Note - ArcGIS does not permit overwriting if you published multiple hosted feature layers from the same data item. - Note - ArcGIS for Enterprise for Kubernetes does not support publishing service definition files generated by ArcMap. - Parameter - Description - publish_parameters - Optional dictionary. containing publish instructions and customizations. Cannot be combined with overwrite. See Publish Item in the ArcGIS REST API for details. - address_fields - Optional dictionary. A mapping of column names to address fields necessary for geocoding. - output_type - Optional string. - Note - Only used when a Feature Layer - Itemis published as a Tile Layer item.- Options: - overwrite - Optional boolean. If True, the hosted feature service is overwritten. Only available in ArcGIS Enterprise 10.5+ and ArcGIS Online. - file_type - Optional string. Some formats are not automatically detected, when this occurs, the file_type can be specified as one of the below: - serviceDefinition 
- shapefile 
- csv 
- excel 
- tilePackage 
- featureService 
- featureCollection 
- fileGeodatabase 
- geojson 
- scenepackage 
- vectortilepackage 
- imageCollection 
- mapService 
- sqliteGeodatabase 
 - build_initial_cache - Optional boolean. The boolean value. - Default value is False, unless output_type argument is tiles or vectorTiles and publishing to ArcGIS Online. 
- If True and applicable for the file_type, the cache will be built at time of publishing. - Note - Cache will always be built for Tile Layers for ArcGIS Online. 
 - See Map caching for full details on caching. - item_id - Optional string. This parameter allows the desired item id to be specified during creation which can be useful for cloning and automated content creation scenarios. The specified id must be a 32 character GUID string without any special characters. - Note - Available starting at ArcGIS Enterprise 10.8.1. Not available in ArcGIS Online. - If the item_id is already being used, an error will be raised during the process. - geocode_service - Optional Geocoder. When publishing a table of data, an optional Geocoder can be supplied in order to specify which service geocodes the information. If no geocoder is given, the first registered Geocoder is used. - future - Optional Boolean indicating whether to run the operation in an asynchronous manner. When True, the return value is a concurrent.futures.Future object that can be queried for job status and results. The default is False. - Returns:
- When future=False, an - Itemobject corresponding to the published web layer.
- When future=True, a concurrent.futures.Future object whose result() method can be queried for result. 
 
 - # Publishing a Hosted Table Example >>> csv_item = gis.content.get('<csv item id>') >>> analyzed = gis.content.analyze(item=csv_item, file_type='csv') >>> publish_parameters = analyzed['publishParameters'] >>> publish_parameters['name'] = 'AVeryUniqueName' # this needs to be updated >>> publish_parameters['locationType'] = "none" # this makes it a hosted table >>> published_item = csv_item.publish(publish_parameters) - # Publishing a Tile Service Example >>> item.publish( >>> address_fields= { >>> "CountryCode" : "Country" >>> }, >>> output_type="tiles", >>> file_type="CSV", >>> item_id=9311d21a9a2047d19c0faaebd6f2cca6 >>>) - Note - For details on publish_parameters options, see Publish Item in the ArcGIS REST API documentation. 
 - property rating
- Get/Set the rating given by the current user to the item. Set adds a rating to an item to which you have access - Only one rating can be given to an item per user. If this call is made on a currently rated item, the new rating will overwrite the existing rating. A user cannot rate their own item. Available only to authenticated users. - Parameter - Description - value - Required float. The rating to be applied for the item. The value must be a floating point number between 1.0 and 5.0. 
 - reassign_to(target_owner: str | User, target_folder: str | None = None)
- The - reassign_tomethod allows the administrator to reassign a single item from one user to another.- Note - If you wish to move all of a user’s items (and groups) to another user then use the user.reassign_to() method. The - item.reassign_tomethod (this method) only moves one item at a time.- Parameter - Description - target_owner - Required string or - User. The string must be a username value.- target_folder - Optional string. The folder title to move the item to. - Returns:
- A boolean indicating success (True) with the ID of the reassigned item, or failure (False). 
 - # Usage Example >>> item.reassign_to("User1234") 
 - register(app_type: str, redirect_uris: list[str] | None = None, http_referers: list[str] | None = None, privileges: list[str] | None = None, personal_token: bool | None = None)
- The - registermethod registers an app item with the enterprise, resulting in an APPID and APPSECRET (also known as client_id and client_secret in OAuth speak, respectively) being generated for that app. Upon successful registration, a Registered App type keyword gets appended to the app item.- Note - The - registermethod is available to the item owner.- Parameter - Description - app_type - Required string. The type of app that was registered indicating whether it’s a browser app, native app, server app, or a multiple interface app. Values: browser, native, server, or multiple - redirect_uris - Optional list. The URIs where the access_token or authorization code will be delivered upon successful authorization. The redirect_uri specified during authorization must match one of the registered URIs, otherwise authorization will be rejected. - A special value of urn:ietf:wg:oauth:2.0:oob can also be specified for authorization grants. This will result in the authorization code being delivered to a portal URL (/oauth2/approval). This value is typically used by apps that don’t have a web server or a custom URI scheme where the code can be delivered. - The value is a JSON string array. - http_referers - Optional List. A list of the http referrers for which usage of the - APIKeywill be restricted to.- Note - Http Referrers can be configured for non apiKey type apps as well. The list configured here will be used to validate the app tokens sent in while accessing the sharing API. The referrer checks will not be applied to user tokens. - privileges - Optional List. A list of the privileges that will be available for this - APIKey.- Note - Privileges can be configured for non API Key type apps as well. The list configured here will be used to grant access to items when item endpoint is accessed with app tokens. The checks will not be applied to user tokens and they can continue accessing items based on the current item sharing model. With app tokens, all items of app owner can be accessed if the privileges list is not configured. - personal_token - Optional Boolean. When providing privileges that relate to anything regarding operations on a user or administrative privileges, this must be set to true, or else the token will not be generated properly. - Returns:
- A dictionary indicating ‘success’ or ‘error’ 
 - # Usage Example >>> item.register(app_type = "browser", >>> redirect_uris = [ "https://app.example.com", "urn:ietf:wg:oauth:2.0:oob" ], >>> http_referers = [ "https://foo.com", "https://bar.com" ], >>> privileges = ["portal:apikey:basemaps", "portal:app:access:item:itemId", >>> "premium:user:geocode", "premium:user:networkanalysis"] ) 
 - The - related_itemsmethod retrieves the items related to this item. Relationships can be added and deleted using item.add_relationship() and item.delete_relationship(), respectively.- Note - With WebMaps items, relationships are only available on local enterprises. - Parameter - Description - rel_type - Required string. The type of the related item; is one of [‘Map2Service’, ‘WMA2Code’, ‘Map2FeatureCollection’, ‘MobileApp2Code’, ‘Service2Data’, ‘Service2Service’]. See Relationship Types in the REST API help for more information on this parameter. - direction - Required string. One of [‘forward’, ‘reverse’] - Returns:
- The list of related items. 
 - # Usage Example >>> item.related_items("Service2Service", "forward") 
 - remap_data(item_mapping: dict[str, str], force=False, **kwargs)
- Method to help users easily replace data in web maps, applications, and other item types that may contain references to other items. Users pass in a dictionary of item ids specifying the original item id and the item id of the item meant to replace it, and the function will automatically replace the id’s and other associated data with the item. Useful for workflows such as replacing corrupted datasources in an application with valid ones, updating outdated datasources, replacing test data with production data, and more. Can be used by advanced users to replace any string in the item’s structure. - Parameter - Description - item_mapping - Required dict. A dictionary of the items to be remapped. The key is the item id of the original item and the value is the item id of the item meant to replace the original. - Note - This dictionary can also be used for regex replacements of other strings that are in the structure of the item (not just item id’s), but only if the force parameter is set to True. This is only recommended for advanced users with a thorough understanding of their item’s data structure. - force - Optional boolean. If False, the function will check if the item ids in the item_mapping dictionary exist correspond to valid, accessible items item in the GIS, and that all original/replacement item pairs are of matching type. If True, the function will not check and replace all instances of the item_mapping keys with their corresponding values in the item’s data. Default is False, is strongly recommended to remain False unless the user has a specific reason to circumvent item id validation. - Returns:
- A boolean indicating success (True) or failure (False). 
 - # Usage Example 1: Replace web maps within an application storymap = gis.content.get("storyid12345") # say we have a webmap with id 'webmapid12345' and want to replace it with another map_dict = {"webmapid12345": "webmapid67890"} storymap.remap_data(map_dict) # Usage Example 2: Fix a typo everywhere in an item dashboard = gis.content.get("dashboardid12345") # say we realized we've been spelling "arcgis" wrong this whole time repl_dict = {"arkgis": "arcgis"} dashboard.remap_data(repl_dict, force=True) 
 - property resources: ResourceManager
- Returns a ResourceManager object for the - Item- Returns:
- A - ResourceManagerobject
 
 - Deprecated since version 2.3.0: Removed in: 3.0.0. Use Item.sharing instead. - Deprecated since version 2.3.0: Removed in: 3.0.0. Use Item.sharing instead. - The - sharemethod allows you to set the list of groups the Item will be shared with. You can also set the Item to be shared with your org or with everyone(public including org).- Parameter - Description - everyone - Optional boolean. If True, this item will be shared with everyone, meaning that it will be publicly accessible and available to users outside of the organization. If set to False (default), the item will not be shared with the public. - org - Optional boolean. If True, this item will be shared with the organization. If set to False (default), the item will not be shared with the organization. - groups - Optional list of group ids as strings, or a list of arcgis.gis.Group objects. Default is None, don’t share with any specific groups. - allow_members_to_edit - Optional boolean. Set to True when the item will be shared with groups with item update capability so that any member of such groups can update the item that is shared with them. - Returns:
- A dictionary with a key titled “notSharedWith”,containing array of groups with which the item could not be shared as well as “itemId” key containing the item id. 
 - # Usage Example >>> item.share(org = True, allow_members_to_edit = True) 
 - Deprecated since version 2.3.0: Removed in: 3.0.0. Use Item.sharing instead. - Deprecated since version 2.3.0: Removed in: 3.0.0. Use Item.sharing instead. - The - shared_withproperty reveals the privacy or sharing status of the current item. An item can be private or shared with one or more of the following:- A specified list of groups 
- All members in the organization 
- Everyone (including anonymous users). 
 - Note - If the return is False for org, everyone and contains an empty list of groups, then the item is private and visible only to the owner. - Returns:
- A Dictionary in the following format: { ‘groups’: [], # one or more Group objects ‘everyone’: True | False, ‘org’: True | False } 
 
 - property sharing: SharingManager
- The - sharingproperty accesses a- SharingManagerobject to allow users and administrators to control how the current- Itemis shared throughout the- GIS.- Returns:
 - # Usage example: >>> gis = GIS(profile="your_organization_admin_profile") >>> an_item = gis.content.get("<item_id>") >>> sharing_mgr = an_item.sharing >>> sharing_mgr < <item_id> SharingManager > 
 - property snapshots: list
- The - snapshotsproperty provides access to the Notebook Item’s Snapshots. If the user is not the owner of the Item, the snapshots will be an empty list.- Returns:
- List[SnapShot] 
 
 - status(job_id: str | None = None, job_type: str | None = None)
- The statusmethod provides the status of anItemin the following situations:
- 
3. Adding with a multipart upload. Partial is available for Add Item Multipartwhen only a part is uploaded and theItemobject is not committed.
 - Parameter - Description - job_id - Optional string. The job ID returned during publish, generateFeatures, export, and createService calls. - job_type - Optional string. The type of asynchronous job for which the status has to be checked. Default is none, which checks the item’s status. This parameter is optional unless used with the operations listed below. Values: publish, generateFeatures, export, and createService - Returns:
- The status of a publishing - Itemobject.
 - # Usage Example >>> item.status(job_type="generateFeatures") 
- The 
 - unregister()
- The - unregisterproperty removes the application registration from an app Item, along with the Registered App type keyword.- Note - The - unregistermethod is available to the item owner and organization administrators.- Returns:
- A boolean indicating success (True), or failure (False) 
 
 - Deprecated since version 2.3.0: Removed in: 3.0.0. Use Item.sharing instead. - Deprecated since version 2.3.0: Removed in: 3.0.0. Use Item.sharing instead. - The - unsharemethod stops sharing of the Item with the specified list of groups.- Parameter - Description - groups - Optional list of group names as strings, or a list of - Groupobjects, or a comma-separated list of group IDs.- Returns:
- A Dictionary containing the key notUnsharedFrom containing array of groups from which the item could not be unshared. 
 
 - update(item_properties: dict[str, Any] | None | ItemProperties = None, data: str | None = None, thumbnail: str | None = None, metadata: str | None = None)
- The - updatemethod updates an item in a Portal.- Note - The content can be a file (such as a layer package, geoprocessing package, map package) or a URL (to an ArcGIS Server service, WMS service, or an application). - To upload a package or other type of file, a path or URL to the file must be provided in the data argument. - For item_properties, pass in arguments for only the properties you want to be updated. All other properties will be untouched. For example, if you want to update only the item’s description, then only provide the description argument in item_properties. - Parameter - Description - item_properties - Required dictionary. See table below for the keys and values. - data - Optional string, io.StringIO, or io.BytesIO. Either a path or URL to the data or an instance of StringIO or BytesIO objects. - thumbnail - Optional string. Either a path or URL to a thumbnail image. - metadata - Optional string. Either a path or URL to the metadata. - Key:Value Dictionary Options for Argument item_properties - Key - Value - type - Optional string. Indicates type of item, see the link below for valid values. - typeKeywords - Optional string. Provide a lists all sub-types, see the link below for valid values. - description - Optional string. Description of the item. - title - Optional string. Name label of the item. - url - Optional string. URL to item that are based on URLs. - tags - Optional string. Tags listed as comma-separated values, or a list of strings. Used for searches on items. - text - Optional string. For text based items such as Feature Collections & WebMaps - snippet - Optional string. Provide a short summary (limit to max 250 characters) of the what the item is. - extent - Optional string. Provide comma-separated values for min x, min y, max x, max y. - spatialReference - Optional string. Coordinate system that the item is in. - accessInformation - Optional string. Information on the source of the content. - licenseInfo - Optional string. Any license information or restrictions regarding the content. - culture - Optional string. Locale, country and language information. - access - Optional string. Valid values are private, shared, org, or public. - Note - See Items and Item Types in the ArcGIS REST API documentation for more details. - Returns:
- A boolean indicating success (True) or failure (False). 
 - # Usage Example >>> item.update(item_properties = {"description":"Boundaries and infrastructure for Warren County", "title":"Warren County Feature Layer", "tags":"local government, administration, Warren County" }) 
 - update_info(file: str, folder_name: str | None = None)
- You can upload JSON, XML, CFG, TXT, PBF, and PNG files only. The file size limit is 100K. The uploaded file is also available through the https://item-url/info/filename resource. - Must be the owner of the item to update this. - Parameter - Description - file - Required String. The path to the file that will be uploaded. - folder_name - Optional String. The name of the subfolder for added information. - Returns:
- Success or Failure 
 
 - update_thumbnail(file_path: str | None = None, encoded_image: str | None = None, file_name: str | None = None, url: str | None = None) bool
- The update_thumbnail updates the thumbnail of any ArcGIS item in your organization. The updated thumbnail can be provided in a variety of formats, as either a file to be uploaded as part of a multipart request, a direct URL to the thumbnail file, or as a Base64 encoded image. - Parameter - Description - file_path - Optional String. The local path to the thumbnail. - encoded_image - Optional String. A base64 encoded image as a string. - file_name - Optional String. This is required with encoded_image is used. It is the name of the file with extension. Example thumbnail.png - url - Optional String. A URL location of a thumbnail. - # Usage Example 1: Using a base64 encoded image gis = GIS(profile='your_profile') item = gis.content.get(<item id>) base64_img = ( 'data:image/png;base64,' 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAA' 'LEwEAmpwYAAAB1klEQVQ4jY2TTUhUURTHf+fy/HrjhNEX2KRGiyIXg8xgSURuokX' 'LxFW0qDTaSQupkHirthK0qF0WQQQR0UCbwCQyw8KCiDbShEYLJQdmpsk3895p4aS' 'v92ass7pcfv/zP+fcc4U6kXKe2pTY3tjSUHjtnFgB0VqchC/SY8/293S23f+6VEj' '9KKwCoPDNIJdmr598GOZNJKNWTic7tqb27WwNuuwGvVWrAit84fsmMzE1P1+1TiK' 'MVKvYUjdBvzPZXCwXzyhyWNBgVYkgrIow09VJMznpyebWE+Tdn9cEroBSc1JVPS+' '6moh5Xyjj65vEgBxafGzWetTh+rr1eE/c/TMYg8hlAOvI6JP4KmwLgJ4qD0TIbli' 'TB+sunjkbeLekKsZ6Zc8V027aBRoBRHVoduDiSypmGFG7CrcBEyDHA0ZNfNphC0D' '6amYa6ANw3YbWD4Pn3oIc+EdL36V3od0A+MaMAXmA8x2Zyn+IQeQeBDfRcUw3B+2' 'PxwZ/EdtTDpCPQLMh9TKx0k3pXipEVlknsf5KoNzGyOe1sz8nvYtTQT6yyvTjIax' 'smHGB9pFx4n3jIEfDePQvCIrnn0J4B/gA5J4XcRfu4JZuRAw3C51OtOjM3l2bMb8' 'Br5eXCsT/w/EAAAAASUVORK5CYII=' ) res = item.update_thumbnail(encoded_image=base64_img, file_name="thumbnail.png") - # Usage Example 2: URL image gis = GIS(profile='your_profile') item = gis.content.get(<item id>) img_url = "https://www.esri.com/content/dam/esrisites/en-us/common/icons/product-logos/ArcGIS-Pro.png" res = item.update_thumbnail(url=img_url) - # Usage Example 3: Using a local file gis = GIS(profile='your_profile') item = gis.content.get(<item id>) fp = "c:/images/ArcGIS-Pro.png" res = item.update_thumbnail(file_path=fp) - Returns:
- bool 
 
 - usage(date_range: str = '7D', as_df: bool = True)
- Note - The - usagemethod is available for ArcGIS Online Only.- For item owners and administrators, the - usagemethod provides usage details about an item that help you gauge its popularity. Usage details show how many times the item has been used for the time period you select. Historical usage information is available for the past year. Depending on the item type, usage details can include the number of views, requests, or downloads, and the average number of views, requests, or downloads per day.- Views refers to the number of times the item has been viewed or opened. For maps, scenes, non-hosted layers, and web apps, the view count is increased by one when you open the item page or open the item in Map Viewer. For example, if you opened the item page for a map image layer and clicked Open in Map Viewer, the count would increase by two. For other items such as mobile apps, KML, and so on, the view count is increased by one when you open the item; the count does not increase when you open the item details page. - For hosted web layers (feature, tile, and scene), the number of requests is provided instead of views. Requests refers to the number of times a request is made for the data within the layer. For example, someone might open an app that contains a hosted feature layer. Opening the app counts as one view for the application, but multiple requests may be necessary to draw all the features in the hosted layer and are counted as such. - For downloadable file item types such as CSV, SHP, and so on, the number of downloads is displayed. For registered apps, the Usage tab also displays the number of times users have logged in to the app. Apps that allow access to subscriber content through the organization subscription show usage by credits. Additionally, the time frame for the credit usage reporting period can be changed. - Parameter - Description - date_range - Optional string. The default is 7d. This is the period to query usage for a given item. - 24H - Past 24 hours - 7D - Past 7 days (default) - 14D - Past 14 days - 30D - Past 30 days - 60D - Past 60 days - 6M - Past 6 months - 1Y - Past 12 months - (date1,date2) - Tuple of 2 datetime objects defining custom date range - as_df - Optional boolean. Returns a Pandas DataFrame when True, returns data as a dictionary when False - Returns:
- Pandas DataFrame or Dictionary 
 - # Usage Example #1: Standard date_range >>> flyr_item = gis.content.get("8961540a52da402876e0168fa29bb82d") >>> result = flyr_item.usage(date_range = "7D") Date Usage 0 2022-08-05 0 1 2022-08-06 0 2 2022-08-07 0 3 2022-08-08 0 4 2022-08-09 0 5 2022-08-10 0 6 2022-08-11 0 7 2022-08-12 8 # Usage Example #2: Custom date_range >>> import datetime as dt >>> flyr_item = gis.content.get("8961540a52da402876e0168fa29bb82d") >>> date_1 = dt.datetime(2022,7,31) >>> date_2 = dt.datetime.now(2022,8,12) # Early value, later value >>> result = flyr_item.usage(date_range = (date_1, date_2)) >>> result Date Usage 0 2022-07-31 0 1 2022-08-01 0 2 2022-08-02 0 3 2022-08-03 0 4 2022-08-04 0 5 2022-08-05 0 6 2022-08-06 0 7 2022-08-07 0 8 2022-08-08 0 9 2022-08-09 0 10 2022-08-10 0 11 2022-08-11 0 12 2022-08-12 10 
 - property view_manager: ViewManager | None
- If the Item is a Feature Service and a Hosted Service, the Item can have views. This Manager allows users to work with Feature Service to create views - Returns:
- A - ViewManagerobject to administer hosted feature layer view- itemscreated from the hosted feature layer.
 
 
ItemDependency
- class arcgis.gis.ItemDependency(item)
- Bases: - object- Manage, monitor, and control Item dependencies. - Dependencies allow users to better understand the relationships between their organizational items. This class provides the users with the following: - Warnings during item deletion if the deletion is going to break item/layer references in a web map or web application. 
- Ability to explore the dependents and dependencies of a specific item. 
- Administrator ability to efficiently update the URLs of their hosted/federated services in a single edit operation. 
 - When an item is updated, its dependencies are updated as well and always be kept in sync. - Parameter - Description - item - Required Item. Item object to examine dependencies on. - Note - Instances of this class are not created directly. Objects of this type are returned by the - dependenciesproperty on- Itemobjects.- add(depend_type: str, depend_value: str)
- Assigns a dependency to the current item - Parameter - Description - depend_type - Required String. This is the type of dependency that is registered for the item. Allowed values: - table
- url
- itemid
- serverId
 - depend_value - Required string. This is the associated value for the type above. - Returns:
- Boolean 
 
 - remove(depend_type: str, depend_value: str)
- Deletes a dependency to the current item - Parameter - Description - depend_type - Required String. This is the type of dependency that is registered for the item. The allowed values are: table, url, or itemid. - depend_value - Required string. This is the associated value for the type above. - Returns:
- Boolean 
 
 
User
- class arcgis.gis.User(gis, username, userdict=None)
- Bases: - dict- The - Userclass represents a registered user of the GIS system, either ArcGIS Online or ArcGIS Enterprise. The User class has a myriad of properties that are specific to a particular user - these properties are enumerated in the table below.- Property - Details - username - The username of the user. - fullName - The user’s full name - availableCredits - The number of credits available to the user. - assignedCredits - The number of credits allocated to the user. - firstName - The user’s first name. - lastName - The user’s last name. - preferredView - The user’s preferred view for content, either web or GIS. - description - A description of the user. - email - The user’s e-mail address. - idpUsername - The original username if using enterprise logins. - favGroupId - The user’s favorites group and is created automatically for each user. - lastLogin - The last login date of the user in milliseconds since the Unix epoch. - mfaEnabled - Indicates if the user’s account has multifactor authentication set up. - access - Indicates the level of access of the user: private, org, or public. If private, the user descriptive information will not be available to others nor will the username be searchable. - storageUsage The amount of storage used for the entire organization in bytes.- NOTE: This value is an estimate for the organization, not the specific user. For storage estimate of a user’s items, see code example in the - itemsmethod.- storageQuota - The total storage amount available for a deployment or subscription. The maximum amount for ArcGIS Online organizations is 2TB. - orgId - The ID of the organization the user belongs to. - role Defines the user’s role in the organization.- Values:
- org_admin- administrator or custom role with administrative privileges
- org_publisher- publisher or custom role with publisher privileges
- org_user- user or custom role with user privileges)
 
 - privileges - A JSON array of strings with predefined permissions in each. For a complete listing, see Privileges. - roleId - (Optional) The ID of the user’s role if it is a custom one. - level - The level of the user. - disabled - The login access to the organization for the user. - units - User-defined units for measurement. - tags - User-defined tags that describe the user. - culture - The user locale information (language and country). - cultureFormat - The user preferred number and date format defined in CLDR (only applicable for English, Spanish, French, German, and italian: i.e. when culture is en, es, fr, de, or it). - Note - See Languages for supported formats. It will inherit from organization cultureFormat if undefined. - region - The user preferred region, used to set the featured maps on the home page, content in the gallery, and the default extent of new maps in the Viewer. - thumbnail - The file name of the thumbnail used for the user. - created - The date the user was created. Shown in milliseconds since the Unix epoch. - modified - The date the user was last modified. Shown in milliseconds since the Unix epoch. - groups - A list of groups the user belongs to as Group classes. - provider - The identity provider for the organization.<br>Values: arcgis (for built-in users) ,enterprise (for external users managed by an enterprise identity store), facebook (for public accounts in ArcGIS Online), google (for public accounts in ArcGIS Online) - id - (optional) The unique identifier of the user used in ArcGIS Online or ArcGIS Enterprise 10.7+ - property bundles
- The - bundlesmethod provides the current user’s assigned application bundles.- Note - The - bundlesmethod is available in ArcGIS Online and Portal 10.7+.- Returns:
- A List of - Bundleobjects
 
 - delete(reassign_to: str | User = None)
- The - deletemethod deletes this user from the portal, optionally deleting or reassigning groups and items.- Note - You can not delete a user in Portal if that user owns groups or items and/or is assigned an application bundle. If you specify a user in the reassign_to argument, then items and groups will be transferred to that user. If that argument is not set, the method will fail provided the user has items or groups that need to be reassigned. Additionally, see the - reassign_tomethod for more information on reassignment.- Parameter - Description - reassign_to - Optional string. The new owner of the items and groups that belong to the user being deleted. - # Usage Example user.delete(reassign_to="User1234") - Returns:
- A boolean indicating success (True) or failure (False). 
 
 - delete_thumbnail()
- The - delete_thumbnailremoves the thumbnail from the user’s profile.- Returns:
- A boolean indicating success (True) or failure (False). 
 
 - disable()
- The - disablemethod disables login access for the user.- Note - The - disablemethod is only available to the administrator of the organization.- Returns:
- A boolean indicating success (True) or failure (False). 
 
 - download_thumbnail(save_folder: str | None = None)
- The - download_thumbnailmethod downloads the item thumbnail for this user and saves it in the folder that is passed when- download_thumbnailis called.- Parameter - Description - save_folder - Optional string. The desired folder name to download the thumbnail to. - Returns:
- The file path of the downloaded thumbnail. 
 
 - enable()
- The - enablemethod enables login access for the user.- Note - enableis only available to the administrator of the organization.
 - property esri_access
- The - esri_accessproperty will return a string describing the current user’s Esri access. When setting, supply a- booleanto enable or disable- esri_accessfor that- Userobject.- Note - Administrator privileges are required to enable or disable Esri access - A member whose account has Esri access enabled can use My Esri and Community and Forums (GeoNet), access e-Learning on the Training website, and manage email communications from Esri. The member cannot enable or disable their own access to these Esri resources. - Warning - Trial accounts cannot modify esri_access property. - Please see the Enable Esri access section in the Manage members page in ArcGIS Online Resources for more information. - Parameter - Description - value - Required boolean. The current user will be allowed to use the username for other Esri/ArcGIS logins when the value is set to True. If false, the account can only be used to access a given individual’s organization. 
 - expire_password(temporary_password: str | None = None) bool
- Expires the current user’s Password. - Parameter - Description - temporary_password - Optional String. Allows the administrator to set a new temporary password for a given user. This is available on ArcGIS Enterprise Only. - Returns:
- Boolean 
 
 - property folders: Iterator[Folder]
- Creates a generator to iterate over - Folderobjects for the user.- Returns:
- Python generator to iterate over the user’s - folders.- # Example to get a generator >>> gis = GIS(profile="your_web_gis_profile") >>> gis_user = gis.users.me >>> folder_gen = gis_user.folders >>> type(folder_gen) <class 'generator'> >>> for fldr in folder_gen: >>> print(fldr.name) Root Folder Water_Data ... Streets_folder # Example to get a list of dictionary representations for each folder >>> folders_dict_list = [f.properties for f in list(folder_gen)] >>> folders_dict_list [ {'id': 'Root Folder', 'name': 'Root Folder'}, {'username': 'gis_user', 'id': '2e89 ... c26a34018a62', 'title': 'Water_Data', 'created': 1676505498100}, ... {'username': 'gis_user', 'id': 'd2e ... 7edc', 'title': 'air_quality_data', 'created': 1719858924000} ] 
 
 - generate_direct_access_url(store_type: str, expiration: int | None = None, subfolder: str | None = None) dict | None
- The - generate_direct_access_urlmethod creates a direct access URL that is ideal for uploading large files to datafile share, notebook workspaces or raster stores.- Parameter - Description - store_type - Optional String. The type of upload URL to generate. Types: big_data_file, ‘notebook’, or ‘raster`. - expiration - Optional Int. The expiration of the link in minutes. The default is 1440. - subfolder - Optional String. The folder to upload to. The default is None. - Returns:
- A dictionary containing the direct access URL 
 - # Usage Example >>> user.generate_direct_access_url(store_type="notebook") 
 - get_thumbnail()
- The - get_thumbnailmethod returns the bytes that make up the thumbnail for this user.- Returns:
- Bytes that represent the image. 
 - Usage Example: response = user.get_thumbnail() f = open(filename, 'wb') f.write(response) 
 - get_thumbnail_link()
- The get_thumbnail_linkmethod retrieves the URL to the thumbnail image.- Returns:
- The thumbnail’s URL. 
 
 - property groups: list[Group]
- The - groupsproperty retrieves a List of- Groupobjects the current user belongs to.
 - property invitations: UserInvitationManager
- Provides a list of invitations for a given user - Returns:
- UserInvitationManager 
 
 - items(folder: Folder | str = None, max_items: int = 100) Iterator[Item]
- Creates a Python generator for iterating over the - Itemobjects in the specified folder.- Parameter - Description - folder - Optional string or - Folder. The specific folder to create the generator for.- Note - Use the default value of None for Root Folder content. For other folders, either pass in the folder name as a string or as a - Folderobject- max_items - Optional integer. The maximum number of items to be returned. The default is 100. A value of -1 will return all items. - Returns:
- A Python generator for iterating over the - Itemobjects in the specified folder.
 - # Usage Example: Iterate over the generator for the Root Folder >>> gis = GIS(profile="your_web_gis_profile") >>> root_gen = gis.users.me.items() >>> for root_item in root_gen: >>> print(f"{root_item.title:35} {root_item.type}") Local Terrain Vector Tile Service water_features CSV ... subdivision_proposed Feature Service # Usage Example #2: Iterate over items in a specific folder >>> folder_mgr = gis.content.folders >>> water_folder = folder_mgr.get(folder="water_folder") >>> water_items = gis.users.me.items(folder=water_folder) >>> for item in water_items: >>> print(f"{item.title}") swamp_locations drainage_basin ... hydrology_map # Usage Example #3: **Estimate** storage for a user's items >>> org_user = gis.users.get("gis_planner") >>> storage = 0 >>> for fldr in org_user.folders: >>> for fldr_item in org_user.items(folder=fldr): >>> storage += fldr_item.size >>> print(f"User item strage: {storage/1024:10.2f} MB") User item storage: 234758.52 MB 
 - property landing_page: str
- Gets or sets the User’s login page, - Parameter - Description - value - Required string. The values are home, gallery, map, scene, groups, content, or organization - Returns:
- str 
 - # Usage example: Setting login page >>> user1 = gis.users.get("org_data_viewer") # approach 1: set via landing_page >>> user1.landing_page = "map" >>> us = user.user_settings # approach 2: set via user_settings >>> us['landingPage']['url'] = "webmap/viewer.html" >>> user1.user_settings = us 
 - link_account(username: str | User, user_gis: GIS)
- The - link_accountmethod allows a user to link several accounts to gether and share information between them. For example, if you use multiple accounts for ArcGIS Online and Esri websites, you can link them so you can switch between accounts and share your Esri customer information with My Esri, e-Learning, and GeoNet. You can link your organizational, public, enterprise, and social login accounts. Your content and privileges are unique to each account. From Esri websites, only Esri access-enabled accounts appear in your list of linked accounts. See the- unlink_accountmethod for more information on how to unlink linked accounts that have been produced using the- link_accountmethod.- See the Sign in page in ArcGIS Online Resources for addtional information. - Parameter - Description - username - required string/User. This is the username or User object that a user wants to link to. - user_gis - required GIS. This is the GIS object for the username. In order to link an account, a user must be able to login to that account. The GIS object is the entry into that account. - # Usage Example >>> gis = GIS("https://www.arcgis.com", "username1", "password123") >>> user = gis.users.get('username') >>> user.link_account("User1234", gis) - returns: A boolean indicating success (True) or failure (False). 
 - property linked_accounts
- The - linked_accountsmethod retrieves all linked accounts for the current user as- Userobjects- Returns:
- A list of - Userobjects
 
 - property notifications
- The - notificationsproperty retrieves the list of notifications available for the given user.- Returns:
- A list containing available notifications 
 
 - property provisions
- The - provisionsproperty returns a list of all provisioned licenses for the current user.- Note - The - provisions methodis only available in ArcGIS Enterprise 10.7+.- Returns:
- A list contaning provisional licenses 
 
 - reassign_to(target_username: str)
- The - reassign_tomethod reassigns all of this user’s items and groups to another user.- Items are transferred to the target user into a folder named <user>_<folder> where user corresponds to the user whose items were moved and folder corresponds to the folder that was moved. - Note - This method must be executed as an administrator. This method also can not be undone. The changes are immediately made and permanent. - Parameter - Description - target_username - Required string. The user who will be the new owner of the items and groups from which these are being reassigned from. - Returns:
- A boolean indicating success (True) or failure (False). 
 - # Usage Example >>> user.reassign_to(target_username="User1234") 
 - property recyclebin: RecycleBin
- Provides access to the user’s recyclebin. - Note - This functionality is only available for ArcGIS Online. - Returns:
- RecycleBinobject
 - # Usage Example: >>> gis = GIS(profile="your_online_user") >>> my_user_obj = gis.users.me >>> my_recy_bin = my_user_obj.recyclebin >>> type(my_recy_bin) <class 'arcgis.gis._impl._content_manager._recyclebin.RecycleBin'> 
 - report(report_type: str, *, start_time: datetime | None = None, duration: str = 'weekly', time_aggregate: str | None = None) Item
- The reports operation is to generate the reports of the overall usage of the organizations. Reports define organization usage metrics in one place for the day, week, or month. Administrators can monitor who is using which services, consuming how much credits and storage within certain time period. Reports also include current state of the organization such as number of items, groups, users, level 1s vs level 2s, App license assignments and public items. - Parameter - Description - report_type - Required String. The type of organizational report to generate. The allowed arguments are: - credits 
- content (does not honor start_time) 
- users (does not honor start_time) 
- activity 
- serviceUsages 
- itemUsages 
 - start_time - Optional Datetime. The time from which the report generates information. - If duration is weekly, the day component must evaluate to a Sunday or Monday UTC 
- If duration is monthly, the day component must evaluate to the first of the month 
 - Note - Values must be in the UTC timezone. - If argument is not provided: - and duration is either weekly or monthly, the report will generate from the closest Sunday. 
- and duration is daily, the report will generate from the current day/time in UTC. 
 - duration - Optional String. The time frame for which the reports are created. The allowed values are: - monthly 
- weekly 
- daily - only available if report_type is activity 
- yearly 
- quarterly 
 - Note - Argument is required when setting report_type argument to activity or credits. - Note - The yearly value is only available when reportSubType is set to itemUsages. - time_aggregate - Optional String. When the report_type is itemUsages, the records can be aggregated on specific time groups. These are day, week, or month. - # Usage Example #1 >>> import datetime as _dt >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_online_admin_profile") >>> org_users = gis.users.search("*") >>> org_user = org_users[3] >>> sept22 = _dt.datetime(2022, 9, 1, 16) >>> content_report = org_user.report(report_type = "content", start_time = sept22, duration = "monthly") # Usage Example #2 >>> sun_dec10 = _dt.datetime(2023, 12, 10, 17) >>> activity_report = org_user.report(report_type = "activity", start_time = sun_dec10, duration = "weekly") - Returns:
- class:
- A CSV ~arcgis.gis.Item that can be downloaded. 
 
 
 - reset(password: str | None = None, new_password: str | None = None, new_security_question: str | None = None, new_security_answer: str | None = None, reset_by_email: bool = False)
- The - resetmethod resets a user’s password, security question, and/or security answer. If a new security question is specified, a new security answer should be provided.- Note - This function does not apply to those using enterprise accounts that come from an enterprise such as ActiveDirectory, LDAP, or SAML. It only has an effect on built-in users. - Note - To reset the password by email, set reset_by_email to True and password to None. - Parameter - Description - password - Required string. The current password. - new_password - Optional string. The new password if resetting password. - new_security_question - Optional string. The new security question if desired. - new_security_answer - Optional string. The new security question answer if desired. - reset_by_email Optional Boolean. If True, the user will be reset by email. The default is False.- NOTE: Not available with ArcGIS on Kubernetes. - Warning - This function does not apply to those using enterprise accounts that come from an enterprise such as ActiveDirectory, LDAP, or SAML. It only has an effect on built-in users. - Returns:
- A boolean indicating success (True) or failure (False). 
 - # Usage Example >>> user.reset("password123",new_password="passWORD1234",reset_by_email=True) 
 - property resources: ResourceManager
- Returns a ResourceManager object for the - Userto . manage data, tools, or configurations available to the user.- Returns:
- A - ResourceManagerobject.
 
 - property tasks
- The - tasksproperty retrieves the users tasks, effectively serving as sesource manager for user’s tasks. See- TaskManagerfor more information on task managers.
 - transfer_content(target_user: str | User, folder: str | None = None) Future
- This operation transfers all the current user’s content to a new user. This is an asynchronous operation that can take up to 15 minutes to complete. - Parameter - Description - target_user - Required str or User. The user who will received the current user’s content. - folder - Optional str. The folder where the content is stored. - Returns:
- concurrent.futures.Future 
 
 - unlink_account(username: str | User)
- The - unlink_accountmethod allows for the removal of linked accounts when a user wishes to no longer have a linked account. See the- link_accountmethod for more information on how accounts are linked together.- See the Sign in page in ArcGIS Online Resources for addtional information. - Parameter - Description - username - required string/User. This is the username or User object that a user wants to unlink. - # Usage Example >>> user.unlink_account("User1234") - returns: A boolean indicating success (True) or failure (False). 
 - update(access: str | None = None, preferred_view: str | None = None, description: str | None = None, tags: list[str] | str | None = None, thumbnail: str | None = None, fullname: str | None = None, email: str | None = None, culture: str | None = None, region: str | None = None, first_name: str | None = None, last_name: str | None = None, security_question: int | None = None, security_answer: str | None = None, culture_format: str | None = None, categories: list | None = None)
- The - updatemethod updates this user’s properties based on the arguments passed when calling- update.- Note - Only pass in arguments for properties you want to update. All other properties will be left as they are. If you want to update the description, then only provide the description argument. - When updating the security question, you must provide a security_answer as well. - Parameter - Description - access - Optional string. The access level for the user, values allowed are private, org, public. - preferred_view - Optional string. The preferred view for the user, values allowed are Web, GIS, null. - description - Optional string. A description of the user. - tags - Optional string. Tags listed as comma-separated values, or a list of strings. To remove tags, pass in an empty string or list. - thumbnail - Optional string. The path or url to a file of type PNG, GIF, or JPEG. Maximum allowed size is 1 MB. - fullname - Optional string. The full name of this user, only for built-in users. - email - Optional string. The e-mail address of this user, only for built-in users. - culture - Optional string. The two-letter language code, fr for example. - region - Optional string. The two-letter country code, FR for example. - first_name - Optional string. User’s first name. - last_name - Optional string. User’s first name. - security_question - Optional integer. The is a number from 1-14. The questions are as follows: - What city were you born in? 
- What was your high school mascot? 
- What is your mother’s maden name? 
- What was the make of your first car? 
- What high school did you got to? 
- What is the last name of your best friend? 
- What is the middle name of your youngest sibling? 
- What is the name of the street on which your grew up? 
- What is the name of your favorite fictional character? 
- What is the name of your favorite pet? 
- What is the name of your favorite restaurant? 
- What is the title of your facorite book? 
- What is your dream job? 
- Where did you go on your first date? 
 - Usage Example: - security_question=13 - security_answer - Optional string. This is the answer to security question. If you are changing a user’s question, an answer must be provided. - Usage example: - security_answer=”Working on the Python API” - culture_format - Optional String. Specifies user-preferred number and date format - categories - Optional List[str]. A list of category names. - example: - `categories = ["category11", "category12"]`- Returns:
- A boolean indicating success (True) or failure (False). 
 - # Usage Example >>> user.update(description="Aggregated US Hurricane Data", tags = "Hurricanes,USA, 2020") 
 - update_level(level: int)
- The - update_levelallows administrators of an organization to update the level of a user. Administrators can leverage two levels of membership when assigning roles and privileges to members. Membership levels allow organizations to control access to some ArcGIS capabilities for some members while granting more complete access to other members.- Note - Level 1 membership is designed for members who need privileges to view and interact with existing content, while Level 2 membership is for those who contribute, create, and share content and groups, in addition to other tasks. - Maximum user quota of an organization at the given level is checked before allowing the update. - Built-in roles including organization administrator, publisher, and user are assigned as Level 2, members with custom roles can be assigned as Level 1, 1PlusEdit, or Level 2. - Level 1 membership allows for limited capabilities given through a maximum of 8 privileges: portal:user:joinGroup, portal:user:viewOrgGroups, portal:user:viewOrgItems, portal:user:viewOrgUsers, premium:user:geocode, premium:user:networkanalysis, premium:user:demographics, and premium:user:elevation. If updating the role of a Level 1 user with a custom role that has more privileges than the eight, additional privileges will be disabled for the user to ensure restriction. - Note - Level 1 users are not allowed to own any content or group which can be reassigned to other users through the Reassign Item and Reassign Group operations before downgrading them. The operation will also fail if the user being updated has got licenses assigned to premium apps that are not allowed at the targeting level. - Parameter - Description - level - Required int. The values of 1 or 2. This is the user level for the given user. - 1 - View only 
- 2 - Content creator 
 - Returns:
- A boolean indicating success (True) or failure (False). 
 - # Usage Example >>> user.update_level(2) 
 - update_license_type(user_type: str)
- The - update_license_typemethod is primarily used to update the user’s licensing type. This allows administrators to change a user from a creator to a viewer or any other custom user license type.- Note - The - update_license_typemethod is available in ArcGIS Online and Portal 10.7+.- Parameter - Description - user_type - Required string. The user license type to assign a user. - Built-in Types: creator or viewer - Returns:
- A boolean indicating success (True) or failure (False). 
 
 - update_role(role: str)
- The - update_rolemethod updates this user’s role to org_user, org_publisher, org_admin, viewer, view_only, viewplusedit, or a custom role.- Note - There are four types of roles in Portal - user, publisher, administrator and custom roles. A user can share items, create maps, create groups, etc. A publisher can do everything a user can do and additionally create hosted services. An administrator can do everything that is possible in Portal. A custom roles privileges can be customized. - Parameter - Description - role - Required string. Value must be either org_user, org_publisher, org_admin, viewer, view_only, viewplusedit or a custom role object (from gis.users.roles). - Returns:
- A boolean indicating success (True) or failure (False). 
 
 - property user_settings: dict
- Get/set the current user’s settings that are defined in the user profile. - Parameter - Description - value - Required dict. The landingPage and appLauncher settings. - Returns:
- dict 
 - # Usage example: Getting the current user settings >>> us = user.user_settings # similar to setting the landing_page property >>> us['landingPage']['url'] = "webmap/viewer.html" >>> user1.user_settings = us 
 
Group
- class arcgis.gis.Group(gis, groupid, groupdict=None)
- Bases: - dict- The - Groupclass is an object that represents a group within the GIS, either ArcGIS Online or ArcGIS Enterprise.- add_users(usernames: list[str] | str | None = None, admins: list[str] | str | None = None)
- The - adds_usersmethod adds users to this group.- Note - The - add_usersmethod will only work if the user for the Portal object is either an administrator for the entire Portal or the owner of the group.- Parameter - Description - usernames - Optional list of strings or single string. The list of usernames or single username to be added. - admins - Optional List of String, or Single String. This is a list of users to be an administrator of the group. - Returns:
- A dictionary containing the users that were not added to the group. 
 - # Usage Example >>> group.add_users(usernames=["User1234","User5678"], admins="Admin9012") 
 - application(user: str)
- The - applicationmethod retrieves one group application for the given group.- Parameter - Description - user - Required String. The username of the user applying to join the group. - Note - The - applicationmethod is available to administrators of the group or administrators of an organization if the group is part of one.
 - property applications
- The - applicationsproperty retrieves the group applications for the given group as a list.- Note - The - applicationsmethod is available to administrators of the group or administrators of an organization if the group is part of one.
 - property categories
- The - categoriesproperty serves as the category manager for groups. See- CategorySchemaManagerfor more information on category managers.
 - content(max_items: int = 1000)
- The - contentmethod retrieves the list of items shared with this group.- Parameter - Description - max_items - Required integer. The maximum number of items to be returned, defaults to 1000. - Returns:
- The list of items that are shared. 
 
 - delete()
- The - deletemethod deletes this group permanently.- Returns:
- A boolean indicating success (True) or failure (False). 
 
 - delete_group_thumbnail()
- The - delete_group_thumbnailmethod deletes the group’s thumbnail.- Returns:
- A boolean indicating success (True) or failure (False). 
 
 - download_thumbnail(save_folder: str | None = None)
- The - download_thumbnailmethod downloads the item thumbnail for this user and saves it in the folder that is passed when- download_thumbnailis called.- Parameter - Description - save_folder - Optional string. The file path to where the group thumbnail will be downloaded. - Returns:
- The file path to which the group thumbnail is downloaded. 
 
 - get_members()
- The - get_membersmethod retrieves the members of this group.- Key - Value - owner - The group’s owner (string). - admins - The group’s admins (list of strings). Typically this is the same as the owner. - users - The members of the group (list of strings). - Returns:
- A dictionary with keys: owner, admins, and users. 
 - # Usage Example: To print users in a group response = group.get_members() for user in response['users'] : print(user) 
 - get_thumbnail()
- The - get_thumbnailmethod retrieves the bytes that make up the thumbnail for this group.- Returns:
- Bytes that represent the image. 
 - Example - response = group.get_thumbnail() f = open(filename, 'wb') f.write(response) 
 - get_thumbnail_link()
- The - get_thumbnail_linkmethod retrieves the URL to the thumbnail image.- Returns:
- A URL linked to the thumbnail image. 
 
 - property homepage
- The - homepagemethod retrieves the URL to the HTML page for the group.- Returns:
- A URL linking to the group HTML page. 
 
 - invite_users(usernames: list[str], role: str = 'group_member', expiration: int = 10080)
- The - invite_usersmethod invites existing users to this group.- Note - The user executing the - invite_userscommand must be the owner of the group.- Parameter - Description - usernames - Required list of strings. The users to invite. - role - Optional string. Either group_member (the default) or group_admin. - expiration - Optional integer. Specifies how long the invitation is valid for in minutes. Default is 10,080 minutes (7 days). - Note - A user who is invited to this group will see a list of invitations in the “Groups” tab of Portal listing invitations. The user can either accept or reject the invitation. - Returns:
- A boolean indicating success (True) or failure (False). 
 - # Usage Example >>> group.invite_users(usernames=["User1234","User5678"], role="group_admin") 
 - join()
- Users apply to join a group using the - joinoperation. This creates a new group application, which the group administrators accept or decline. This operation also creates a notification for the user indicating that they have applied to join this group.- Note - Available only to authenticated users. Users can only apply to join groups to which they have access - if the group is private, users will not be able to find it to ask to join it. - Information pertaining to the applying user, such as their full name and username, can be sent as part of the group application. - Returns:
- A boolean indicating success (True) or failure (False). 
 
 - leave()
- The - leavemethod removes the logged in user from this group.- Note - The user must be logged in to use the - leavecommand.- Returns:
- A boolean indicating success (True) or failure (False). 
 
 - property migration
- The - migrationproperty accesses a- GroupMigrationManagerobject which has methods for exporting and importing supported- groupcontent between ArcGIS Enterprise organizations.- Note - Functionality only available for ArcGIS Enterprise. - #Usage Example: Initializing a ``GroupMigrationManager`` object: >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_enterprise_admin_profile") >>> source_grp = gis.groups.get("<group_id>") >>> grp_mig_mgr = source_grp.migration >>> type(grp_mig_mgr) arcgis.gis.GroupMigrationManager 
 - notify(users: list[str] | list[User], subject: str, message: str, method: str = 'email', client_id: str | None = None)
- The - notifymethod creates a group notification that sends a message to all users within the group.- Parameter - Description - users - Required List. A list of users or user names. - subject - Required String. The subject of the notification. - message - Required String. The message body that will be sent to the group’s users. - method - Optional String. This is the form for which users will be contacted. The allowed values are: email, push, and builtin. - email - sent a message via smtp. 
- push - pushes a message out. 
- builtin - creates a user notification. 
 - client_id - Optional String. The client id of the application for the push operation. - Returns:
- A boolean indicating success (True), or failure (False). 
 - # Usage Example >>> group.notify(users=["User1234"], subject= "Test Message", message="Testing the notification system", >>> method="email" 
 - property protected
- Indicates if the group is protected from deletion. - Parameter - Description - value - Required bool. Values: True (protect group) | False (unprotect) - Returns:
- True if group currently protected, False if unprotected 
 
 - reassign_to(target_owner: str | User)
- The - reassign_tomethod reassigns this group from its current owner to another owner.- Parameter - Description - target_owner - Required string or User. The username of the new group owner. - Returns:
- A boolean indicating success (True) or failure (False). 
 
 - remove_users(usernames: list[str] | str)
- The - remove_usersmethod is used to remove users from this group.- Parameter - Description - usernames - Required list of usernames. - Returns:
- A dictionary with a key notRemoved whose value is a list of usernames not removed. 
 - # Usage example >>> from arcgis.gis import GIS >>> # initialize the gis object with profile which has the privilege to remove a user >>> gis = GIS(profile="your_online_admin_profile") or gis = GIS(profile="your_ent_admin_profile") >>> grp = gis.content.get('groupid') >>> grp.get_members() {'owner': 'test_user', 'admins': ['test_user', 'test_user2'], 'users': ['test_user', 'test_user2', 'test_user3', 'test_user4']} >>> # in the dictionary above, the key "users" value is a list of usernames who are members of the group >>> grp.remove_users(['test_user3','test_user4']) {notRemoved:[]} >>> grp.get_members() {'owner': 'test_user', 'admins': ['test_user', 'test_user2'], 'users': ['test_user', 'test_user2']} 
 - search(query: str, return_count: bool = False, max_items: int = 100, bbox: list[str] | str | None = None, categories: str | None = None, category_filter: str | None = None, start: int = 1, sort_field: str = 'title', sort_order: str = 'ASC', as_dict: True = False)
- The - searchoperation allows users to find content within the specific group.- Parameter - Description - query - Required String. The search query. When the search filters contain two or more clauses, the recommended schema is to have clauses separated by blank, or AND, e.g. - Usage Example:
 - group.search(query=’owner:USERNAME type:map’) # or group.search(query=’type:map AND owner:USERNAME’) - When the clauses are separated by comma, the filtering condition for owner should not be placed at the first position, e.g. group.search(query=’type:map, owner:USERNAME’) is allowed, while group.search(query=’owner:USERNAME, type:map’) is not. For more, please check https://developers.arcgis.com/rest/users-groups-and-items/search-reference.htm - bbox - Optional String/List. This is the xmin,ymin,xmax,ymax bounding box to limit the search in. Items like documents do not have bounding boxes and will not be included in the search. - categories - Optional String. A comma separated list of up to 8 org content categories to search items. Exact full path of each category is required, OR relationship between the categories specified. - Each request allows a maximum of 8 categories parameters with AND relationship between the different categories parameters called. - category_filters - Optional String. A comma separated list of up to 3 category terms to search items that have matching categories. Up to 2 category_filters parameter are allowed per request. It can not be used together with categories to search in a request. - start - Optional Int. The starting position to search from. This is only required if paging is needed. - sort_field - Optional String. Responses from the search operation can be sorted on various fields. avgrating is the default. - sort_order - Optional String. The sequence into which a collection of records are arranged after they have been sorted. The allowed values are: asc for ascending and desc for descending. - as_dict - Required Boolean. If True, the results comes back as a dictionary. The result of the method will always be a dictionary but the results key in the dictionary will be changed if set to False. - Returns:
- List of - Itemobjects
 - # Usage Example >>> group.search("Hurricane Data", category_filters =["Natural_Disasters", "Hurricanes", "USA"]) 
 - update(title: str | None = None, tags: list[str] | str | None = None, description: str | None = None, snippet: str | None = None, access: str | None = None, is_invitation_only: bool | None = None, sort_field: str | None = None, sort_order: str | None = None, is_view_only: bool | None = None, thumbnail: str | None = None, max_file_size: int | None = None, users_update_items: bool = False, clear_empty_fields: bool = False, display_settings: str | None = None, is_open_data: bool = False, leaving_disallowed: bool = False, member_access: bool = None, hidden_members: bool = False, membership_access: str | None = None, autojoin: bool = False, **kwargs)
- The - updatemethod updates the group’s properties with the values supplied for particular arguments.- Note - If a value is not supplied for a particular argument, the corresponding property will not be updated. - Parameter - Description - title - Optional string. The new name of the group. - tags - Optional string. A comma-delimited list of new tags, or a list of tags as strings. To remove tags, pass in an empty string or list. - description - Optional string. The new description for the group. - snippet - Optional string. A new short snippet (<250 characters) that summarizes the group. - access - Optional string. Choices are private, public, or org. - is_invitation_only - Optional boolean. Defines whether users can join by request. True means an invitation is required. - sort_field - Optional string. Specifies how shared items with the group are sorted. - sort_order - Optional string. Choices are asc or desc for ascending or descending, respectively. - is_view_only - Optional boolean. Defines whether the group is searchable. True means the group is searchable. - thumbnail - Optional string. URL or file location to a new group image. - max_file_size - Optional integer. This is the maximum file size allowed be uploaded/shared to a group. Default value is: 1024000 - users_update_items - Optional boolean. Members can update all items in this group. Updates to an item can include changes to the item’s description, tags, metadata, as well as content. This option can’t be disabled once the group has been created. Default is False. - clear_empty_fields - Optional Boolean. If True, the user can set values to empty string, else, None values will be ignored. - display_settings - Optional String. Defines the default display for the group page to show a certain type of items. The allowed values are: apps, all, files, maps, layers, scenes, tools. The default value is all. - is_open_data - Optional Boolean. Defines whether the group can be used in the Open Data capabilities of ArcGIS Hub. The default is False. - leaving_disallowed - Optional boolean. Defines whether users are restricted from choosing to leave the group. If True, only an administrator can remove them from the group. The default is False. - hidden_members - Optional Boolean. Only applies to org accounts. If true, only the group owner, group managers, and default administrators can see all members of the group. - membership_access - Optional String. Sets the membership access for the group. Setting to org restricts group access to members of your organization. Setting to collaboration restricts the membership access to partnered collaboration and your organization members. If None set, any organization will have access. None is the default. - Values: org, collaboration, or None - Keyword Arguments: - autojoin - Optional Boolean. The default is False. Only applies to org accounts. If True, this group will allow joined without requesting membership approval. - Returns:
- A boolean indicating success (True) or failure (False). 
 - # Usage Example >>> user.update(description="Aggregated US Hurricane Data", tags = "Hurricanes,USA, 2020") 
 - update_users_roles(managers: list[User] | None = None, users: list[User] | None = None) list
- The - update_users_rolesupgrades a set of users to become either Group Members or Group Managers.- Parameter - Description - managers - Required List. A comma-separated array of User objects to upgrade to a group manager role. - users - Required List. A comma-separated array of User objects to make group member roles. - Returns:
- List[dictionary] 
 
 
CloningJob
- class arcgis.gis.clone.CloningJob(future: Future, task: str = 'Group')
- Bases: - object- This class was not designed to be initialized directly, but rather instances are returned by the - clone()method on a- GroupManagerobject.- # Usage Example: Cloning groups from one organization deployment to another >>> from arcgis.gis import GIS >>> source_gis = GIS(profile="your_online_admin_profile") >>> target_gis = GIS(profile="your_enterprise_admin_profile") >>> source_groups = source_gis.groups.search("Research *") >>> source_groups [<Group title:"Water Research a4" owner:gis_user>, <Group title:"Research tests" owner:gis_user>, <Group title:"Research items" owner:gis_user>] >>> target_clone_jobs = target_gis.groups.clone(groups=[source_groups]) >>> target_clone_jobs [< Group Cloning Job: True >, < Group Cloning Job: True >, < Group Cloning Job: True >] - cancel() bool
- Cancels the - CloningJobjob.
 - property cancelled: bool
- Returns boolean value indicating whether the status of the - CloningJobis cancelled.
 - property running: bool
- Returns whether a - CloningJobis currently in the running state.
 - property status: bool
- Returns the current state of the - CloningJobjob.
 
Datastore
- class arcgis.gis.Datastore(datastore, path)
- Bases: - dict- The - Datastoreclass represents a data store, either a folder, database or bigdata fileshare on a- Serverwithin the Enterprise. See- Datastorefor more information on data stores on a server.- property datasets
- The - datasetsproperty retrieves the datasets in the data store, returning them as a dictionary (currently implemented for big data file shares).- Returns:
- A dictionary 
 
 - delete()
- The - deletemethod unregisters this data item from the datastore.- # Usage Example >>> datastore.delete() - Returns:
- A boolean indicating success (True) or failure (False). 
 
 - property manifest
- The - manifestproperty retrieves or sets the manifest resource for bigdata fileshares, as a dictionary.
 - property ref_count
- The - ref_countproperty gets the total number of references to this data item that exists on the server. This property can be used to determine if this data item can be safely deleted or taken down for maintenance.
 - regenerate()
- The - regeneratemethod is used to regenerate the manifest for a big data file share. You can regenerate a manifest if you have added new data or if you have uploaded a hints file using the edit resource.- Returns:
- A boolean indicating success (True), or failure (False) 
 
 
Role
- class arcgis.gis.Role(gis, role_id, role)
- Bases: - object- The - Roleclass is used to represent a role in a GIS, either ArcGIS Online or ArcGIS Enterprise.- delete()
- The - deletemethod is called to deletes the current role.- # Usage Example >>> role.delete() - Returns:
- A boolean indicating success (True) or failure (False). 
 
 - property privileges
- The - privilegesmethod retrieves and sets the privileges for the custom role as a list of strings.- Administrator Privileges: - Members - Privilege - Description - portal:admin:viewUsers - Grants the ability to view full member account information within organization. - portal:admin:updateUsers - Grants the ability to update member account information within organization. - portal:admin:deleteUsers - Grants the ability to delete member accounts within organization. - portal:admin:inviteUsers - Grants the ability to invite members to organization. - portal:admin:disableUsers - Grants the ability to enable and disable member accounts within organization. - portal:admin:changeUserRoles - Grants the ability to change the role a member is assigned within the organization. However, it does not grant the ability to promote or demote a member from the Administrator role. That privilege is reserved for the Administrator role alone. - portal:admin:manageLicenses - Grants the ability to assign licenses to members of organization. - portal:admin:updateMemberCategorySchema - Grants the ability to configure categories for members. - Groups - Privilege - Description - portal:admin:viewGroups - Grants the ability to view all groups within organization. - portal:admin:updateGroups - Grants the ability to update groups within organization. - portal:admin:deleteGroups - Grants the ability to delete groups within organization. - portal:admin:reassignGroups - Grants the ability to reassign groups to other members within organization. - portal:admin:assignToGroups - Grants the ability to assign members to, and remove members from groups within organization. - portal:admin:manageEnterpriseGroups - Grants the ability to link group membership to an enterprise group. - portal:admin:createUpdateCapableGroup - Grants the ability to create a group with update capabilities. - Content - Privilege - Description - portal:admin:viewItems - Grants the ability to view all content within organization. - portal:admin:updateItems - Grants the ability to update content within organization. - portal:admin:deleteItems - Grants the ability to delete content within organization. - portal:admin:reassignItems - Grants the ability to reassign content to other members within organization. - portal:admin:shareToGroup - Grants the ability to share other member’s content to groups the user belongs to. - portal:admin:shareToOrg - Grants the ability to share other member’s content to organization. - portal:admin:shareToPublic - Grants the ability to share other member’s content to all users of the portal. - portal:admin:updateItemCategorySchema - Grants the ability to create and update content categories in the organization. - Webhooks (ArcGIS Enterprise only) - Privilege - Description - portal:admin:manageWebhooks - Grant the ability to create, edit, delete and manage all webhooks within the organization. - ArcGIS Marketplace Subscriptions (ArcGIS Online only) - Privilege - Description - marketplace:admin:purchase - Grants the ability to request purchase information about apps and data in ArcGIS Marketplace. - marketplace:admin:startTrial - Grants the ability to start trial subscriptions in ArcGIS Marketplace. - marketplace:admin:manage - Grants the ability to create listings, list items and manage subscriptions in ArcGIS Marketplace. - Organization Settings - Privilege - Description - portal:admin:manageSecurity - Grants ability to manage security and infrastructure settings - portal:admin:manageWebsite - Grants the ability to manage the website settings. - portal:admin:manageCollaborations - Grants the ability to administer the organization’s collaborations. - portal:admin:manageCredits - Grants the ability to manage the organization’s credit budget settings. (ArcGIS Online only) - portal:admin:manageServers - Grants the ability to manage the servers federated with the organization. (ArcGIS Enterprise only) - portal:admin:manageUtilityServices - Grants the ability to manage the utility services configured with the organization. - portal:admin:manageRoles - Grants the ability to manage the organization’s roles. - portal:admin:createGPWebhook - Grants the ability to create, edit and delete their own geoprocessing webhook. (ArcGIS Enterprise only) - Publisher Privileges: - Content - Privilege - Description - portal:publisher:publishFeatures - Grants the ability to publish hosted feature layers. - portal:publisher:publishTiles - Grants the ability to publish hosted tile layers. - portal:publisher:publishScenes - Grants the ability to publish hosted scene layers. - portal:publisher:publishServerServices - Grants the ability to publish non-hosted server services. (ArcGIS Enterprise only) - portal:publisher:publishServerGPServices - Grants the ability to publish non-hosted geoprocessing services (ArcGIS Enterprise only) - portal:publisher:publishKnowledgeGraph - Grants the ability to create and publish knowledge graphs. (ArcGIS Enterprise only) - portal:publisher:bulkPublishFromDataStores - Grants the ability to publish web layers from a registered data store. (ArcGIS Enterprise only) - portal:publisher:enumerateDataStores - Grants the ability to get list of datasets from a registered data store. (ArcGIS Enterprise only) - portal:pulisher:registerDataStores - Grants the ability to register data stores to the Enterprise. (ArcGIS Enterprise only) - portal:publisher:publishTiledImagery - Grants the ability to publish hosted tiled imagery layers from a single image or collection of images. - portal:publisher:publishDynamicImagery - Grants the ability to publish hosted dynamic imagery layers from a single image or collection of images. - premium:publisher:createNotebooks - Grants the ability to create and edit interactive notebooks items. - premium:publisher:scheduleNotebooks - Grants the ability to schedule future automated runs of a notebook. - portal:publisher:createDataPipelines - Grants the ability to create, edit and run data pipelines. - Premium Content - Privilege - Description - premium:publisher:geoanalytics - Grants the ability to use big data analytics. () - premium:publisher:rasteranalysis - Grants the ability to use raster analystics. - premium:publisher:createAdvancedNotebooks - Grants the ability to publish a notebook as a geoprocessing service. (ArcGIS Enterprise only) - User Privileges: - Members - Privilege - Description - portal:user:viewOrgUsers - Grants members to view other organization members. - Groups - Privilege - Description - portal:user:createGroup - Grants the ability for a member to create, edit, and delete their own groups. - portal:user:joinGroup - Grants the ability to join groups within organization. - portal:user:joinNonOrgGroup - Grants the ability to join groups external to the organization. (ArcGIS Online only) - portal:user:viewOrgGroups - Grants members the ability to view groups shared to the organization. - portal:user:addExternalMembersToGroup - Grants the abitlity to create groups that allow external members, as well as invite external members to groups (ArcGIS Online only) - portal:user:manageCollaborationGroupMembers - Grants the ability to manage members in partnered collaboration groups. (ArcGIS Online only) - Content - Privilege - Description - portal:user:createItem - Grants the ability for a member to create, edit, and delete their own content. - portal:user:viewTracks - Grants the ability to to view members’ location tracks via shared track views when location sharing is enabled. (ArcGIS Enterprise only) - portal:user:reassignItems - Grants users the ability to reassign their own content to other organization members with the receive items privilege. - portal:user:receiveItems - Grants users the ability to receive items reassigned to them by other organization members with the reassign items privilege. - portal:user:viewOrgItems - Grants members the ability to view content shared with the organization. - Sharing - Privilege - Description - portal:user:shareToGroup - Grants the ability to share content to groups. - portal:user:shareToOrg - Grants the ability to share content to organization. - portal:user:shareToPublic - Grants the ability to share content to all users of portal. - portal:user:shareGroupToOrg - Grants the ability to make groups discoverable by the organization. - portal:user:shareGroupToPublic - Grants the ability to make groups discoverable by all users of portal. - Premium Content - Privilege - Description - premium:user:geocode - Grants the ability to perform large-volume geocoding tasks with the Esri World Geocoder such as publishing a CSV of addresses as hosted feature layer. - premium:user:networkanalysis - Grants the ability to perform network analysis tasks such as routing and drive-time areas. - premium:user:geoenrichment - Grants the ability to geoenrich features. - premium:user:demographics - Grants the ability to make use of premium demographic data. - premium:user:spatialanalysis - Grants the ability to perform spatial analysis tasks. - premium:user:elevation - Grants the ability to perform analytical tasks on elevation data. - premium:user:featurereport - Grants the ability to create feature reports. (ArcGIS Online only) - Features - Privilege - Description - features:user:edit - Grants the ability to edit features in editable layers, according to the edit options enabled on the layer. - features:user:fullEdit - Grants the ability to add, delete, and update features in a hosted feature layer regardless of the editing options enabled on the layer. - Version Management (ArcGIS Enterprise only) - Privilege - Description - features:user:manageVersions - Grant the ability to manage version locks and view, alter, delete, edit, reconcile, and post to all branch versions accessed through ArcGIS Server feature layers. - Open Data (ArcGIS Online only) - Privilege - Description - opendata:user:openDataAdmin - Grants the ability to manage Open Data Sites for the organization. - opendata:user:designateGroup - Grants the ability to designate groups within organization as being available for use in Open Data. 
 
Layer
- class arcgis.gis.Layer(url, gis=None, **kwargs)
- Bases: - _GISResource- The - Layerclass is a primary concept for working with data in a GIS.- Users create, import, export, analyze, edit, and visualize layers. - Layers can be added to and visualized using maps. They act as inputs to and outputs from analysis tools. - Layers are created by publishing data to a GIS, and are exposed as a broader resource (Item) in the GIS. - Layerobjects can be obtained through the layers attribute on layer- Itemobjects in the GIS.- classmethod fromitem(item: str, index: int = 0)
- The - fromitemmethod returns the layer at the specified index from a layer- Itemobject.- Parameter - Description - item - Required Item. An item containing layers. - index - Optional int. The index of the layer amongst the item’s layers - Returns:
- The layer at the specified index. 
 - # Usage Example >>> layer.fromitem(item="9311d21a9a2047d19c0faaebd6f2cca6", index=3) 
 
GroupApplication
- class arcgis.gis.GroupApplication(url, gis, **kwargs)
- Bases: - object- The - GroupApplicationclass represents a single group application on the GIS, either ArcGIS Online or ArcGIS Enterprise.- accept()
- The - acceptmethod is used to manage a- Userapplication. When a- Userapplies to join a- Group, a- GroupApplicationobject is created. Group administrators choose to accept this application using the- acceptoperation. This operation adds the applying user to the group then deletes the application. This operation also creates a notification for the user indicating that the user’s group application was accepted. This method is very similar to the- declinemethod, which declines rather than accepts the application to join a group.- Note - The - acceptmethod is only available to group owners and administrators.- # Usage Example >>> group1 = gis.groups.get('name') >>> group_app = group1.applications[0] >>> group_app.accept() - Returns:
- A boolean indicating success (True) or failure (False). 
 
 - decline()
- The - declinemethod is used to manage a- Userapplication. When a- Userasks to join a- Group, a- GroupApplicationobject is created. Group administrators choose to decline this application using the- declineoperation. This operation deletes the application and creates a notification for the user indicating that the user’s group application was declined. This method is very similar to the- acceptmethod, which accepts rather than declines the application to join a group.- Note - The - declinemethod is only available to group owners and administrators.- # Usage Example >>> group_app = group.applications[0] >>> groupapplication.decline() - Returns:
- A boolean indicating success (True) or failure (False). 
 
 
CategorySchemaManager
- class arcgis.gis.CategorySchemaManager(base_url, gis=None)
- The - CategorySchemaHelperclass is for managing category schemas. An instance of this class, called categories, is available as a property in the- ContentManagerand the- Groupclass. See- categoriesand- categoriesfor more information.- Note - This class is not created by users directly. - assign_to_items(items: list[str] | list[Item] | list[dict[str, Any]])
- The - assign_to_itemsfunction adds group content categories to the portal items specified in the items argument (see below). For assigning categories to items in a group, you must be the group owner/manager. For assigning organization content categories on items, you must be the item owner or an administrator who has the portal:admin:updateItems privilege.- Note - A maximum of 100 items can be bulk updated per request. - Parameter - Description - items - Required List. A JSON array of item objects. Each is specified with the item ID that consists of a categories object. categories is specified with an array that lists all content categories to update on the item, each with full hierarchical path prefixed with /. - Each item can be categorized to a maximum of 20 categories. - Returns:
- A dict of item_id : status, with status being whether the content categories were successfully added. If the status is unsuccessfully updated, a message will provide information to help you debug the issue. 
 - # Usage Example >>> gis.content.categories.assign_to_items(items = [{"2678d3002eea4e4a825e3bdf10016e61": { "categories": ["/Categories/Geology", "/Categories/Elevation"]}}, {"c3ad4ed8bcf04d619537cfe252a1760d": { "categories": ["/Categories/Geology", "/Categories/Land cover/Forest/Deciduous Forest"]}}, {"9ced00fdce3e4b20bb4b05155acbe817": { "categories": []}}]) 
 - delete()
- The - deletefunction allows group owner or managers to remove the category schema set on a group.- # Usage Example >>> gis.content.categories.delete() - Returns:
- A boolean indicating success (True), or failure (False) 
 
 - property schema
- The - schemaproperty allows group owners/managers to manage the content categories for a group. These content categories are a hierarchical set of classes to help organize and browse group content.- Note - Each group can have a maximum of 5 category trees with each category schema can have up to 4 hierarchical levels. The maximum number of categories a group can have in total is 200 with each category of less than 100 characters title and 300 characters description. - When getting - schema, returns the content category schema set on a group.- When setting - schema, will update the group category schema based on the dict this property is set to. See below.- Parameter - Description - categories - Required Dict. A category schema object consists of an array of dict objects representing top level categories. Each object has title, description and categories properties where categories consists of an array of objects with each having the same properties and represents the descendant categories or subcategories and so on. 
 
ContentManager
- class arcgis.gis.ContentManager(gis)
- The - ContentManagerclass is a helper class for managing content in ArcGIS Online or ArcGIS Enterprise. An instance of this class, called ‘content’, is available as a property of the GIS object. Users call methods on this ‘content’ object to manipulate (create, get, search, etc) items. See- contentfor more information.- Note - The class is not created by the user. - add(item_properties: dict[str, Any] | ItemProperties, data: str | None = None, thumbnail: str | None = None, metadata: str | None = None, owner: str | None = None, folder: str | None = None, item_id: str | None = None, **kwargs)
- Deprecated since version 2.3.0: Removed in: 3.0.0. Use Folder.add() instead. - Deprecated since version 2.3.0: Removed in: 3.0.0. Use Folder.add() instead. - The - addmethod adds content to the GIS by creating an- Item.- Note - Content can be a file (such as a service definition, shapefile, CSV, layer package, file geodatabase, geoprocessing package, map package) or it can be a URL (to an ArcGIS Server service, WMS service, or an application). - If you are uploading a package or other file, provide a path or URL to the file in the data argument. - From a technical perspective, none of the item_properties (see table below Key:Value Dictionary Options for Argument item_properties) are required. However, it is strongly recommended that arguments title, type, typeKeywords, tags, snippet, and description be provided. - Parameter - Description - item_properties - Required dictionary. See table below for the keys and values. - data - Optional string, io.StringIO, or io.BytesIO. Either a path or URL to the data or an instance of StringIO or BytesIO objects. - thumbnail - Optional string. Either a path or URL to a thumbnail image. - metadata - Optional string. Either a path or URL to the metadata. - owner - Optional string. Defaults to the logged in user. - folder - Optional string. Name of the folder where placing item. - item_id - Optional string. Available in ArcGIS Enterprise 10.8.1+. Not available in ArcGIS Online. This parameter allows the desired item id to be specified during creation which can be useful for cloning and automated content creation scenarios. The specified id must be a 32 character GUID string without any special characters. - If the item_id is already being used, an error will be raised during the add process. - Example: item_id=9311d21a9a2047d19c0faaebd6f2cca6 - Optional Input Parameters for the `add` method - Optional Argument - Description - upload_size - Optional float. The default value is 1e7 bytes or ~10 MBs. This the minimum default value for the size of the file when uploading by parts. - Key:Value Dictionary Options for Argument item_properties - Key - Value - type - Optional string. Indicates type of item, see URL 1 below for valid values. - dataUrl - Optional string. The Url of the data stored on cloud storage. If given, filename is required. - filename - Optional string. The name of the file on cloud storage. This is required is dataUrl is used. - typeKeywords - Optional string. Provide a lists all sub-types, see URL below for valid values. - description - Optional string. Description of the item. - title - Optional string. Name label of the item. - url - Optional string. URL to item that are based on URLs. - text - Optional string. For text based items such as Feature Collections & WebMaps - tags - Optional string. Tags listed as comma-separated values, or a list of strings. Used for searches on items. - snippet - Optional string. Provide a short summary (limit to max 250 characters) of the what the item is. - extent - Optional string. Provide comma-separated values for min x, min y, max x, max y. - spatialReference - Optional string. Coordinate system that the item is in. - accessInformation - Optional string. Information on the source of the content. - licenseInfo - Optional string. Any license information or restrictions regarding the content. - culture - Optional string. Locale, country and language information. - commentsEnabled - Optional boolean. Default is true, controls whether comments are allowed (true) or not allowed (false). - access - Optional string. Valid values are private, org, or public. Defaults to private. - overwrite - Optional boolean. Default is false. Controls whether item can be overwritten. - Note - Configuring items for ovewrite is no longer supported when adding an - Item- See Item and Item Types in the ArcGIS REST API for more information. - Returns:
- The - Itemif successfully added, None if unsuccessful.
 - # Usage Example >>> gis.content.add(item_properties = { >>> "type": "Feature Collection", >>> "title" : "US Hurricane Data", >>> "tags": "Hurricanes, Natural Disasters, USA", >>> "description" : "Aggregated USA Hurricane Data for 2020", >>> "commentsEnabled" : False >>> } , owner = "User1234") 
 - advanced_search(query: str, return_count: bool = False, max_items: int = 100, bbox: list[str] | str | None = None, categories: str | None = None, category_filter: str | None = None, start: int = 1, sort_field: str = 'title', sort_order: str = 'asc', count_fields: str | None = None, count_size: int | None = None, as_dict: bool = False, enrich: bool = False, filter: str | None = None)
- The - advanced_searchmethod allows the ability to fully customize the search experience. The- advanced_searchmethod allows users to control of the finer grained parameters not exposed by the- ContentManagermethod. Additionally, it allows for the manual paging of information and how the data is returned.- Parameter - Description - query - Required String. The search query. When the search filters contain two or more clauses, the recommended schema is to have clauses separated by blank, or AND, e.g. - #Usage Example: >>> gis.content.advanced_search(query='owner:USERNAME type:map') # or >>> gis.content.advanced_search(query='type:map AND owner:USERNAME') - Warning - When the clauses are separated by comma, the filtering condition for owner should not be placed at the first position, e.g. - >>> gis.content.advanced_search(query='type:map, owner:USERNAME') - is allowed, while - >>> gis.content.advanced_search(query='owner:USERNAME, type:map') - is not. For more information, please check Users, groups and items. - return_count - Optional Boolean. When true, the total for the given search is returned. It will ignore the max_items variable. - max_items - Optional Integer. The total number of items to return up to 10,000. When the value of -1 is given all aviable Items will be returned up to 10,000. - bbox - Optional String/List. This is the xmin,ymin,xmax,ymax bounding box to limit the search in. Items like documents do not have bounding boxes and will not be included in the search. - categories - Optional String. A comma separated list of up to 8 org content categories to search items. Exact full path of each category is required, OR relationship between the categories specified. - Each request allows a maximum of 8 categories parameters with AND relationship between the different categories parameters called. - category_filters - Optional String. A comma separated list of up to 3 category terms to search items that have matching categories. Up to 2 category_filters parameter are allowed per request. It can not be used together with categories to search in a request. - start - Optional Int. The starting position to search from. This is only required if paging is needed. - sort_field - Optional String. Responses from the search operation can be sorted on various fields. avgrating is the default. - sort_order - Optional String. The sequence into which a collection of records are arranged after they have been sorted. The allowed values are: asc for ascending and desc for descending. - count_fields - Optional String. A comma separated list of fields to count. Maximum count fields allowed per request is 3. Supported count fields: tags, type, access, contentstatus, and categories. - count_size - Optional Int. The maximum number of field values to count for each count_fields. The default value is None, and maximum size allowed is 200. - as_dict - Required Boolean. If True, the results comes back as a dictionary. The result of the method will always be a dictionary but the results key in the dictionary will be changed if set to False. - enrich - Optional Boolean. If True, search results will include both literal and relevant matches. Without this parameter search results will include only literal matches. - filter - Optional String. A filter to apply to the search. The following fields are supported for the filter parameter: - For Users - username 
- firstname 
- lastname 
- fullname 
- email 
 - Example: filter=username:”jsmith” - For Items - title 
- tags 
- typeKeywords 
- type 
- owner 
 - Example: filter=tags:”public” - For Groups - title 
- typeKeywords 
- owner 
 - Example: filter=”owner:’jsmith’” - Returns:
- Depends on the inputs:
- Dictionary for a standard search 
- `return_count`=True an integer is returned 
- count_fields is specified a list of dicts for each field specified 
 
 
 - # Usage Example >>> gis.content.advanced_search(query ="Hurricanes", categories = "Hurricanes, USA, Natural Disasters", >>> sort_order = "asc", count_fields = "tags, type", as_dict = True) 
 - analyze(url: str | None = None, item: str | Item | None = None, file_path: str | None = None, text: str | None = None, file_type: str | None = None, source_locale: str = 'en', geocoding_service: str | None = None, location_type: str | None = None, source_country: str = 'world', country_hint: str | None = None, enable_global_geocoding: bool | None = None)
- The - analyzemethod helps a client analyze a CSV or Excel file (.xlsx, .xls) prior to publishing or generating features using the Publish or Generate operation, respectively.- analyzereturns information about the file including the fields present as well as sample records.- analyzeattempts to detect the presence of location fields that may be present as either X,Y fields or address fields.- analyzepackages its result so that publishParameters within the JSON response contains information that can be passed back to the server in a subsequent call to Publish or Generate. The publishParameters subobject contains properties that describe the resulting layer after publishing, including its fields, the desired renderer, and so on.- analyzewill suggest defaults for the renderer.- In a typical workflow, the client will present portions of the - analyzeresults to the user for editing before making the call to- generateor- publish.- Note - The maximum upload size for shapefiles is now 2 Mb and 10 Mb for all other supported file types. - Note - If the file to be analyzed currently exists in the portal as an item, callers can pass in its itemId. Callers can also directly post the file. In this case, the request must be a multipart post request pursuant to IETF RFC1867. The third option for text files is to pass the text in as the value of the text parameter. - Parameter - Description - url - Optional string. The URL of the csv file. - item - Optional string/ - Item. The ID or Item of the item to be analyzed.- file_path - Optional string. The file to be analyzed. - text - Optional string. The text in the file to be analyzed. - file_type - Optional string. The type of the input file: shapefile, csv, excel, geoPackage, or geojson (geojson only supported for ArcGIS Online). - source_locale - Optional string. The locale used for the geocoding service source. - geocoding_service - Optional string/geocoder. The URL of the service. - location_type - Optional string. Indicates the type of spatial information stored in the dataset. - Values for CSV: coordinates | address | lookup | none Values for Excel: coordinates | address | none - source_country - Optional string. The two character country code associated with the geocoding service, default is “world”. - country_hint - Optional string. If first time analyzing, the hint is used. If source country is already specified than sourcecountry is used. - enable_global_geocoding - Optional boolean. Default is None. When True, the global geocoder is used. - Returns:
- dictionary 
 - # Usage Example >>> gis.content.analyze(item = "9311d21a9a2047d19c0faaebd6f2cca6", file_type = "csv") 
 - bulk_update(itemids: list[str] | list[Item], properties: dict[str, Any])
- The - bulk_updatemethod updates a collection of items’ properties.- Note - bulk_update only works with content categories at this time. - Parameter - Description - itemids - Required list of string or Item. The collection of Items to update. - properties - Required dictionary. The Item’s properties to update. - Returns:
- A List of results 
 - # Usage Example >>> itemsids = gis.content.search("owner: TestUser12399") >>> properties = {'categories' : ["clothes","formal_wear/socks"]} >>> gis.content.bulk_update(itemids, properties) [{'results' : [{'itemid' : 'id', 'success' : "True/False" }]}] 
 - can_delete(item: Item)
- The - can_deletemethod indicates whether an- Itemcan be deleted or not. When the returned response from- can_deleteis- True, the item can be safely removed. When the returned response is- False, the item cannot be deleted due to a dependency or protection setting.- Parameter - Description - item - Required - Item. The Item to be deleted.- Returns:
- A dictionary - see the table below for examples of a successful call of - can_deleteand a failed call of- can_delete.
 - # Usage Example >>> from arcgis import GIS >>> gis = GIS(url="your_portal_url", username="your_portal_username", password="your_portal_password") >>> item = gis.content.get(itemid=<item_id>) >>> gis.content.can_delete(item=item) {"itemId": <item_id>, "success": True} - Status - Response - success - { “itemId”: <item_id>, “success”: True } - failure - {“itemId”: <item_id>,
- “success”: False,
- “reason”: {
- “message”: {
- “code”: 400, “messageCode”: “CONT_0048”, “message”: “Unable to delete item <item_id>. Delete protection is turned on.”, “offendingItems”: [] 
 - } 
 - } 
 - } 
 
 - can_reassign(items: list[Item], user: User) list[dict[str, Any]]
- Checks if a list[Item] can be reassigned to a particular user. The operation checks whether the items owned by one user can be successfully reassigned to a specified user before performing the reassign operation. Users assigned the default administrator role, or a custom role with administrative privileges, can perform this operation. The item owner can also use this operation; if the item owner that performs this operation is not a default administrator, or assigned a custom role with administrative privileges, they must have the portal:user:reassignItems privilege assigned to them to transfer content to another user. - Parameter - Description - items - Required list[Item]. A list of Items. The maximum number of items that can be transferred at one time is 100. - user - Required User. The user the items will be reassigned to. For a user to be eligible to receive transferred content, they must meet the following requirements: - The user must be assigned the portal:user:receiveItems privilege to receive the transferred content. 
- The user must have a user type that allows them to own content. 
- If the items being transferred to the user are shared with a group, the user receiving the items must be a member of the group. If the group is a view-only group, the user receiving the items must be the group owner or a group manager. 
 - If the above requirements are not met, an error response will be returned. - Returns:
- list[dict[str, Any]] 
 
 - property categories
- The - categoriesproperty is category manager for an- Itemobject. See- CategorySchemaManager.
 - check_url(url: str) dict[str, Any]
- To verify a URL is accessible by the Organization, provide the url and the system will check if the location is valid and reachable. This method is useful when checking service URLs or validating that URLs can be reached. - Returns:
- Dict[str, Any] 
 
 - clone_items(items: list[Item], folder: str | None = None, item_extent: dict[str, Any] | None = None, use_org_basemap: bool = False, copy_data: bool = True, copy_global_ids: bool = False, search_existing_items: bool = True, item_mapping: dict[str, str] | None = None, group_mapping: dict[str, str] | None = None, owner: str | None = None, preserve_item_id: bool = False, export_service: bool = False, preserve_editing_info: bool = False, **kwargs)
- The - clone_itemsmethod is used to clone content to the GIS by creating new- Itemobjects.- Note - Cloning an item will create a copy of the item and for certain item types a copy of the item dependencies in the - GIS.- For example, a web application created using Web AppBuilder or a Configurable App Template which is built from a web map that references one or more hosted feature layers. This function will clone all of these items to the GIS and swizzle the paths in the web map and web application to point to the new layers. - Note - The actions in the example above create an exact copy of the application, map, and layers in the - GIS.- Parameter - Description - items - Required list. Collection of - Itemobjects to clone.- folder - Optional string. Name of the folder where placing item. - item_extent - Optional Envelope. Extent set for any cloned items. Default is None, extent will remain unchanged. Spatial reference of the envelope will be used for any cloned feature layers. - use_org_basemap - Optional boolean. Indicating whether the basemap in any cloned web maps should be updated to the organizations default basemap. Default is False, basemap will not change. - copy_data - Optional boolean. If False, the data is put by reference rather than by copy. Default is True, data will be copied. This creates a Hosted Feature Collection or Feature Layer. - copy_global_ids - Optional boolean. Assumes previous parameter is set to True. If True, features copied will preserve their global IDs. Default is False - search_existing_items - Optional boolean. Indicating whether items that have already been cloned should be searched for in the GIS and reused rather than cloned again. - item_mapping - Optional dictionary. Can be used to associate an item id in the source GIS (key) to an item id in the target GIS (value). The target item will be used rather than cloning the source item. - group_mapping - Optional dictionary. Can be used to associate a group id in the source GIS (key) to a group id in the target GIS (value). The target group will be used rather than cloning the source group. - owner - Optional string. Defaults to the logged in user. - preserve_item_id - Optional Boolean. When true and the destination GIS is not ArcGIS Online, the clone item will attempt to keep the same item ids for the items if available. ArcGIS Enterprise must be 10.9+. - export_service - Optional Boolean. When True, a feature layer cloned over will be exported to a File GeoDatabase that is then published in the new organization. In order for this to work, user must be the owner of the item, have admin privileges, or have export enabled on the service. Default is False. - Note - This parameter is currently not usable with views. - preserve_editing_info - Optional Boolean. When True, a feature layer being cloned with editor tracking fields will maintain the current values from the source organization instead of automatically updating the values to the new org/user. Default is False. - Note - export_service must be False in order for this to work if the target GIS is on ArcGIS Online. - keyword arguments - copy_code_attachment - Option Boolean. Determines whether a code_attachment item should be created when cloning a Web App Builder item. Default values is True. Set to False to prevent item from being created. - Returns:
- A list of - Itemobjects created during the clone.
 - # Usage Example >>> gis.content.clone_items(items= ["item1", "item2", "item3", "item4", "item5"], folder ="/", owner = 'User1234') 
 - cost(tile_storage: float | None = None, file_storage: float | None = None, feature_storage: float | None = None, generate_tile_count: int | None = None, loaded_tile_count: int | None = None, enrich_variable_count: int | None = None, enrich_report_count: int | None = None, service_area_count: int | None = None, geocode_count: int | None = None) dict
- The cost allows for the estimation of amount of credits an operation will be required. For vector and tile storage, a user can estimate the cost to cook tile and the cost of storage. This operation allows users to plan for future costs effeciently to best serve their organization and clients. - Note - This operation is only supported on ArcGIS Online. - Parameter - Description - tile_storage - Optional Float. The size of the uncompressed tiles in MBs. - file_storage - Optional Float. Estimates the credit cost of MB file storage. - feature_storage - Optional Float. Estimates the cost of feature storage per feature. - generate_tile_count - Optional Int. Estimates the credit cost per tile. - loaded_tile_count - Optional Int. Estimates the credit cost of pregenerated tile storage. - enrich_variable_count - Optional Int. Estimates the credit cost er geoenrichment variable. - enrich_report_count - Optional Int. Estimates the credit cost of running reports. - service_area_count - Optional Int. Estimates the credit cost per service area generation. - geocode_count - Optional Int. Estimates the credit cost per record for geocoding. - Returns:
- dict[str, float] 
 
 - create_empty_service(parameters: CreateServiceParameter, *, owner: User | None = None) Item
- Creates a blank or view based service. - Parameter - Description - parameters - Required CreateServiceParameter. A dataclass that provides the create service parameters. - owner - Optional User. The user to save the service to. - Returns:
- Item 
 
 - create_folder(folder: str, owner: str | None = None)
- Deprecated since version 2.3.0: Removed in: 3.0.0. Use gis.content.folders.create instead. - Deprecated since version 2.3.0: Removed in: 3.0.0. Use gis.content.folders.create instead. - The - create_foldermethod creates a folder with the given folder name, for the given owner.- Note - The - create_foldermethod does nothing if the folder already exists. Additionally, if owner is not specified, owner is set as the logged in user.- Parameter - Description - folder - Required string. The name of the folder to create for the owner. - owner - Optional string. User, folder owner, None for logged in user. - Returns:
- A json object like the following if the folder was created: {“username” : “portaladmin”,”id” : “bff13218991c4485a62c81db3512396f”,”title” : “testcreate”}; None otherwise. 
 - # Usage Example >>> gis.content.create_folder("Hurricane_Data", owner= "User1234") 
 - create_service(name: str, service_description: str = '', has_static_data: bool = False, max_record_count: int = 1000, supported_query_formats: str = 'JSON', capabilities: str | None = None, description: str = '', copyright_text: str = '', wkid: int = 102100, create_params: dict[str, Any] | None = None, service_type: str = 'featureService', owner: str | None = None, folder: str | None = None, item_properties: dict[str, Any] | None = None, is_view: bool = False, tags: list[str] | str | None = None, snippet: list[str] | str | None = None, item_id: str | None = None)
- The - create_servicemethod creates a service in the Portal. See the table below for a list of arguments passed when calling- create_service.- Parameter - Description - name - Required string. The unique name of the service. - service_description - Optional string. Description of the service. - has_static_data - Optional boolean. Indicating whether the data can change. Default is False. - max_record_count - Optional integer. Maximum number of records in query operations. - supported_query_formats - Optional string. Formats in which query results are returned. - capabilities - Optional string. Specify service capabilities. If left unspecified, ‘Image,Catalog,Metadata,Download,Pixels’ are used for image services, and ‘Query’ is used for feature services, and ‘Query’ otherwise - description - Optional string. A user-friendly description for the published dataset. - copyright_text - Optional string. The copyright information associated with the dataset. - wkid - Optional integer. The well known id (WKID) of the spatial reference for the service. All layers added to a hosted feature service need to have the same spatial reference defined for the feature service. When creating a new empty service without specifying its spatial reference, the spatial reference of the hosted feature service is set to the first layer added to that feature service. - create_params - Optional dictionary. Add all create_service parameters into a dictionary. If this parameter is used, all the parameters above are ignored. - service_type - Optional string. The type of service to be created. Currently the options are imageService or featureService. - owner - Optional string. The username of the owner of the service being created. - folder - Optional string. The name of folder in which to create the service. - item_properties - Optional dictionary. See below for the keys and values - is_view - Optional boolean. Indicating if the service is a hosted feature layer view - item_id - Optional string. Available in ArcGIS Enterprise 10.8.1+. Not available in ArcGIS Online. This parameter allows the desired item id to be specified during creation which can be useful for cloning and automated content creation scenarios. The specified id must be a 32 character GUID string without any special characters. - If the item_id is already being used, an error will be raised during the add process. - Example: item_id=9311d21a9a2047d19c0faaebd6f2cca6 - tags - Optional string. Tags listed as comma-separated values, or a list of strings. Used for searches on items. - snippet - Optional string. Provide a short summary (limit to max 250 characters) of the what the item is. - Key:Value Dictionary Options for Argument item_properties - Key - Value - type - Optional string. Indicates type of item, see URL 1 below for valid values. - typeKeywords - Optional string. Provide a lists all sub-types, see URL 1 below for valid values. - description - Optional string. Description of the item. - title - Optional string. Name label of the item. - url - Optional string. URL to item that are based on URLs. - tags - Optional string. Tags listed as comma-separated values, or a list of strings. Used for searches on items. - snippet - Optional string. Provide a short summary (limit to max 250 characters) of the what the item is. - extent - Optional string. Provide comma-separated values for min x, min y, max x, max y. - spatialReference - Optional string. Coordinate system that the item is in. - accessInformation - Optional string. Information on the source of the content. - licenseInfo - Optional string. Any license information or restrictions regarding the content. - culture - Optional string. Locale, country and language information. - access - Optional string. Valid values are private, shared, org, or public. - commentsEnabled - Optional boolean. Default is true, controls whether comments are allowed (true) or not allowed (false). - culture - Optional string. Language and country information. - URL 1: https://developers.arcgis.com/rest/users-groups-and-items/create-service/#description - Returns:
- The - Itemfor the service if successfully created, None if unsuccessful.
 - # Usage Example >>> gis.content.create_service("Hurricane Collection") 
 - delete_folder(folder: str, owner: str | None = None)
- Deprecated since version 2.3.0: Removed in: 3.0.0. Use Folder.delete() instead. - Deprecated since version 2.3.0: Removed in: 3.0.0. Use Folder.delete() instead. - The - delete_foldermethod deletes a folder for the given owner with the given folder name.- Note - If the an owner is note specified in the - delete_foldercall, the method defaults to the logged in user.- Parameter - Description - folder - Required string. The name of the folder to delete. - owner - Optional string. User, folder owner, None for logged in user is the default. - Returns:
- A boolean indicating success if the folder was deleted (True), or failure if the folder was not deleted (False) 
 - # Usage Example >>> gis.content.delete_folder("Hurricane_Data", owner= "User1234") 
 - delete_items(items: list[Item] | list[str], permanent: bool = False)
- The - delete_itemsmethod deletes a collection of- Itemobjects from a users content. All items must belong to the same user to delete.- Parameter - Description - items - list of - Itemobjects or Item Ids. This is an array of items to be deleted from the current user’s content- permanent - optional boolean. Setting this to True will cause the items to be permanently deleted rather than placed in the recycle bin. ArcGIS Online Only. - Returns:
- A list of booleans indicating success if the items were deleted(True/False) or an empty list if nothing was deleted. (False) 
 - # Usage Example >>> gis.content.delete_items(items= ["item1", "item2", "item3", "item4", "item5"]) 
 - property folders
- A manager object to work with folders owned by the currently logged-in - User.- Returns:
- A - Foldersobject.
 - # Usage example >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_online_profile") >>> folders_obj = gis.content.folders >>> type(folder_obj) arcgis.gis._impl._content_manager.folder.core.Folders 
 - generate(item: Item | None = None, file_path: str | None = None, url: str | None = None, text: str | None = None, publish_parameters: dict[str, Any] | None = None, future: bool = False)
- The - generatemethod helps a client generate features from a CSV file, shapefile, GPX, or GeoJson file types.- Note - The maximum upload size for shapefiles is now 2 Mb and 10 Mb for all other supported file types. - Parameter - Description - item - Optional Item. An Item on the current portal. - file_path - Optional String. The file resource location on local disk. - url - Optional String. A web resource of a ‘shapefile’, ‘csv’, ‘gpx’ or ‘geojson’ file. - text - Optional String. The source text. - publish_parameters - Optional Dict. A Python dictionary describing the layer and service to be created as part of the publish operation. The appropriate key-value pairs depend on the file type being published. For a complete description, see the Publish Item documentation in the REST API. Also see the - Item- publish()method.- CSV,- Shapefilesand- GeoJSONfile types must have publish parameters provided.- future - Optional Boolean. This allows the operation to run asynchronously allowing the user to not pause the thread and continue to perform multiple operations. The default is False. When True the result of the method will be a concurrent Future object. The result of the method can be obtained using the result() on the Future object. When False, and Item is returned. Future is True is only supported for ‘shapefiles’ and ‘gpx’ files. - Returns:
- The method has 3 potential returns:
- A Future object when future==True, Call - results()to get the response.
- An - Itemobject when future==False
- A dictionary of error messages when Exceptions are raised 
 
 
 - # Usage Example >>> gis.content.generate(item= item1, future=False) 
 - get(itemid: str)
- The - getmethod returns the- Itemobject for the specified itemid.- Parameter - Description - itemid - Required string. The item identifier. - Returns:
- The item object if the item is found, None if the item is not found. 
 
 - import_data(df, address_fields: dict[str, Any] | None = None, folder: str | None = None, item_id: str | None = None, **kwargs)
- The - import_datamethod imports a Pandas DataFrame (that has an address column), or an arcgis spatial- DataFrameinto the GIS.- Spatial dataframes are imported into the GIS and published as feature layers. Pandas dataframes that have an address column are imported as an in-memory feature collection. - Note - By default, there is a limit of 1,000 rows/features for Pandas dataframes. This limit isn’t there for spatial dataframes. - Note - The geometry engine and I/O engine used for spatial transformations can be specified by setting the ARCGIS_IO_ENGINE environment variable. - ARCGIS_IO_ENGINE options: “arcpy”, “gdal”, “shapefile” 
 - If not set, the first available library in the environment will be used for each engine. The priority is as the above order. - Parameter - Description - df - Required DataFrame. Pandas dataframe - address_fields - Optional dictionary. Dictionary containing mapping of df columns to address fields, eg: { “CountryCode” : “Country”} or { “Address” : “Address” }. - folder - Optional string. Name of the folder where imported data would be stored. - title - Optional string. Title of the item. This is used for spatial dataframe objects. - tags - Optional string. Tags listed as comma-separated values, or a list of strings. Provide tags when publishing a spatial dataframe to the the GIS. - item_id - Optional string. Available in ArcGIS Enterprise 10.8.1+. Not available in ArcGIS Online. This parameter allows the desired item id to be specified during creation which can be useful for cloning and automated content creation scenarios. The specified id must be a 32 character GUID string without any special characters. - If the item_id is already being used, an error will be raised during the add process. - Example: item_id=9311d21a9a2047d19c0faaebd6f2cca6 - In addition to the parameters above, you can specify additional information to help publish CSV data. - Optional Argument - Description - location_type - Optional string. Indicates the type of spatial information stored in the dataset. - Values for CSV: - coordinates 
- address (default) 
- lookup 
- none 
 - Values for Excel: - coordinates 
- address (default) 
- none 
 - When location_type = coordinates, the CSV or Excel data contains x,y information. When location_type = address, the CSV or Excel data contains address fields that will be geocoded to a single point. When location_type = lookup, the CSV or Excel data contains fields that can be mapped to well-known sets of geographies. When location_type = none, the CSV or Excel data contains no spatial content and data will be loaded and subsequently queried as tabular data. - Based on this parameter, additional parameters will be required, for example, when specifying location_type = coordinates, the latitude and longitude field names must be specified. - latitude_field - Optional string. If location_type = coordinates, the name of the field that contains the y coordinate. - longitude_field - Optional string. If location_type = coordinates, the name of the field that contains the x coordinate. - coordinate_field_type - Optional string. Specify the type of coordinates that contain location information. Values: LatitudeAndLongitude (default), MGRS, USNG - coordinate_field_name - Optional string. The name of the field that contains the coordinates specified in coordinate_field_type - lookup_type - Optional string. The type of place to look up. - lookup_fields - Optional string. A JSON object with name value pairs that define the fields used to look up the location. - geocode_url - Optional string. The URL of the geocoding service that supports batch geocoding. - source_locale - Optional string. The locale used for the geocoding service source. - source_country - Optional string. The two character country code associated with the geocoding service, default is ‘world’. - country_hint - Optional string. If first time analyzing, the hint is used. If source country is already specified than source_country is used. - When publishing a Spatial Dataframe, additional options can be given: - Optional Argument - Description - target_sr - optional integer. WKID of the output data. This is used when publishing Spatial Dataframes to Hosted Feature Layers. The default is: 102100 - title - optional string. Name of the layer. The default is a random string. - tags - optional string. Comma seperated strings that provide metadata for the items. The default is FGDB. - capabilities - optional string. specifies the operations that can be performed on the feature layer service. The default is Query. - sanitize_columns - Optional boolean. The default is False. When true, the column name will modified in order to allow for successful publishing. - service_name - Optional String. The name for the service that will be added to the Item. - overwrite - Optional boolean. If True, the specified feature layer for the specified feature service will be overwritten. - service - Dictionary that is required if overwrite = True. Dictionary with two keys: “FeatureServiceId” and “layers”. “featureServiceId” value is a string of the feature service id that the layer belongs to. “layer” value is an integer depicting the index value of the layer to overwrite. - Returns:
- A - feature collectionor- feature layerthat can be used for analysis, visualization, or published to the GIS as an- Item. If geoenabled DataFrame is passed in then an- Itemis directly returned.
 
 - import_table(df: DataFrame, *, service_name: str | None = None, title: str | None = None, publish_parameters: dict[str, Any] = None, folder: str | None = None) Item
- The import_table function takes a Pandas’ DataFrame and publishes it as a Hosted Table on a WebGIS. - Note - For larger datasets it is recommended to use the gdal library. - Parameter - Description - df - Required DataFrame. A Pandas dataframe containing the tabular information. - service_name - Optional String. The name of the service. - title - Optional String. The name of the title of the created Item. - publish_parameters - Optional dict[str,Any]. The publish parameters. If given, the user is responsible for passing all the publish parameters defined here. - folder - Optional String. The name of the folder where the item will be stored. Default is the root folder of the active user. - returns: Published Hosted Table Item 
 - is_service_name_available(service_name: str, service_type: str)
- The - is_service_name_availablemethod determines if that service name is available for use or not, for the specified service type.- Parameter - Description - service_name - Required string. A desired service name. - service_type - Required string. The type of service to be created. Currently the options are imageService or featureService. - Returns:
- True if the specified service_name is available for the specified service_type, False if the service_name is unavailable. 
 - # Usage Example >>> gis.content.is_service_name_available("Hurricane Collection", "featureService") 
 - property marketplace: MarketPlaceManager
- Provides users the ability to manage the content’s presence on the marketplace. - Returns:
- MarketPlaceManageror None if not available
 
 - property offline
- The offline property is a manager object to import, export, and view offline content using the OfflineContentManager class. - Returns:
- A - OfflineContentManagerobject.
 - # Usage Example >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_online_profile") >>> offline_obj = gis.content.offline >>> type(offline_obj) <arcgis.gis.OfflineContentManager object at `maddr`> 
 - rename_folder(old_folder: str, new_folder: str, owner: str | None = None)
- Deprecated since version 2.3.0: Removed in: 3.0.0. Use Folder.rename instead. - Deprecated since version 2.3.0: Removed in: 3.0.0. Use Folder.rename instead. - The - rename_foldermethod renames an existing folder from it’s existing name to a new name.- Note - If owner is not specified, owner is set as the logged in user. - Parameter - Description - old_folder - Required string. The name of the folder to rename for the owner. - new_folder - Required string. The new name of the folder. - owner - Optional string. User, folder owner, None for logged in user. - Returns:
- A boolean indicating success (True), or failure (False) 
 - # Usage Example >>> gis.content.rename_folder("2020_Hurricane_Data", "2021_Hurricane_Data", "User1234") 
 - replace_service(replace_item: str | Item, new_item: str | Item, replaced_service_name: str | None = None, replace_metadata: bool = False)
- The - replace_serviceoperation allows you to replace your production vector tile layers with staging ones. This operation allows you to perform quality control on a staging tile layer and to then replace the production tile layer with the staging with minimal downtime. This operation has the option to keep a backup of the production tile layer.- Note - This functionality is only available for hosted vector tile layers, hosted tile layers and hosted scene layers based on packages. If you are looking to clone services, use the - clone_itemsmethod instead.- The workflow for the - replace_servicemethod is as follows:- 1. Publish the staging service to the same system as the production service. Both services are active at the same time. Share the staging service with a smaller set of users and QA the staging service. - 2. The item properties (ex: thumbnail, iteminfo, metadata) of the production item will be preserved. If you need to update them use the Item.update() method. The extent will be updated to that of the replacement service. - 3. Call the replace_service operation. The service running on the hosting server gets replaced (for example, its cache). - 4. It is the responsibility of the user to ensure that the replacement layer uses similar content and cartography to the replaced layer. This will ensure that dependent layers with modified styles continue to work. - Note - It is the responsibility of the user to ensure both services are functionally equivalent for clients consuming them. For example, when replacing a hosted feature service, ensure the new service is constructed with the anticipated layers and fields for its client application. - If you want to retain the replaced production service, for example, to keep an archive of the evolution of the service you can do so by omitting a value for “Replaced Service Name” . If replaced service name is not provided, the production service being replaced will be archived with a time stamp when replace service was executed. You can provide any name for the replaced service as long as it is not pre-existing on your portal content. - Parameter - Description - replace_item - Required Item or Item’s Id as string. The service to be replaced - new_item - Required Item or Item’s Id as string. The replacement service. - replaced_service_name - Optional string. The name of the replacement service. - replace_metadata - Optional Boolean. When set to True, the item info {“thumbnail”, “tag”, “description”, “summary”} of the current service is updated to that of the replacement service. The Credits, Terms of use, and Created from details will not be replaced. This option is set to False by default. - Returns:
- A boolean indicating success (True), or failure (False) 
 - # Usage Example >>> gis.content.replace_service(replace_item="9311d21a9a2047d19c0faaebd6f2cca6", new_item = "420554d21a9a2047d19c0faaebd6f2cca4") 
 - search(query: str, item_type: str | None = None, sort_field: str = 'avgRating', sort_order: str = 'desc', max_items: int = 10, outside_org: bool = False, categories: list[str] | str | None = None, category_filters: list[str] | str | None = None, enrich: bool | None = None, filter: str | None = None)
- The - searchmethod searches for portal items.- Note - A few things that will be helpful to know… - The query syntax has many features that can’t be adequately described here. Please see the ArcGIS REST API Search Reference for full details on search engine used with this method. 
- Most of the time when searching for items, you’ll want to search within your organization in ArcGIS Online or within your Portal. As a convenience, the method automatically appends your organization id to the query by default. If you want content from outside your organization set outside_org to True. 
 - Parameter - Description - query - Required string. A query string. See notes above. When the search filters contain two or more clauses, the recommended schema is to have clauses separated by blank, or AND, e.g. - Usage Example:
 - gis.content.search(query=’owner:USERNAME type:map’) # or gis.content.search(query=’type:map AND owner:USERNAME’) - When the clauses are separated by comma, the filtering condition for owner should not be placed at the first position, e.g. gis.content.search(query=’type:map, owner:USERNAME’) is recommended, while gis.content.search(query=’owner:USERNAME, type:map’) is not. - item_type - Optional string. The type of item to search. See Items and item types for comprehensive list of values (the type column). - sort_field - Optional string. Valid values can be title, uploaded, type, owner, modified, avgRating, numRatings, numComments, and numViews. - sort_order - Optional string. Valid values are asc or desc. - max_items - Optional integer. Maximum number of items returned, default is 10. - outside_org - Optional boolean. Controls whether to search outside your org (default is False, do not search ourside your org). - categories - Optional string or list. A string of category values. - category_filters - Optional string. A comma separated list of up to 3 category terms to search items that have matching categories. - Up to 2 category_filters parameter are allowed per request. It can not be used together with categories to search in a request. - enrich - Optional Boolean. If True, search results will include both literal and relevant matches. Without this parameter search results will include only literal matches. - filter - Optional String. A filter to apply to the search. The following fields are supported for the filter parameter: - For Users - username 
- firstname 
- lastname 
- fullname 
- email 
 - Example: filter=username:”jsmith” - For Items - title 
- tags 
- typeKeywords 
- type 
- owner 
 - Example: filter=tags:”public” - For Groups - title 
- typeKeywords 
- owner 
 - Example: filter=owner:”jsmith” - Returns:
- A list of - itemsobjects matching the specified query.
 - # Usage Example >>> gis.content.search(query ="Hurricanes", categories = "Hurricanes, USA, Natural Disasters", >>> item_type = "Feature Collection") 
 - The - shares_itemsmethod shares a batch of items with everyone, members of the organization, or specified list of- Group. A- Usercan only share items with groups to which they belong. This method is quite similar to the- unshare_itemsmethod, which achieves the exact opposite of- share_items.- Parameter - Description - items - Required List. A list of Item or item ids to modify sharing on. - everyone - Optional boolean. Default is False, don’t share with everyone. - org - Optional boolean. Default is False, don’t share with the organization. - groups - Optional list of group names as strings, or a list of arcgis.gis.Group objects, or a comma-separated list of group IDs. - allow_members_to_edit - Optional boolean. Default is False, to allow item to be shared with groups that allow shared update - Returns:
- A dictionary of shared - Itemobjects
 - # Usage Example >>> gis.content.share_items(items=[item1, item2, item3], everyone=True, org=True) 
 - The - unshare_itemsmethodUnshares a batch of items with the specified list of groups, everyone, or organization. This method is quite similar to the- share_itemsmethod, which achieves the exact opposite of- unshare_items.- Note - Each item’s current sharing will be overwritten with this method. - Parameter - Description - items - Required List. A list of Item or item ids to modify sharing on. - everyone - Required Boolean. If provided, the everyone sharing property will be updated. True means it will share the items with anyone. False means the item will not be shared with all users. - org - Required Boolean. A true value means that the items will be shared with all members of the organization. A false value means that the item will not be shared with all organization users. - groups - Required list of group names as strings, or a list of - Groupobjects, or a list of group IDs.- Returns:
- A dictionary of unshared - Itemobjects
 - # Usage Example >>> gis.content.share_items(items=[item1, item2, item3], everyone=True, org=True, groups = ["Developers", "Engineers", "GIS_Analysts"]) 
 
OfflineContentManager
- class arcgis.gis.OfflineContentManager(gis)
- The - OfflineContentManagerclass provides methods to export a subset of items and all of their dependencies from your GIS org into a compressed binary format that can then be viewed by and uploaded into any other org.- # Usage Example: Initializing an ``OfflineContentManager`` object: >>> gis = GIS(profile="your_online_profile") >>> offline_mgr = gis.content.offline - export_items(items: list, output_folder: str = None, package_name: str = None, service_format: str = 'File Geodatabase') str
- Exports a subset of items and all of their dependencies from the - GISto a compressed binary format with the extension .contentexport. When decompressed, it contains metadata about all of the items and creates subfolders for each item that was exported. The contents of this file can be examined using the- list_items()method.- Parameter - Description - items - Required list. The items to export. All of the deep dependencies of these items will also be included in the export package. - output_folder - Optional string. The location where the export package will be saved. If no argument provided, the package will be saved to a temporary directory created during the operation. - package_name - Optional string. The name of the offline package. If no argument provided, the package will be named randomly prefaced with the text exported_content. - service_format - Optional string. The format of the data from any source hosted feature layer items in the dependency tree. Default format is File Geodatabase. - Options: - Shapefile 
- CSV 
- File Geodatabase 
- *Feature Collection*( 
- GeoJson 
- Scene Package 
- KML 
- Excel 
- geoPackage 
- Vector Tile Package 
 - Returns:
- The path to the .exportcontent file. 
 - # Usage Example >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_organization_profile") >>> wma_list = gis.content.search( >>> "Analyzing Hurricane Landfall Damage", >>> "Web Mapping Application" >>> ) >>> wma_item = wma_list[0] >>> source_offline_mgr = gis.content.offline >>> export_output = source_offline_mgr.export_items( >>> items=[wma_item], >>> output_folder=r"/path/to/output", >>> package_name="webapp_exp_pkg", >>> service_format="File Geodatabase" >>> ) >>> export_output /path/to/output/webapp_exp_pkg.contentexport 
 - import_content(package_path: str, item_ids: list[str] = [], preserve_ids: bool = False, folder: Folder | str = None, failure_rollback: bool = False, item_mapping: dict = {}, search_existing_items: bool = False) list
- Reads a .contentexport file (see - export_items()method) and uploads its contents to the- GIS. These packages contain the deep dependencies of an- Item, assuming they were available during export, and will recreate them in the destination GIS- Note - This function is still in beta and may not have full capabilities. Known item limitations are: - Survey123 Forms 
- Geoprocessing Services 
 - Parameter - Description - package_path - Required string. The path to the .contentexport file to import. - item_ids - Optional list of strings. The item ids to import from the package. If none provided, all items in the package will be imported. - preserve_ids - Optional boolean. If True, the original item ids will be preserved, if available. Default is False. - Note - Only available for ArcGIS Enterprise. - folder - Optional - Folderor string. The folder to import the content into. If no argument provided, content placed in the logged-in user’s root folder.- failure_rollback - Optional boolean. - If True, the import will be rolled back and the created items will 
 - be deleted if any error occurs during the process. * If False, any item that fails to import will be skipped and the process will continue. Default is False. - item_mapping - A mapping of item IDs from the offline package to item IDs that already exist in the target organization. The keys represent the item IDs of dependencies in the offline package, while the values are the corresponding item IDs to be used as replacements during import. This prevents duplication by reusing existing items when certain dependencies have already been uploaded. - search_existing_items - Optional boolean. Indicating whether items that have already been cloned should be searched for in the GIS and reused rather than cloned again. Existent items will be reused in other new created items, as appropriate. Default is False. - Returns:
- A List of the created - Itemobjects.
 - # Usage Example >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_organization_profile") >>> dest_gis = GIS(profile="another_organization_profile") >>> exp_pkg = "path/to/exportpackage.contentexport" >>> imported_content = dest_gis.content.offline.import_content( package_path=exp_pkg, folder="imported_items", failure_rollback=True ) 
 - list_items(package_path: str) dict
- The - list_items()method takes a .contentexport file made from offline cloning (see export_items()) and returns a dictionary of the contained items and some metadata about them.- Parameter - Description - package_path - Required string. The path to the .contentexport file to list. - Returns:
- A dictionary with each item_id for the exported item as the key, and a dictionary of metadata for each item as the value. 
 - # Usage Example: Listing the contents of an exportcontent package: >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_organization_profile") >>> offline_mgr = gis.content.offline >>> exp_contents = offline_mgr.export_items( items=[your_item], output_folder="/path/to/migration", package_name="exported_item", service_format="File Geodatabase" ) >>> exp_contents /path/to/migration/exported_item.contentexport >>> offline_mgr.list_items(exp_contents) {'95c25c24109a4ccebf6d4cab92fe2d67': {'title': 'Example City Web Map', 'type': 'Web Map', 'created': 1711458724000, 'org_source': 'https://example.org.com'}, '4552478e7d06492f9fea617704fd1323': {'title': 'City Administration', 'type': 'Feature Service', 'created': 1703457912000, 'org_source': 'https://example.org.com'}, '3ab9c944e329416d872b0be7825b23a8': {'title': 'City Administration', 'type': 'Service Definition', 'created': 1690453814000, 'org_source': 'https://example.org.com'}} 
 
Folders
- class arcgis.gis._impl._content_manager.Folders(gis: GIS)
- Bases: - object- This class is a helper class for accessing and managing - folders. A Folders object is not meant to be initialized directly, but rather returned by the- foldersproperty of the- ContentManagerclass.- >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_online_or_enterprise_profile") >>> cm = gis.content >>> folders_obj = cm.folders >>> folders_obj <arcgis.gis._impl._content_manager.folder.core.Folders at <memory_addr>> - create(folder: str, owner: str | 'User' = None, exist_ok: bool = False) Folder
- The - createmethod creates a folder named with the value of the folder argument owned by the- userentered in the owner argument.- Note - The - createmethod raises a FolderException if the folder already exists. Additionally, if owner is not specified, owner is set as the logged in user.- Parameter - Description - folder - Required string. The name of the folder to create for the owner. - owner - Optional string of the - usernameattribute or- Userobject who will own the folder.- Note - Must have administrator privileges to create content for another user. - exist_ok - Optional Bool. If exist_ok is False (the default), a FolderException is raised if the target directory already exists. - Returns:
- A - Folderobject.
 - # Usage Example >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_online_or_enterprise_admin_profile") >>> new_folder = gis.content.folders.create("Hurricane_Data", owner= "User1234") >>> new_folder.name 'Hurricane_Data' 
 - get(folder: str | None = None, owner: str | 'User' | None = None) Folder | None
- Gets a single - Folderowned by the- Userentered as the owner argument.- Parameter - Description - folder - Optional string. The name of the - Folderobject to get from the owner argument’s folders.- owner - Optional string. The - usernamevalue or a- Userobject indicating the the owner of the folder to get.- Note - Must have appropriate permissions to get another user’s folders. - Note - If no folder or no owner argument provided, the root folder of the logged-in user is returned. - Returns:
- Folderobject.
 - # Usage Example #1: Get Root Folder of another user >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_online_or_enterprise_admin_profile") >>> user_folder = gis.content.folders.get(owner="gis_editor3") >>> user_folder < Folder: Root Folder Owner: gis_editor3> # Usage Example #2: Get particular folder from a specific user >>> h2o_folder = gis.content.folders.get(folder="Water_Resources", owner="h2o_project_user") >>> h2o_folder < Folder: Water_Resources Owner: h2o_project_user> 
 - list(owner: str | 'User' | None = None) Iterator[Folder]
- Returns a Python generator over the - Folderobjects owned by the username entered in the owner argument.- Note - Must have appropriate privileges to list another user’s folder’s. - Parameter - Description - owner - Optional string. An - usernamevalue or- Userobject to indicate the user whose folders to examine.- Note - If no argument is provided, a generator over the list of the currently logged in user’s folders is returned. - # Usage example #1: >>> gis = GIS(profile="your_online_admin_profile") >>> folders_mgr = gis.content.folders >>> user1_folder_gen = folders_mgr.list(owner="web_gis_user_1") >>> for user_folder in user1_folder_gen: print(f"{user_folder.name}") Root Folder Water_Resources_data Electric Utility Data project_testing_data Maps_for_population # Usage example #2: >>> folders_mgr = gis.content.folders >>> user2_folder_gen = folders_mgr.list(owner="web_gis_user_2") >>> next(user2_folder_gen) < Folder: Root Folder Owner: web_gis_user_2> >>> next(user2_folder_gen) < Folder: City_project_data Owner: web_gis_user_2> 
 
Folder
- class arcgis.gis._impl._content_manager.Folder(gis: GIS, *, folder: str | None = None, owner: str | None = None, properties: dict[str, Any] | None = None)
- Bases: - object- Lists a user’s content in a folder - add(item_properties: ItemProperties, file: str | None = None, text: str | None = None, url: str | None = None, data_url: str | None = None, item_id: str | None = None, stream: bool = True, upload_file_size: int | None = None) Job
- Adds an - Itemto the current folder.- Parameter - Description - item_properties - Required ItemProperties object. The properties for the item to add. When initializing the object, the title and item_type are required. - # Creating a validated item_properties argument >>> from arcgis.gis import ItemProperties, ItemTypeEnum >>> item_props = ItemProperties( title="<item_title>", item_type=ItemTypeEnum.SHAPEFILE, snippet="New shapefile item added to folder", tags=["shapefile_item", "gis_data"] ) >>> folder_add_job = folder_obj.add( ... item_properties=item_props, ... ) - file - Optional string, io.StringIO, or io.BytesIO. Provide the data to the item. - text - Optional String. The JSON content for the item to be submitted. - url - Optional string. The URL of the item to be submitted. The URL can be a URL to a service, a web mapping application, or any other content available at that URL. - data_url - Optional string. The URL where the item can be downloaded. The resource will be downloaded and stored as a file type. Similar to uploading a file to be added, but instead of transferring the contents of the file, the URL of the data file is referenced and creates a file item. The referenced URL must be an unsecured URL where the data can be downloaded. This parameter requires the operation to be performed asynchronously. Once the job status returns as complete, the item can be downloaded and the item is added successfully. - item_id - Optional string. Available in ArcGIS Enterprise 10.8.1+. Not available in ArcGIS Online. This parameter allows the desired item id to be specified during creation which can be useful for cloning and automated content creation scenarios. The specified id must be a 32 character GUID string without any special characters. - If the item_id is already being used, an error will be raised during the add operation. - # Code example: >>> add_job = gis_folder.add( >>> ... >>> item_id="9311d21a9a2047d19c0faaebd6f2cca6" >>> ... >>> ) - stream - Optional bool. This parameter is used to override the default streaming upload methods for the ArcGIS API for Python. This should only be used in very rare cases where the enterprise disallows streaming uploads. The default is True. - upload_file_size - Optional int. This is used when uploading very large files (50GB+ in size). This is the part size to split the file into when performing a streaming upload. Each piece will be the size of this value. - Returns:
- A - Jobobject specific to the- Itemthat was added. It can be used to get the resulting item by calling the- result()method.
 - # Usage Example: >>> from arcgis.gis import GIS, ItemProperties, ItemTypeEnum >>> gis = GIS(profile="your_data_owner_profile") >>> data_path = r"<path_to_zipped_shapefile>" >>> item_props = ItemProperties(title="new_shapefile_item", item_type=ItemTypeEnum.SHAPEFILE.value, tags="new_shp_item,from_api", snippet="Demo item added from Python API") >>> folders_obj = gis.content.folders >>> item_folder = folders_obj.get(folder="water_data") >>> add_job = item_folder.add(item_properties=item_props, file=data_path) >>> if not add_job.done(): >>> print("...job processing...") >>> else: >>> new_shp_item = add_job.result() >>> new_shp_item <Item title:"new_shapefile_item" type:SHAPEFILE owner:data_owner> >>> new_flyr_item = new_shp_item.publish() 
 - delete(permanent: bool = False) bool
- Deletes the user folder and all its :class`items <arcgis.gis.Item>`. - Note - Only available on non-Root - folders.
 - list(item_type: str | None = None, order: str | None = 'asc', sort_on: str | None = None) Iterator[dict[str, Any]]
- Returns a Python generator object that can be iterated over to return the content in the folder. - Parameter - Description - item_type - Required string. The specific - Itemtype to create a generator for. Authoritative values can be entered by using the value attribute of any- ItemTypeEnummember.- # Usage example >>> from arcgis.gis import ItemTypeEnum >>> user_folder = gis.content.folders.get(folder="data_folder") >>> fs_generator = user_folder.list(item_type=ItemTypeEnum.FEATURE_SERVICE.value) - order - Optional string. Order of the folders in the returned generator. Options: - asc 
- desc 
 - sort_on - Optional string. Options: - username 
- id 
- title 
 - Returns:
- A Python generator object which can iterate over the - itemsthat meet the defined arguments.
 - # Usage example #1 >>> from arcgis.gis import GIS, ItemTypeEnum >>> gis = GIS(profile="your_organization_profile") >>> wetlands_fldr = gis.content.folders.get(folder="Wetlands data") >>> wm_generator = wetlands_fldr.list(item_type=ItemTypeEnum.WEB_MAP.value) >>> for wm_item in wm_generator: >>> print(f"{wm_item.title:30}{wm_item.type}") swamp_preserves_in_2016 Web Map wetland_protected_areas Web Map # Usage example #2 >>> highway_folder = gis.content.folders.get(folder="highway project") >>> sd_genr = highway_folder.list(item_type=ItemTypeEnum.SERVICE_DEFINITION.value, order="desc", sort_on="title) >>> next(sd_genr) <Item title:"I-40 sd" type:Service Definition owner:gis_user> >>> next(sd_genr) <Item title:"I-64-dev sd" type:Service Definition owner:gis_user> 
 - property properties: dict[str, Any]
- Returns a Python dictionary of the - Folderproperties.- # Usage example: >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_org_admin_profile") >>> water_folder = gis.content.folders.get(folder="water_resources", owner="field_editor3") >>> water_folder.properties {'username': 'field_editor3', 'id': 'fc82e2ebd2091ca752ac29332aa5cfaa', 'title': 'water_resources', 'created': 1567502017000} 
 - rename(name: str, owner: str | 'User' = None) bool
- The - renamemethod replaces an existing folder’s title with the new value in the name argument.- Note - If owner is not specified, owner is set as the logged in user. - Parameter - Description - name - Required string. The new name of the folder. - owner - Optional - Userobject or username string.- Returns:
- A boolean indicating success (True), or failure (False) 
 - # Usage Example >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_organization_admin_profile") >>> orig_folder = gis.content.folders.get("2020 Hurricane Data", "mobile_worker6") >>> orig_folder.rename("2021_Hurricane_Data", "mobile_worker6") True 
 
Job
- class arcgis.gis._impl._content_manager.folder.core.Job(futures: Dict[concurrent.futures.Future, str], commit_url: str, commit_params: Dict[str, Any], session: requests.Session, itemid: str, params: Dict[str, Any], folder: Folder)
- Represents a job that is created when adding an item to a folder. Objects of this class should not be initialized directly but instead are returned by calling the - add()method of a- Folder.- # Usage Example: Initializing a folder Job object >>> from pathlib import Path >>> from arcgis.gis import GIS, ItemProperties, ItemTypeEnum >>> gis = GIS(profile="your_online_admin_profile") >>> shp_file_path = Path("path/to/your/zipped/shapefile.zip") >>> new_folder = gis.content.folders.create("new_gis_data") >>> add_item_job = new_folder.add( >>> item_properties=ItemProperties( >>> title="new_feature_layer_item", >>> item_type=ItemTypeEnum.SHAPEFILE, >>> snippet="A new feature layer create from shapefile.", >>> description="Feature layer item added through a folder add.", >>> tags=["shapefile", "gis_data"] >>> ), >>> file=str(shp_file_path) >>> ) >>> type(add_item_job) <class 'arcgis.gis._impl._content_manager.folder.core.Job'> - done() bool
- Method returning a Boolean value indicating whether job is complete. - # Usage Example: Checking if a job is complted >>> from arcgis.gis import GIS, ItemTypeEnum, ItemProperties >>> gis = GIS(profile="your_online_profile") >>> shp_file_path = "/path/to/your/zipped/shapefile.zip" >>> new_data_item_job = gis_folder.add( >>> item_properties=ItemProperties( >>> title="new_source_shp_item", >>> item_type=ItemTypeEnum.SHAPEFILE, >>> snippet="A new shapefile item.", >>> description="Shapefile data item added through a folder add.", >>> tags=["shapefile_item", "gis_data"] >>> ), >>> file=shp_file_path >>> ) >>> new_data_item_job.done() True 
 - result() Item
- Method to return the - itemthat was added by this job.- # Usage Example: Getting item resulting from a job >>> from arcgis.gis import GIS, ItemTypeEnum, ItemProperties >>> gis = GIS(profile="your_online_profile") >>> csv_file_path = "/path/to/your/data.csv" >>> new_data_item_job = gis_folder.add( >>> item_properties=ItemProperties( >>> title="new_source_csv_item", >>> item_type=ItemTypeEnum.CSV, >>> snippet="A new csv item.", >>> description="CSV data item added through a folder add.", >>> tags=["csv_item", "gis_data"] >>> ), >>> file=csv_file_path >>> ) >>> if not new_data_item_job.done(): >>> print("... job processing...") >>> else: >>> csv_item = new_data_item_job.result() >>> csv_item <Item title:"new_source_csv_item" type:CSV owner:online_data_owner> 
 
UserManager
- class arcgis.gis.UserManager(gis)
- Bases: - object- The - UserManagerclass is a helper class for managing GIS users. This class is not created by users directly. An instance of this class, called ‘users’, is available as a property of the Gis object. Users call methods on this ‘users’ object to manipulate (create, get, search, etc) users.- advanced_search(query: str, return_count: bool = False, max_users: int = 10, start: int = 1, sort_field: str = 'username', sort_order: str = 'asc', as_dict: bool = False)
- The - advanced_searchmethod allows for the full control of the query operations by any given user. The searches are performed against a high performance index that indexes the most popular fields of an user. See the Search reference page for information on the fields and the syntax of the query. The- advanced_searchmethod is quite similar to the- searchmethod, which is less refined.- The search index is updated whenever users is added, updated, or deleted. There can be a lag between the time that the user is updated and the time when it’s reflected in the search results. - Note - The results of a search only contain items that the user has permission to access. - Parameter - Description - query - Required String. The search query. When the search filters contain two or more clauses, the recommended schema is to have clauses separated by blank, or AND, e.g. - Usage Example:
 - gis.users.advanced_search(query=’owner:USERNAME type:map’) # or gis.users.advanced_search(query=’type:map AND owner:USERNAME’) - When the clauses are separated by comma, the filtering condition for owner should not be placed at the first position, e.g. gis.users.advanced_search(query=’type:map, owner:USERNAME’) is allowed, while gis.users.advanced_search(query=’owner:USERNAME, type:map’) is not. For more, please check https://developers.arcgis.com/rest/users-groups-and-items/search-reference.htm - return_count - Optional Boolean. If True, the number of users found by the query string is returned. - max_users - Optional Integer. Limits the total number of users returned in a a query. The default is 10 users. If all users is needed, -1 should be used. - start - Optional Int. The starting position to search from. This is only required if paging is needed. - sort_field - Optional String. Responses from the search operation can be sorted on various fields. username is the default. - sort_order - Optional String. The sequence into which a collection of records are arranged after they have been sorted. The allowed values are: asc for ascending and desc for descending. - as_dict - Required Boolean. If True, the results comes back as a dictionary. The result of the method will always be a dictionary but the results key in the dictionary will be changed if set to False. - Returns:
- A dictionary if return_count is False, else an integer 
 - # Usage Example >>> gis.users.advanced_search(query ="1234", sort_field = "username", max_users=20, as_dict=False) 
 - assign_categories(users: list[User], categories: list[str]) list
- Adds categories to - users.- Parameter - Description - users - Required list of - Userobjects to categorize.- categories - Required string defining the categories to add to each user in the users argument list. 
 - property categories: dict
- Provides means to get or set categories for members of an organization. See Categorize members or Assign Member Category Schema description for additional details. - Parameter - Description - value - Required List of strings or dictionary defining the categories to create for assigning to organizational members. If None is given, the category schema will be erased. - Returns:
- list 
 - # Usage example #1: Setting member categories with a list >>> gis.users.categories = ["Office Location"] # Usage example #2: Setting member categories with dictionary >>> category_dict = {"memberCategorySchema": [ {"title": "Categories", "categories": [ {"title": "Office Location"}, {"title": "Department"} ] } ] } >>> gis.users.categories = category_dict 
 - counts(type: str = 'bundles', as_df: bool = True)
- The - countsmethod returns a simple report on the number of licenses currently used for a given type. A type can be a role, app, bundle or user license type.- Parameter - Description - type - Required String. The type of data to return. The following values are valid: - role - returns counts on user roles 
- app - returns counts on registered applications 
- bundles - returns counts on application bundles 
- user_type - returns counts on the user license types 
 - as_df - Optional boolean. If true, the results are returned as a pandas DataFrame, else it is returned as a list of dictionaries. - Returns:
- Pandas DataFrame if - as_dfis True. If False, the result is a list of dictionaries.
 - # Usage Example >>>gis.users.counts("Role", as_df=True) **Example as_df=True** >>> df = gis.users.counts('user_type', True) >>> df count key 0 12 creatorUT 1 2 viewerUT **Example as_df=False** >>> df = gis.users.counts('user_type', False) >>> df [{'key': 'creatorUT', 'count': 12}, {'key': 'viewerUT', 'count': 2}] 
 - create(username: str, password: str | None, firstname: str, lastname: str, email: str, role: str | None = None, description: str | None = None, provider: str = 'arcgis', idp_username: str | None = None, level: int = 2, thumbnail: str | None = None, user_type: str | None = None, credits: float = -1, groups: list[Group] | None = None, email_text: str | None = None, use_defaults: bool | None = True)
- The - createoperation is used to create built-in or pre-create organization-specific identity store accounts for use in a Web GIS. See the respective documentation for complete details about configurating identity stores and managing access to your deployment:- ArcGIS Enterprise- Manage access to your portal
- ArcGIS Online- Invite and add members
 - Note - Only an administrator can call this method. - Note - When Portal for ArcGIS is connected to an organization specific identity store, users can sign into portal using their organization specific credentials, also known as their enterprise credentials. By default, new installations of Portal for ArcGIS do not allow accounts from an enterprise identity store to be registered to the portal automatically. Only users with accounts that have been pre-created can sign in to the portal. Alternatively, you can configure the portal to register enterprise accounts the first time the user connects to the website. - The user_type argument determines which role can be assigned to the member. A full explanation of user types and their compatibility with a particular role can be found in the User types, roles, and privileges documentation. - An organization administrator may configure New Member Defaults. When a Web GIS is configured with these values, any new user will receive these default values unless overridden by the corresponding arguments in this method. See the following documentation for additional details: - To query the organization for New Member Defaults, run the following code: - >>> gis = GIS(profile="your_admin_profile") >>> gis.users.user_settings - Parameter - Description - username - Required string. The user name, which must be unique in the Enterprise or in all of ArcGIS Online. Must be between 6 to 24 characters long. - password - Required string if the provider argument is arcgis. If the argument is enterprise, meaning an organization-specific identity provider is configured, the password parameter is optional (or ignored if present). - Note - If creating an ArcGIS Online organization user, the argument can be None and users can subsequently set their password by clicking on a link that is emailed to them. - Note - This argument must be None if iniviting the user to an ArcGIS Online organization and you want to send an email. Sending email invitations cannot have passwords set by an administrator. - firstname - Required string. The first name for the user. - lastname - Required string. The last name for the user. - email - Required string. The email address for the user. This is important! - role - Optional string. The - rolename or role_id value to assign the new member. To assign one of the default Publisher or User roles enter- org_publisher, or- org_user, respectively. For any other default role, or a custom role within the organization, enter the role_id value returned from the- all()method on the- RoleManagerclass.- >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_org_admin_profile") >>> for org_role in gis.users.roles.all(): print(f"{org_role.name:25}{org_role.role_id}") - Note - You can not create a - Userobject with the default org_admin role. In order to create a user with those privileges, you can create a user with another role, then call the- update_role()method with the org_admin argument.- description - Optional string. The description of the user account. - thumbnail - Optional string. The URL to an image to represent the user. - provider - Optional string. The identity provider for the account. The default value is arcgis. Possible values: - arcgis - built-in identity provider 
- enterprise - organization-specific identity provider 
 - See documentation for managing organizational access for explanation of different identity provider options: - idp_username - Required if provider argument is enterprise, otherwise not used. The name of the user as stored by the organization-specific identity store. - level - Deprecated Optional integer. The Web GIS system automatically sets this argument based upon the user_type and role arguments. See Levels for detailed description. - Note - This parameter was deprecated with the 10.7 release and will be removed. - user_type - Required string, unless specified in the New Member Defaults. The user type license for an organization member. See user types for detailed descriptions of each user type. Each user_type is compatible with specific roles in the organization. Compatibility is determined by the privileges assigned to each role. Only certain role arguments will work with specific user types. The potential values for this argument depend upon the organizational subscription and licensing. Run the following query as an administrator to determine the possible values: - >>> for utype in gis.users.license_types: print(f"{utype['id']}") - Note - See the - license_typesproperty on the- UserManagerclass.- credits - Optional Float. The number of credits to assign a user. The default is None, unless specified in the New Member Defaults. - The following code will return the default value if it has been set: - >>> gis = GIS(profile="your_admin_profile") >>> gis.properties.defaultUserCreditAssignment - Note - Only applies to ArcGIS Online organizations. - groups - Optional List of - Groupobjects to which the new user will be added. If None, user will be assigned to any groups specified in the New Member Defaults.- email_text - Optional string. Custom text to include in the invitation email. This text will be appended to the top of the default email text. ArcGIS Online only. - use_defaults - Optional bool. Introduced at Enterprise 11.5. Determines if new member defaults (the user type, member role, add-on licenses, and group memberships that are assigned to new users by default) should be applied to the new user. If specified as true, new member defaults are applied to the user. This parameter can still be set to true even if there are no new member defaults configured for the organization. If set to false, the new member defaults are not applied. The default value is True. - Returns:
- The - userif successfully created, None if unsuccessful.
 - #Usage Example 1: New ArcGIS Online user using `New Member Defaults` >>> ago = GIS(profile='your_online_admin_profile') >>> for k,v in ago.users.user_settings.items(): >>> print(f'{k:20}{v}') role org_publisher userLicenseType advancedUT groups ['96c9a826e654481ba2cf8f6d04137b32'] userType arcgisonly apps [] appBundles [] categories [] >>> new_user = ago.users.create(username= 'new_unique_username', password= '<strong_password>', firstname= 'user_firstname', lastname= 'user_lastname', email= 'user_email@company.com', description= 'new user using member defaults')) # Usage Example 2: New ArcGIS Online user with custom role and non-default `user_type` # Get RoleManager and print `role_id` values for `role` argument >>> role_mgr = gis.users.roles >>> for role in role_mgr.all(): >>> print(f'{role.name} {role.role_id}') Viewer iAAAAAAAAAAAAAAA Data Editor iBBBBBBBBBBBBBBB CustomRole bKrTCjFF9tKbaFk8 # Print valid values for `user_type` argument >>> [ut['id'] for ut in ago.users.license_types] ['advancedUT', 'basicUT', 'creatorUT', 'editorUT', 'fieldWorkerUT', 'GISProfessionalAdvUT', 'GISProfessionalBasicUT', 'GISProfessionalStdUT', 'IndoorsUserUT', 'insightsAnalystUT', 'liteUT', 'standardUT', 'storytellerUT', 'viewerUT'] >>> user1 = ago.users.create(username='new_unique_username', password='<strong_password>', firstname="user_firstname", lastname="user_lastname", email="user_email@company.com", description="Test user with custom role and non-default user type.", role='bKrTCjFF9tKbaFk8', user_type='creatorUT') # Usage Example 3: New User invited with an email: >>> user_e = ago.users.create(username="new_invited_uk_Q42eklm", password="S8V3*t4L8tr!&", firstname="user_firstname", lastname="user_lastname", email="user_email@company.com", description="Test for an invited user to Online.", user_type="creatorUT", role="XBH3xJArWxYuK2qX", email_text="Welcome aboard the Web GIS organization!") 
 - delete_users(users: list[User]) list[str]
- Allows the administrator to remove users from a portal. Before the administrator can remove the user, all of the user’s content and groups must be reassigned or deleted. - Parameter - Description - users - Required list of - usersto delete from the organization.- Returns:
- list containing the - userswho could not be removed.
 
 - disable_users(users: list[str] | list[User])
- The - disable_usersmethod is a bulk disables user operation that allows administrators to quickly disable large number of users in a single call. It is useful to do this operation if you have multiple users that need to be disabled.- disable_usersis quite similar to the- enable_usersmethod, which enables rather than disables users.- Note - The - disable_usersmethod is supported on ArcGIS REST API 6.4+.- Parameter - Description - users - Required List. List of - useror UserNames to disable- Returns:
- A boolean indicating success (True), or failure (False) 
 - # Usage Example >>> gis.users.disable_users(['user1','user1234', 'user123', 'user1234']) 
 - enable_users(users: list[str] | list[User])
- Thie - enable_usersmethod is a bulk operation that allows administrators to quickly enable large number of users in a single call. It is useful to do this operation if you have multiple users that need to be enabled.- enable_usersis quite similar to the- disable_usersmethod, which disables rather than enables users.- Note - The - enable_usersmethod is supported on ArcGIS REST API 6.4+.- Parameter - Description - users - Required List. List of - useror UserNames to enable- Returns:
- A boolean indicating success (True), or failure (False) 
 - # Usage Example >>> gis.users.enable_users(['user1','user1234','user123', 'user1234']) 
 - get(username: str, outside_org=True)
- The - getmethod retrieves the- Userobject for the specified username.- Parameter - Description - username - Required string. The user to get as a string. This can be the user’s login name or the user’s ID. - outside_org - Optional boolean. When working with AGOL portals, setting this to True will include users from other organizations in ArcGIS Online. Does not make a difference in Enterprise portals. Defaults to True. - Returns:
- The - Userobject if successfully found, None if unsuccessful.
 - # Usage Example >>> gis.users.get("User1234") 
 - property invitations
- The - invitationsproperty provides access to invitations sent to users using the- invitemethod.- Note : this is only supported by ArcGIS Online - Returns:
- An - InvitationManagerobject
 
 - invite(email: str, role: str = 'org_user', level: int = 2, provider: str | None = None, must_approve: bool = False, expiration: str = '1 Day', validate_email: bool = True, message_text: str | None = None)
- The - invitemethod invites a- Userobject to an organization by email.- Parameter - Description - email - Required String. The user’s email that will be invited to the organization. - role - Optional String. The role for the user account. The default value is org_user. Other possible values are org_publisher, org_admin, org_viewer. - level - Optional integer. The account level. The default is 2. See User types, roles, and privileges for full details. - provider - Optional String. The provider for the account. The default value is arcgis. The other possible value is enterprise. - must_approve - Optional boolean. After a user accepts the invite, if True, and administrator must approve of the individual joining the organization. The default is False. - expiration - Optional String. The default is ‘1 Day’. This is the time the emailed user has to accept the invitation request until it expires. The values are: 1 Day (default), 3 Days, 1 Week, or 2 Weeks. - validate_email - Optional boolean. If True (default) the Enterprise will ensure that the email is properly formatted. If false, no check will occur - message_text - Optional String. Added to the message of the invitation and can provide further instructions, a welcome, or any other personalized text to the person invited. - Returns:
- A boolean indicating success (True), or faliure (False) 
 - # Usage Example >>> gis.users.invite("user1234@email.com", role=org_admin, provider=enterprise) 
 - property license_types
- The - license_typesmethod returns a list of available licenses associated with a given GIS.- Note - The information returned can help administrators determine what type of a user should me based on the bundles associated with each user type. Additionally, the - license_typesis only available on ArcGIS Enterprise 10.7+.**- Returns:
- A List of available licenses 
 
 - property me
- The - meproperty retrieves the information of the logged in- Userobject.
 - org_search(query: str = None, sort_field: str = None, sort_order: str = None, as_dict: bool = False, exclude: bool = False) tuple[User] | tuple[dict[str, Any]]
- The org_search method allows users to find users within the organization only. Users can search for details such as provider, fullName and other user properties where the other user searches are limited. This operation will not show any user outside the organization. - Parameter - Description - query - Optional string. The query string. See notes above. Pass None to get list of all users in the organization. - sort_field - Optional string. Valid values can be username (the default) or created. - sort_order - Optional string. Valid values are asc (the default) or desc. - as_dict - Optional Boolean. Returns the raw response for each user as a dictionary - exclude - Optional Boolean. If True, the system accounts will be excluded from the query. - Returns:
- Tuple[User] | Tuple[dict[str,Any]] 
 
 - property roles
- The - rolesproperty is a helper object to manage custom roles for users.- Returns:
- An instance of the - RoleManager
 
 - search(query: str | None = None, sort_field: str = 'username', sort_order: str = 'asc', max_users: int = 100, outside_org: bool = False, exclude_system: bool = False, user_type: str | None = None, role: str | None = None)
- The - searchmethod searches portal users, returning a list of users matching the specified query. The- searchmethod is quite similar to the- advanced_searchmethod, which is more refined.- Note - A few things that will be helpful to know. - The query syntax has quite a few features that can’t be adequately described here. Please refer to the ArcGIS REST API Search Reference for details on the search engine used with this method. 
- Searching without specifying a query parameter returns a list of all users in your organization. 
- Most of the time when searching users you want to search within your organization in ArcGIS Online or within your Portal. As a convenience, the method automatically appends your organization id to the query by default. If you don’t want the API to append to your query set outside_org to True. If you use this feature with an OR clause such as field=x or field=y you should put this into parenthesis when using outside_org. 
 - Parameter - Description - query - Optional string. The query string. See notes above. Pass None to get list of all users in the organization. - sort_field - Optional string. Valid values can be username (the default) or created. - sort_order - Optional string. Valid values are asc (the default) or desc. - max_users - Optional integer. The maximum number of users to be returned. The default is 100. - outside_org - Optional boolean. This controls whether to search outside your organization. The default is False (search only within your organization). - exclude_system - Optional boolean. Controls if built-in system accounts are returned or not. True means built-in account are not returned, where as False means that they are. - user_type - Optional String. This parameters allows for the filtering of the users by their assigned type. - role - Optional String. Specify the roleId. This parameter allows for the filting of the users based on a roleId. - Returns:
- A list of - Userobjects that fit the query parameters.
 - # Usage Example >>> gis.users.search(query ="1234", sort_field = "username", max_users=20) 
 - send_notification(users: list[str] | list[User], subject: str, message: str, type: str = 'builtin', client_id: str | None = None) bool
- The - send_notificationmethod creates a user notifcation for a list of users.- Note - This has been deprecated at Enterprise 10.9 and can only be used with ArcGIS Online. - Parameter - Description - users - Required List. A list of strings or User objects to send notifications to. - subject - Required String. The notification subject line. - message - Required String. The notification content. This should be in plain text. - type - Optional String. The notification can be sent various ways. These include: - builtin - The enterprise built-in system 
- push - The push notification to send a message to 
- email - a notification sent to the user’s email account 
 - client_id - Optional String. The client id for push notification. - Returns:
- A boolean indicating success (True), or failure (False) 
 - # Usage Example >>> gis.users.send_notification([user1,user1234,user123, user1234], "testing notification system", "This was a test of the sending notification property") 
 - signup(username: str, password: str, fullname: str, email: str)
- The - signupmethod is used to create a new user account in an ArcGIS Enterprise deployment.- Parameter - Description - username - Required string. The desired username, which must be unique in the Portal, and at least 4 characters. - password - Required string. The passowrd, which must be at least 8 characters. - fullname - Required string. The full name of the user. - email - Required string. The email address for the user. This is important to have correct. - Returns:
- The - Userobject if successfully created, None if unsuccessful.
 - # Usage Example >>> gis.users.signup("User1234", "password1234","User User", "User1234@email.com") 
 - user_groups(users: list[str] | list[User], max_results: int = -1)
- Givens a List of Users, the - user_groupsmethod will report back all group ids that each- Userbelongs to.- user_groupsis designed to be a reporting tool for administrators so they can easily manage a user or users groups.- Parameter - Description - users - Required List. An array of User objects or usernames. - max_results - Optional Integer. A limiter on the number of groups returned for each user. - Returns:
- List of dictionaries with each - Userobject’s group ids.
 - # Usage Example >>> gis.users.user_groups([user1,user1234,user123, user1234], 50) 
 - property user_settings
- Gets/sets the user’s settings - The user_settings allows administrators to set, and edit, new member defaults. Members who create their own built-in accounts and members added by an administrator or through automatic account creation will be automatically assigned the new member defaults. - Passing in None to the property will delete all the user settings. - Settings Key/Value Dictionary - Returns:
- Dictionary of the user settings 
 
 
GroupManager
- class arcgis.gis.GroupManager(gis)
- Bases: - object- The - GroupManagerclass is a helper class for managing GIS groups. This class is not meant to be initialized directly, but rather an instance is accessible as the- groupsproperty of the- GISobject.- # Usage Example: Initialize a GroupManager >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_organization_admin_profile") >>> group_mgr = gis.groups >>> group_mgr <arcgis.gis.GroupManager object at 0x<mem_addr>> - clone(groups: list[Group], *, skip_existing: bool = True, offline: bool = False, save_folder: str | None = None, file_name: str | None = 'GROUP_CLONER') list[CloningJob]
- The group cloner will recreate groups from site A to site B. It will not clone the group’s items. This should be done using the clone_items or group item migrator tools. - Parameter - Description - groups - Required list[Group]. A list of Group objects to clone. - skip_existing - Optional bool. If True, if a group exists, it will be skipped. - offline - Optional bool. If True, a file will be saved locally that can be imported at a later date. - save_folder - Optional str. The save path of the offline package. - file_name - Optional str. The name of the file without an extension. - Returns:
- A list of [ - CloningJobobjects].
 - # Usage Example >>> group = gis_source.groups.create(title = "New Group", tags = "new, group, USA", description = "a new group in the USA", access = "public") >>> jobs = gis_destination.groups.clone([group]) >>> [job.result() for job in jobs] [<Group>] - # Usage Example 2 >>> group = gis_source.groups.create(title = "New Group", tags = "new, group, USA", description = "a new group in the USA", access = "public") >>> job = gis_destination.groups.clone([group], offline=True, save_folder="/path/to/storage", file_name="groups") >>> job.result() /path/to/storage/groups.GROUP_CLONER 
 - create(title: str, tags: list[str] | str, description: str | None = None, snippet: str | None = None, access: str = 'public', thumbnail: str | None = None, is_invitation_only: bool = False, sort_field: str = 'avgRating', sort_order: str = 'desc', is_view_only: bool = False, auto_join: bool = False, provider_group_name: str | None = None, provider: str | None = None, max_file_size: int | None = None, users_update_items: bool = False, display_settings: str | None = None, is_open_data: bool = False, leaving_disallowed: bool = False, hidden_members: bool = False, membership_access: str | None = None, autojoin: bool = False)
- The - createmethod creates a group with the values for any particular arguments that are specified. The user who creates the group automatically becomes the owner of the group, and the owner automatically becomes an administrator. Use- reassign_toto change the owner.- Note - Only title and tags are required. - autojoinis deprecated, use- auto_joininstead- Parameter - Description - title - Required string. The name of the group. - tags - Required string. A comma-delimited list of tags, or list of tags as strings. - description - Optional string. A detailed description of the group. - snippet - Optional string. A short snippet (<250 characters) that summarizes the group. - access - Optional string. Choices are private, public, or org. - thumbnail - Optional string. URL or file location to a group image. - is_invitation_only - Optional boolean. Defines whether users can join by request. Default is False meaning users can ask to join by request or join by invitation. - sort_field - Optional string. Specifies how shared items with the group are sorted. - sort_order - Optional string. Choices are asc or desc for ascending or descending, respectively. - is_view_only - Optional boolean. Defines whether the group is searchable. Default is False meaning the group is searchable. - auto_join - Optional boolean. Only applies to org accounts. If True, this group will allow joining without requesting membership approval. Default is False. - provider_group_name - Optional string. The name of the domain group. Create an association between a Portal group and an Active Directory or LDAP group. - provider - Optional string. Name of the provider. Required if the parameter provider_group_name is specified. Example of use: provider_group_name = “groupNameTest”, provider = “enterprise” - max_file_size - Optional integer. This is the maximum file size allowed be uploaded/shared to a group. Default value is: 1024000 - users_update_items - Optional boolean. Members can update all items in this group. Updates to an item can include changes to the item’s description, tags, metadata, as well as content. This option can’t be disabled once the group has been created. Default is False. - display_settings - Optional String. Defines the default display for the group page to show a certain type of items. The allowed values are: apps, all, files, maps, layers, scenes, tools. The default value is all. - is_open_data - Optional Boolean. Defines whether the group can be used in the Open Data capabilities of ArcGIS Hub. The default is False. - leaving_disallowed - Optional boolean. Defines whether users are restricted from choosing to leave the group. If True, only an administrator can remove them from the group. The default is False. - hidden_members - Optional Boolean. Only applies to org accounts. If true, only the group owner, group managers, and default administrators can see all members of the group. - membership_access - Optional String. Sets the membership access for the group. Setting to org restricts group access to members of your organization. Setting to collaboration restricts the membership access to partnered collaboration and your organization members. If None set, any organization will have access. None is the default. - Values: org, collaboration, or none - Note - For Enterprise only “org” is accepted. - Returns:
- The - Groupif successfully created, None if unsuccessful.
 - # Usage Example >>> gis.groups.create(title = "New Group", tags = "new, group, USA", description = "a new group in the USA", access = "public") 
 - create_from_dict(dict: dict[str, Any])
- The - create_from_dictmethod creates a group via a dictionary with the values for any particular arguments that are specified.- Note - Only title and tags are required. - Parameter - Description - dict - Required dictionary. A dictionary of entries to create/define the group. See help of the - createmethod for parameters.- Returns:
- The - Groupif successfully created, None if unsuccessful.
 
 - get(groupid: str)
- The - getmethod retrieves the- Groupobject for the specified groupid.- Parameter - Description - groupid - Required string. The group identifier. - Returns:
- The - Groupobject if the group is found, None if it is not found.
 
 - load_offline_configuration(package: str) list[Future]
- Loads the UX configuration file into the current active portal. - Parameter - Description - package - Required String. The GROUP_CLONER file that contains the offline information. - Returns:
- concurrent.futures.Future 
 - # Usage Example >>> package = r"/home/groups.GROUP_CLONER" >>> job = gis_destination.groups.load_offline_configuration(package) >>> job.result() [<Group>] 
 - search(query: str = '', sort_field: str = 'title', sort_order: str = 'asc', max_groups: int = 1000, outside_org: bool = False, categories: list[str] | str | None = None, filter: str | None = None)
- The - searchmethod searches for portal groups.- Note - A few things that will be helpful to know. - The group search syntax has many features that can’t be adequately described here. See the Search Reference page in the ArcGIS REST API for more information. 
- Searching without specifying a query parameter returns a list of all groups in your organization. 
- Most of the time when searching for groups, you’ll want to search within your organization in ArcGIS Online or within your Portal. As a convenience, the method automatically appends your organization id to the query by default. If you don’t want the API to append to your query set outside_org to True. 
 - Parameter - Description - query - Optional string on Portal, or required string for ArcGIS Online. If not specified, all groups will be searched. See notes above. - sort_field - Optional string. Valid values can be title, owner, created. - sort_order - Optional string. Valid values are asc or desc. - max_groups - Optional integer. Maximum number of groups returned, default is 1,000. - outside_org - Optional boolean. Controls whether to search outside your org. Default is False, do not search ourside your org. - categories - Optional string or list. A string of category values. - filter - Optional string. Structured filtering is accomplished by specifying a field name followed by a colon and the term you are searching for with double quotation marks. It allows the passing in of application-level filters based on the context. Use an exact keyword match of the expected value for the specified field. Partially matching the filter keyword will not return meaningful results. - Returns:
- A List of - Groupobjects matching the specified query.
 - # Usage Example >>> gis.groups.search(query ="Hurricane Trackers", categories = "Hurricanes, USA, Natural Disasters", >>> sort_field="title", sort_order = "asc") 
 
GroupMigrationManager
- class arcgis.gis.GroupMigrationManager(group)
- Bases: - object- The - GroupMigrationManagerclass provides methods to export all or a subset of all supported- itemsfrom an ArcGIS Enterprise- groupinto an export package (see Export Package) that can subsequently be added to another ArcGIS Enterprise and then loaded into a- Group.- This class is not meant to be initialized directly, but instead an object of this class is accessed through the - migrationproperty on a- Groupobject initialized from an ArcGIS Enterprise Group- # Usage Example: Initializing a ``GroupMigrationManager`` object: >>> gis = GIS(profile="your_enterprise_admin_profile") >>> ent_grp = gis.groups.search("<group query>")[0] >>> grp_mig_mgr = ent_grp.migration - create(items: list[Item] | None = None, output_filename: str | None = None, future: bool = True, export_folder: 'Folder' | None = None)
- The - createmethod exports supported- Groupcontent to an Export Package- Item(EPK item). EPK Items can be used to migrate content from one ArcGIS Enterprise deployment to another. Once an EPK Item is created, you can download it,- add()it to a receiving ArcGIS Enterprise and then- load()it into a- Groupin that Enterprise deployment. The method will handle updating service URLs and item IDs used in any web maps, web-mapping applications, and/or associated web layers in those items during the load operation. See full details in the Export Group Content documentation.- Note - There are some limits to this functionality. Packages should be under 10 GB in size and only supported items can be exported. You also must have administrative privileges to run this operation. - Parameter - Description - items - Optional List< - Item>. A set of items to export from the group. If argument is not provided, the method will attempt to export all group content items.- output_filename - Optional String. The name of the output file in the exported item file. This parameter is only supported in enterprises 11.3 and over. - future - Optional Boolean. When True, the operation runs asynchronously and returns a - Jobobject that can be queried for results. When False the operation runs synchronously and returns an export package- Itemupon completion.- export_folder - Optional Folder. Introduced at 11.4. The ID of the folder the export package will be added to. - # Usage Example: Asynchronous execution >>> import time >>> from arcgis.gis import GIS >>> >>> gis = GIS(profile="your_enterprise_admin_profile") >>> grp = gis.groups.get("<group_id>") >>> grp_mig_mgr = grp.migration >>> mig_job = grp_mig_mgr.create() >>> while mig_job.status != "completed": >>> job_status = mig_job.status >>> if job_status == "failed": >>> break >>> else: >>> print(job_status) >>> time.sleep(3) >>> print(f"Job Status: {mig_job.status}") processing processing Job Status: completed >>> epk_item = mig_job.result() 
 - inspect(epk_item: Item) dict
- The - inspectmethod retrieves the contents of an export package- Itemresulting from the- create()operation. It outputs a report on the contents of the package allowing administrators to see the contents of the package.- Keys - Description - epk_item - Required export package - Item.- Returns:
- A dictionary containing the contents of the EPK Package 
 - # Usage Example: Inspecting an export package >>> grp = gis.groups.get("<group_id>") >>> export_epk_item = grp.migration.create(future=False) >>> grp.migration.inspect(epk_item = export_epk_item) {'packageSummary': {'id': '68472b95bdfd4efa86531fd202151eda', 'fileName': 'Group_Data_2023714_032552', 'packageVersion': '1.0', 'packageCreated': 1690496752834, 'sourcePortalInfo': {'httpsUrl': 'https://myserver.company.com/web_adaptor', 'httpUrl': 'http://myserver.company.com/web_adaptor', 'version': '11.1.0', 'portalId': 'e35a6e01-0902-4c77-ef9d-1a84816f530a', 'isPortal': True}}, 'total': 2, 'start': 1, 'num': 2, 'nextStart': -1, 'results': [{'id': '4a0dfbfa0eeb415195426eee9131edfa', 'type': 'Feature Service', 'title': 'FService Item Name', 'size': 4204037, 'exists': True, 'canImport': True, 'created': 1689255086965, 'modified': 1689255155534}, {'id': 'c9d0f2b3fbf44be8a531c9a47ff160b0', 'type': 'Feature Service', 'title': 'FService2 Item name', 'size': 1985399, 'exists': True, 'canImport': True, 'created': 1689257010004, 'modified': 1689253036102}]} 
 - load(epk_item: Item, item_ids: list[str] | None = None, overwrite: bool = True, future: bool = True, folder_id: str | None = None, folder_owner: str | None = None, keep_epk_item: bool | None = None, folder_name: str | None = None)
- The - loadmethod imports the contents of an export package- Iteminto a- Group.- See the Import Group Content documentation for full system details. - Note - Administrative privileges are required to run this operation. Once imported, items will be owned by the importer, and will have to be manually reassigned to the proper owner if needed. - Warning - The receiving ArcGIS Enterprise deployment must be using the same version or later of the ArcGIS Enterprise that generated the export package. - Keys - Description - epk_item - Required export package - Item.- item_ids - Optional list. A list of item IDs to import from the export package. If this argument is not provided, the operation will import all supported items in the export package to the receiving - Group.- overwrite - Optional bool. If True, any items that already exist in the target organization will be overwritten by the corresponding item in the package provided by the epk_item argument. - future - Optional bool. When True, the operation will return a - Jobobject which can be queried, and the process will not pause so subsequent operations can continue to run. When False, the operation runs synchronously, pausing the process until the job completes and returns a dictionary containing output information. If you are loading large amounts of data, set future=True to reduce down time. The job can be queried through its- statusattribute. In addition, the- messagesand- result()attributes will contain information about the output.- folder_id - Optional String. In ArcGIS Enterprise 10.9 and later, the folder id of the destination Enterprise for the package contents. At 11.4, to import it to the root folder, specify - `/`.- folder_owner - Optional String. In ArcGIS Enterprise 10.9 and later, a username for the folder owner. - keep_epk_item - Optional Boolean. Introduced at 11.3. Specifies whether the export package item will be deleted after it’s items have been imported. If true, the package will not be deleted and will remain as an item in the organization. By default, the package will be deleted (false). - folder_name - Optional String. Introduced at 11.4. The name of the folder the imported items will be added to. If no folder name is specified, the imported items will be added to a folder named Exports. - Returns:
- A dictionary when future=False or a - Jobwhen future=True.
 - # Usage Example: Loading package results into a group >>> source = GIS(profile="source_enterprise_admin_profile") >>> target = GIS(profile="target_enterprise_admin_profile") >>> source_grp = source.groups.get("<group_id>") >>> source_epk_item = source_grp.migration.create(future=False) >>> download_path = source_epk_item.download(save_path="path_on_system", file_name="file_name.epk") >>> target_epk_item = folder.add(item_properties={"title": "Group data export item", "tags": "group_content_migration", "snippet": "Sample of loading package.", "type": "Export Package:}, file=download_path) >>> target_grp_mig = target.groups.get("<target_group_id>").migration >>> grp_import_job = target_grp_mig.load(epk_item=target_epk_item) >>> grp_import_job.messages ["Starting import of items from EPK item '<item_id>' to group 'Group Title'.", "Starting the import of exported package item '<item_id>' containing 2 items.", "Import option to overwrite items if they exist is set to 'true'."] >>> grp_import_job.result() {'itemsImported': [<Item title:"Item1 title" type:<item1 type> owner:<item_owner>>, <Item title:"Item2 title" type:<item2 type> owner:<item_owner>>], 'itemsSkipped': [], 'itemsFailedImport': []} 
 
DatastoreManager
- class arcgis.gis.DatastoreManager(gis, admin_url, server)
- Bases: - object- The - DatastoreManagerclass is a helper class for managing the data store for servers configured within the Enterprise. Depending upon the server role an instance of this class can be obtained from helper functions.- Note - This class is not created directly, but rather the following server roles have - datastores, and an instance of the- DatastoreManagerfor each server is returned by the respective get_datastores() function:- Raster Analytics Server: - get_datastores()
 - add(name: str, item: dict[str, Any])
- The - addmethod registers a new data- Itemwith the:class:~arcgis.gis.Datastore.- Parameter - Description - name - Required string. The name of the item to be added on the server. - item - Required dictionary. The dictionary representing the data item. See Data Item in the ArcGIS REST ApI documentation for more details. - Returns:
- The new data - Itemif registered successfully, None otherwise.
 - # Usage Example >>> arcgis.raster.analytics.get_datastores.add("name", {}) 
 - add_amazon_s3(name: str, bucket_name: str, access_key: str, access_secret: str, region: str, folder: str | None = None, default_protocal: str = 'https')
- Allows administrators to registered Amazon S3 Buckets as a - Datastoreobject.- Parameter - Description - name - Required string. The name of the Amazon S3 instance. - bucket_name - Required String. The name of the S3 bucket. - access_key - Required String. The key value for the S3 Bucket. - access_secret - Required String. The access secret value for the S3 bucket. - region - Required String. The Amazon region as a string. - folder - Optional String. The S3 folder within the S3 Bucket. - default_protocal - Optional String. The URL scheme to contact the S3 bucket. - Returns:
- A - Datastoreobject
 - # Usage Example >>> arcgis.raster.analytics.get_datastores.add_amazon_s3("bucket_name", "access_key", "access_secret", "region") 
 - add_bigdata(name: str, server_path: str | None = None, connection_type: str = 'fileShare')
- The - add_bigdatamethod registers a bigdata fileshare with the- Datastore.- Parameter - Description - name - Required string. The unique bigdata fileshare name on the server. - server_path - Optional string. The path to the folder from the server. - connection_type - Optional string. Allows for the setting of the types of big data store. The value ‘fileShare’ is used for local big data stores, and for cloud stores, the connection_type should be ‘dataStore’. The value ‘fileShare’ is the default value. - Returns:
- The big data fileshare if registered successfully, None otherwise. 
 - # Usage Example >>> arcgis.raster.analytics.get_datastores.add_bigdata("name") 
 - add_cloudstore(name: str, conn_str: str, object_store: str, provider: str, managed: bool = False, folder: str | None = None)
- The - add_cloudstoremethod adds a Cloud Store data- Item. Cloud Store data item represents a connection to a Amazon or Microsoft Azure store. Connection information for the data store item is stored within conn_str as a stringified JSON. ArcGIS Server encrypts connection string for storage. Connection strings that are encrypted will include a {crypt} prefix.- Note - You can get a - Datastoreitem with decrypted connection string by passing a decrypt=true parameter in the request for a data store item. Data store with decrypted connection string will be returned only for requests made with https. The examples below show data stores with decrypted conn_str. A valid object_store (S3 bucket or Azure Blob store) is required. Folders within an object store are optional.- Parameter - Description - name - Required string. The name of the cloud store. - conn_str - Required string. The connection information for the cloud storage product. - object_store - Required string. This is the amazon bucket path or Azuze path. - provider - Required string. Values must be azuredatalakestore, amazon, Alibaba, or azure. - managed - Optional boolean. When the data store is server only, the database is entirely managed and owned by the server and cannot be accessed by the publisher directly. When this option is chosen, the managed property should be set to true. Otherwise it is false. - folder - Optional string. For some Azure cloud stores, an optional folder can be specified. - Returns:
- A - Datastoreobject
 - # Usage Example >>> arcgis.raster.analytics.get_datastores.add_cloudstore("name", "connection_info", "path", "provider") 
 - add_database(name: str, conn_str: str, client_conn_str: str | None = None, conn_type: str = 'shared')
- The - add_databasemethod registers a database with the- Datastore.- Parameter - Description - name - Required string. The unique database name on the server. - conn_str - Required string. The path to the folder from the server (and client if shared or serverOnly database). - client_conn_str - Optional string. The connection string for client to connect to replicated enterprise database. - conn_type - Optional string. Choice of “<shared|replicated|serverOnly>”, shared is the default. - Returns:
- The database if registered successfully, None otherwise. 
 - # Usage Example >>> arcgis.raster.analytics.get_datastores.add_databse("name", "connection_info") 
 - add_folder(name: str, server_path: str, client_path: str | None = None)
- The - add_foldermethod registers a folder with the- Datastore.- Parameter - Description - name - Required string. The unique fileshare name on the server. - server_path - Required string. The path to the folder from the server (and client, if shared path). - client_path - Optional string. If folder is replicated, the path to the folder from the client. - Returns:
- The folder if registered successfully, None otherwise. 
 - # Usage Example >>> arcgis.raster.analytics.get_datastores.add_folder("fileshare name", "folder_path", "clienth_path") 
 - add_ms_azure_storage(cloud_storage_name: str, account_key: str, account_name: str, container_name: str, folder: str | None = None)
- The - add_ms_azure_storagecreates a cloud store with Microsoft Azure.- Parameter - Description - cloud_storage_name - Required string. The name of the storage entry. - access_key - Required String. The key value for the Azure storage. - access_secret - Required String. The access secret value for the Azure storage. - container_name - Required String. The container holding the data. - folder - Optional String. The Azure folder within the datastore item. - Returns:
- A - Datastoreobject
 - # Usage Example >>> arcgis.raster.analytics.get_datastores.add_ms_azure_storage("name", "key", "secret", "cont_name") 
 - property config
- The - configmethod retrieves and sets the data store configuration properties, which affect the behavior of the data holdings of the server. The properties include- blockDataCopy. When this property is- False, or not set at all, copying data to the site when publishing services from a client application is allowed. This is the default behavior. When this property is- True, the client application is not allowed to copy data to the site when publishing. Rather, the publisher is required to register data items through which the service being published can reference data.- Parameter - Description - value - Required bool. Values: True | False .. note: - If you specify the property as ``True``, users will not be able to publish ``geoprocessing services`` and ``geocode services`` from composite locators. These service types require data to be copied to the server. As a workaround, you can temporarily set the property to ``False``, publish the service, and then set the property back to ``True``. - Returns:
- A Dictionary indicating ‘success’ or ‘error’ 
 
 - get(path: str)
- The - getmethod retrieves the data- Itemobject at the given path.- Parameter - Description - path - Required string. The path for the data item. - Returns:
- The data item object if found, None otherwise. 
 
 - search(parent_path: str | None = None, ancestor_path: str | None = None, types: str | None = None, id: str | None = None)
- The - searchmethod is used to search through the various data items registered in the server’s data store. Searching without specifying the parent path and other parameters returns a list of all registered data items.- Parameter - Description - parentPath - Optional string. The path of the parent under which to find items. Pass ‘/’ to get the root data items. - ancestorPath - Optional string. The path of the ancestor under which to find items. - types - Optional string. A comma separated filter for the type of the items. Types include folder, egdb, bigDataFileShare, datadir. - id - Optional string. A filter to search by the ID of the item. - Returns:
- A list of data items matching the specified query. 
 - # Usage Example >>> arcgis.raster.analytics.get_datastores.search(parentPath= "parent_path", ancestorPath= "ancestor_path", id="id") 
 - validate()
- The - validatemethod validates all items in the- Datastore. In order for a data item to be registered and used successfully within the GIS’s data store, you need to make sure that the path (for file shares) or connection string (for databases) is accessible to every server node in the site. To validate all registered data items all at once, you can invoke this operation.- Returns:
- A boolean indicating successful validation (True), or failed validation (False) 
 
 
RoleManager
- class arcgis.gis.RoleManager(gis)
- Bases: - object- The - RoleManagerclass is a helper class to manage custom- rolesfor- Userin a GIS. It is available as the- rolesproperty of the- UserManager- Note - Users don’t create this class directly. - # Usage Example >>> role_mgr = gis.users.roles >>> type(role_mgr) <class 'arcgis.gis.RoleManager'> - all(max_roles: int = 1000)
- The - allmethod provides a list containing the default- Viewerand- Data Editorroles, plus any custom roles defined in the- GIS. (The- org_admin,- org_user, and- org_publisherdefault roles are not returned. See Default roles for detailed descriptions of each role.)- Parameter - Description - max_roles - Required integer. The maximum number of roles to be returned, defaults to 1000. - Returns:
- The list of all custom - roles, plus the default- Viewerand- Data Editorroles defined in the GIS.
 - # Usage Example >>> primary_default_roles = ['org_admin', 'org_publisher', 'org_user'] >>> role_mgr = gis.users.roles >>> org_roles = role_mgr.all() >>> for role in org_roles: >>> print(f"{role.name:25}{role.role_id}") Viewer iAAAAAAAAAAAAAAA Data Editor iBBBBBBBBBBBBBBB Analyzer 8KqWobO1p1vDLZ2O Sharing_analyst ZllNulU2kqaFwsaH Group_creator uT3334C4LtnQ99Cj >>> all_org_roles = primary_default_roles + [r.name for r in org_roles] >>> print(all_org_roles) ['org_admin', 'org_publisher', 'org_user', 'Viewer', 'Data Editor', 'Analyzer', 'Sharing_analyst', 'Group_creator'] - See the - createmethod of- UserManagerfor using role information when creating users.
 - clone(roles: list[Role] | list[str]) list[CloningJob]
- Clones a list of Roles from one organization to another - Parameter - Description - roles - Required list. An array of role objects or role ids or role names from the source GIS. - Returns:
- list[Future] 
 
 - create(name: str, description: str, privileges: str | None = None)
- The - createmethod creates a custom- Rolewith the specified parameters.- Parameter - Description - name - Required string. The custom role’s name. - description - Required string. The custom role’s description. - privileges - Optional string. An array of strings with predefined permissions within each privilege. For supported privileges see the Privileges page in the ArcGIS REST API documentation. - Returns:
- The custom - roleobject if successfully created, None if unsuccessful.
 - # Usage Example >>> role_mgr = gis.users.roles >>> role_mgr.create("name_role", "role_description") 
 - exists(role_name: str)
- The - existsmethod checks to see if a- Roleobject exists given the declared role name.- Parameter - Description - role_name - Required string. The name of the role to determine if it exists or not. - Returns:
- True if the - roleexists, and False if it does not.
 - # Usage Example >>> role_mgr = gis.users.roles >>> role_mgr.exists("name_role") 
 
ResourceManager
- class arcgis.gis.ResourceManager(item: Item | None = None, gis: GIS | None = None, user: User | None = None)
- Bases: - object- This class is a helper class for managing resource files of an - itemor- user. An instance of this class is available as the resource property on each respective object. The methods on this class manage the resources of the item or user.- Note - Users do not create this class directly. Use the resources property on an item or user object to initialize the class instance. - # Usage Example: Initializing object from an Item >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_online_or_enterprise_profile") >>> water_item = gis.content.search( >>> query="Water Line *", >>> item_type="StoryMap" >>> ) >>> sm_resource_mgr = water_item.resources >>> sm_resource_mgr <arcgis.gis.ResourceManager at 0x<mem_addr>> - add(file: str | None = None, folder_name: str | None = None, file_name: str | None = None, text: str | None = None, archive: bool = False, access: str | None = None, properties: dict | None = None)
- Adds new file resources to the resources of an item or user. For example, an image that is used as custom logo for a Report Template. All the files are added to the resources folder of the item. File resources use storage space from your quota and are scanned for viruses. For an item, the item size is updated to include the size of added resource files. - Note - Each file added should be no more than 25 Mb. - Supported item types that allow adding file resources are: - Vector Tile Service 
- Vector Tile Package 
- Style 
- Code Attachment 
- Report Template 
- Web Mapping Application 
- Feature Service 
- Web Map 
- Statistical Data Collection 
- Scene Service 
- Web Scene 
 - Supported file formats are: - JSON 
- XML 
- TXT 
- PNG 
- JPEG 
- GIF 
- BMP 
- PDF 
- MP3 
- MP4 
- ZIP 
 - Note - Only available to the item owner or an organization Administrator. - Parameter - Description - file - Optional string. The path to the file that needs to be added. - Note - For a user object must be a binary file. - folder_name - Optional string. Provide a folder name if the file has to be added to a folder under resources. **Only applicable to item resources. - file_name - Optional string, Required on user resource manager. The file name used to rename an existing file resource previously uploaded, or to be used with text argument as file name. - text - Optional string. Text input to be added as a file resource, used with file_name argument. - Note - If argument is provided on an item resource manager, For an item, if this the file_name argument becomes required. - archive - Optional boolean. Default is False. If True, file resources added are extracted and files are uploaded to respective folders. - Note - Only applicable for item resources. - access - Optional String. Set file resource to be private regardless of the item access level, or revert it by setting it to inherit which makes the item resource have the same access as the item. - Supported values for - Itemresources:- private 
- inherit. 
 - Supported values for - Userresources:- userappprivate - available only to the user through the app from which the resource was uploaded. 
- allorgusersprivateapp - available to all members of the organization where the resource owner is part of and through the app where the resource was uploaded. 
- public - available to everyone (including anonymous access) through any app. 
- userprivateallapps - available through any app but only to the user that uploaded the resource.`private`, inherit, or public. 
 - properties - Optional Dictionary. Set the properties for the resources such as the editInfo. - Note - Only applicable for item resources. - Returns:
 - For Userresources:
- A Python dictionary in the following format (if successful): 
 
- For 
 - { "success": True, } - For Itemresources:
- A Python dictionary in the following format (if successful): 
 
- For 
 - { "success": True, "itemId": "<item id>", "owner": "<owner username>", "folder": "<folder id>" } - For Both:
- A Python dictionary in the following format (if it failed): 
 
 - { "error": { "code": 400, "messageCode": "CONT_0093", "message": "File type not allowed for addResources", "details": [] } } - # Usage Example: Item Resources >>> item = gis.content.get(<item_id>) >>> item.resources.add( >>> file=r"/path/to/file", >>> folder_name="soil_report_data", >>> file_name="toxin_levels", >>> access="private" >>> ) # Usage Example: User Resources >>> user = gis.users.get("<username>") >>> user.resources.add( >>> file=r"C:path/to/file", >>> file_name="aggregated_till_report" >>> ) 
 - export(save_path: str | None = None, file_name: str | None = None)
- Exports all resources as a zip file to the specified path. - Note - Only supported for item resources. - Parameter - Description - save_path - Optional String. File path to save the zip file. - file_name - Optional String. Name to give to output zip file. - # Usage Example >>> Item.resources.export( save_path = "/path/to/output", file_name = "my_resources" >>> ) - Returns:
- A string to the ‘.zip’ file. 
 
 - get(file: str, try_json: bool = True, out_folder: str | None = None, out_file_name: str | None = None)
- Retrieves a specific resource of an existing item or user. - Note - Only available to the user, item owner, or an organization administrator. - Parameter - Description - file - Required string. The path to the file to be downloaded. For files in the root, just specify the file name. For files in folders (prefixes), specify using the format <foldername>/<foldername>./../<filename> For a user resource this is the key name. - try_json - Optional boolean. If True, will attempt to convert JSON files to Python dictionary objects. Default is True. - out_folder - Optional string. Specify the folder into which the file has to be saved. Default is user’s temporary directory. - out_file_name - Optional string. Specify the name to use when downloading the file. Default is the resource file’s name. - Returns:
- Path to the downloaded file if getting a binary file (like a jpeg or png file) or if try_json = False when getting a JSON file. 
- If try_json =True and file is a JSON file, returns a Python dictionary. 
 
 - # Usage Example >>> Item.resources.get("file_path", try_json=True, out_folder="out_folder_name") >>> User.resources.get("file_name", try_json=True, out_folder="out_folder_name") 
 - list(as_list=True)
- Provides a list of all file resources of an existing item. - Parameter - Description - as_list - Optional boolean. - If True, returns a Python list of dictionaries 
- If False, returns an Iterator. 
 - Default is True. - Returns:
 - For item resources a Python list of dictionaries of the form: 
 - [ { "resource": "<resource1>", "created": 1730852347000, ... }, { "resource": "<resource2>" "created": 1720752847000, ... }, ... ] - For user resources, a Python list of dictionaries of the form: 
 - [ { "key": "<resource1>", "size": <size in bytes>, "clientId": "<client id>", "created": "<creation date>", "access": "<access type>", } ] 
 - remove(file: str | None = None)
- Removes a single resource file or all resources. For an - Item, the item size is updated once resource files are deleted.- Note - Only available to the user, item owner, or organization Administrator. - Parameter - Description - file - Optional string. For an Item resource, the path to the file to be removed. For files in the root, just specify the file name. For files in folders (prefixes), specify using the format <foldername>/<foldername>./../<filename> - For a User resource, the file name of the resource to be removed. - If not specified, all resource files will be removed. - Returns:
 - If successful, a boolean of True will be returned. 
- If it fails, a dictionary with error information will be returned in the following format: 
 - { "error": { "code": 404, "message": "Resource does not exist or is inaccessible.", "details": [] } } - # Usage Example >>> Item.resources.remove("file_path") 
 - update(file: str | None = None, folder_name: str | None = None, file_name: str | None = None, text: str | None = None, properties: dict[Any, Any] | None = None)
- Updates the existing file resources of an item. File resources use storage space from your quota and are scanned for viruses. The item size is updated to include the size of updated resource files. - Supported file formats are: - JSON 
- XML 
- TXT 
- PNG 
- JPEG 
- GIF 
- BMP 
- PDF 
- ZIP 
 - Note - Only available to the item owner or an organization Administrator. - Note - Only supported for item resources. - Parameter - Description - file - Required string. The path to the file on disk to be used for overwriting an existing file resource. - folder_name - Optional string. Provide a folder name if the file resource being updated resides in a folder. - file_name - Optional string. The destination name for the file used to update an existing resource, or to be used together with the text parameter as file name for it. - For example, you can use fileName=banner.png to update an existing resource banner.png with a file called billboard.png without renaming the file locally. - text - Optional string. Text input to be added as a file resource, used together with file_name. - properties - Optional Dictionary. Set the properties for the resources such as the editInfo. - Returns:
 - If successful, a dictionary with will be returned in the following format: 
 - { "success": True, "itemId": "<item id>", "owner": "<owner username>", "folder": "<folder id>" } - If an error occurs, information will be returned in the following format: 
 - { "error": { "code": 404, "message": "Resource does not exist or is inaccessible.", "details": [] } } - # Usage Example >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_organization_profile") >>> item = gis.content.get("<item_id>") >>> item.resources.add( >>> file=r"/path/to/file.ext" >>> folder_name="data_folder", >>> file_name="org_banner.png" >>> ) 
 
OrgRecycleBin
- class arcgis.gis._impl._content_manager.OrgRecycleBin(url: str, gis: GIS)
- Bases: - object- Manages the Organization’s Recyclebin Content. - content(item_types: list['ItemTypeEnums'] | None = None, sort_order: str = 'desc', sort_field: str | None = 'size') Iterator[RecycleItem]
- Content provides a way to examine all the organization’s content in the organization. - Parameter - Description - item_types - list[“ItemTypeEnums”]. A list of item types to filter on. - sort_order - Optional String. The way to return the results. The default is desc. - sort_field - Optional String. The field to sort on. The allowed fields are: owner, type and size (default). - Returns:
- Iterator[ - RecycleItems]
 - # Usage Example: Get all feature layer items in recycle bin >>> from arcgis.gis import GIS, ItemTypeEnums >>> gis = GIS(profile="your_online_admin_profile") >>> org_rbin = gis.admin.org_recyclebin >>> r_bin_content = org_rbin.content( item_types=ItemTypeEnum.FEATURE_SERVICE.value, sort_order="desc", sort_field="size" ) >>> type(r_bin_content) <class 'generator'> >>> for r_item in r_bin_content: print(f"{r_item.properties['title']:25}{r_item.properties['size']}") trees_lyr 90112 sewers 81920 Case_1473 Survey 16384 water_quality_measures 6568 # Usage Example #2: Get all items in organization's recycle bin: >>> org_rbin = gis.admin.org_recyclebin >>> r_bin_content = org_rbin.content() >>> len(list(r_bin_content)) 1380 
 - session: EsriSession
 
RecycleBin
- class arcgis.gis._impl._content_manager.RecycleBin(gis: GIS, user: User | str | None = None)
- Bases: - object- The RecycleBin class allows users to manage items they own that were deleted. Users can - restore()or permanently- delete()items from the recycle bin.- This class is not meant to be initialized directly, but an instance is returned by the - recyclebinproperty of the- Userclass. Users can iterate over the- content.- Note - This functionality is only available for ArcGIS Online. - # Usage Example: >>> gis = GIS(profile="your_online_profile") >>> my_recycle_bin = gis.users.me.recyclebin - property content: Iterator[RecycleItem]
- Lists the content inside the recycling bin. - Returns:
- Iterator[RecycleItem] 
 - # Usage Example: >>> gis = GIS(profile="your_online_profile") >>> my_user = gis.users.me >>> r_bin_content = my_user.recyclebin.content >>> type(r_bin_content) <class 'generator'> >>> for r_item in r_bin_content: print(f"{r_item.properties['title']":15}{r_item.properties['type']}") trees_sd Service Definition trees_flc Feature Service 
 
RecycleItem
- class arcgis.gis._impl._content_manager.RecycleItem(itemid: str, properties: dict[str, Any], gis: GIS)
- Bases: - object- This represents a recycled item from the recycling bin. - # Usage Example: >>> gis = GIS(profile="your_online_profile") >>> org_user = gis.users.search("gis_user1")[0] >>> for r_item in org_user.recyclebin.content: print(f"{r_item.properties['title']:15}{r_item.properties['type']:22}{type(r_item)}") trees_item1 Service Definition <class 'arcgis.gis._impl._content_manager._recyclebin.RecycleItem'> trees_item1 Feature Service <class 'arcgis.gis._impl._content_manager._recyclebin.RecycleItem'> AR_Counties Feature Service <class 'arcgis.gis._impl._content_manager._recyclebin.RecycleItem'> - restore(folder: str | Folder) Item | None
- Restores the Item from the recycling bin. - Parameter - Description - folder - Optional string or - Folderobject. The folder to restore the item to.- Returns:
- Item| None
 - # Usage Example: >>> gis = GIS(profile="your_online_profile") >>> gis_user = gis.users.me >>> deleted_item = list(gis_user.recyclebin.content)[0] >>> restored_item = deleted_item.restore() 
 
APIKeyManager
- class arcgis.gis._impl.APIKeyManager(gis)
- Bases: - object- The - APIKeyManagercreates, manages and updates- APIKeyobjects for ArcGIS Online.- create(title: str, tags: str | list[str], description: str | None = None, http_referers: list[str] | None = None, redirect_uris: list[str] | None = None, privileges: list[str] | None = None)
- The - createmethod generates a new- APIKeyobjects for the Organization.- Parameter - Description - title - Required String. The name of the API Key Item. - tags - Required String. A comma separated list of descriptive words describing the API Key item. - description - Optional String. A description of what the API Key is going to be used for. - http_referers - Optional List. A list of the http referrers for which usage of the API Key will be restricted to. - Example - ` [ "https://foo.com", "https://bar.com" ] `- Note: Http Referrers can be configured for non apiKey type apps as well. The list configured here will be used to validate the app tokens sent in while accessing the sharing API. The referrer checks will not be applied to user tokens. - redirect_uris - Optional list. The URIs where the access_token or authorization code will be delivered upon successful authorization. The redirect_uri specified during authorization must match one of the registered URIs, otherwise authorization will be rejected. - A special value of urn:ietf:wg:oauth:2.0:oob can also be specified for authorization grants. This will result in the authorization code being delivered to a portal URL (/oauth2/approval). This value is typically used by apps that don’t have a web server or a custom URI scheme where the code can be delivered. - The value is a JSON string array. - privileges - Optional List. A list of the privileges that will be available for this API key. - Note - Privileges can be configured for non API Key type apps as well. The list configured here will be used to grant access to items when item endpoint is accessed with app tokens. The checks will not be applied to user tokens and they can continue accessing items based on the current item sharing model. With app tokens, all items of app owner can be accessed if the privileges list is not configured. - Returns:
- An - APIKeyobject
 - # Usage Example >>> gis.api_keys.create(title ="title_name", tags = "tags, apiKey, Manager", >>> http_referers = ["https://foo.com", "https://bar.com"], >>> privileges = ["portal:apikey:basemaps", "portal:app:access:item:itemId", >>> "premium:user:geocode", "premium:user:networkanalysis"]) 
 - get(api_key: APIKey = None, title: str | None = None)
- The - getmethod retrieves an- APIKeyobject based on the Key Value or its title.- # Usage Example - Getting API Key using key string >>> gis.api_keys.get(api_key='key_string') # Getting api key using key Item's title >>> gis.api_keys.get(title='project1_key1') - Returns:
- An - APIKeyobject
 
 - property keys
- The - keysproperty retrieves a tuple of- APIKeyobjects registered with the Organization.
 - validate(api_key: APIKey, privileges: list[str] | None = None)
- The - validatemethod checks if an- APIKeyobject has a specific privilege.- Parameter - Description - api_key - Required - APIKey. The key to validate against.- privileges - Optional List. The list of the privileges to check for. The list consists of a list of string values. - Returns:
- A boolean indicating success (True), or failure (False) 
 - # Usage Example >>> gis.APIKeyManager.validate(ApiKey1) 
 
APIKey
- class arcgis.gis._impl.APIKey(item, gis)
- Bases: - object- The - APIKeyclass is a single instance of a registered access key for performing certain operations based on permissions.- Users can create an APIKey instance as shown below: - # Getting from a list of keys >>> key1 = gis.api_keys.keys[0] # Getting a key using >>> key2 = gis.api_keys.get('key_value') - property apikey
- The - apikeyproperty retrieves the API Key value for the current key.- Returns:
- String 
 
 - delete()
- The - deletemethod deletes the current APIKey object permanently.- Returns:
- A boolean indicating success (True), or failure (False) 
 
 - property properties
- The - propertiesproperty retrieves the properties of the current APIKey object.- Returns:
- A dictionary containing the properties (if any) of the current APIKey object. 
 
 - reset()
- Resets the API Key for the Item. The call will return the information with the new API Key information. - Returns:
- A dictionary with the APIKey object information 
 
 - update(http_referers: list[str] = None, privileges: list[str] = None)
- The - updatemethod updates the current APIKey object’s properties- Parameter - Description - http_referers - Optional List. A list of the http referrers for which usage of the API Key will be restricted to. - Example - ` [ "https://foo.com", "https://bar.com" ] `- Note: Http Referrers can be configured for non apiKey type apps as well. The list configured here will be used to validate the app tokens sent in while accessing the sharing API. The referrer checks will not be applied to user tokens. - privileges - Optional List. A list of the privileges that will be available for this API key. - Example - [ “portal:apikey:basemaps”, “portal:app:access:item:itemId”, “premium:user:geocode”, “premium:user:networkanalysis” ] - Note: Privileges can be configured for non API Key type apps as well. The list configured here will be used to grant access to items when item endpoint is accessed with app tokens. The checks will not be applied to user tokens and they can continue accessing items based on the current item sharing model. With app tokens, all items of app owner can be accessed if the privileges list is not configured. - Returns:
- A dictionary 
 - # Usage Example >>> key1 = gis.api_keys.keys[0] >>> key1.update(http_referers = ["https://foo.com", "https://bar.com"], >>> privileges = ["portal:apikey:basemaps", >>> "portal:app:access:item:itemId", >>> "premium:user:geocode", >>> "premium:user:networkanalysis"]) 
 
ProfileManager
- class arcgis.gis._impl._profile.ProfileManager
- Bases: - object- The - ProfileManagerclass allows for the controls and management of the profiles stored on the local operating system.- create(profile: str, url: str | None = None, username: str | None = None, password: str | None = None, key_file: str | None = None, cert_file: str | None = None, client_id: str | None = None)
- The - createmethod adds a new entry into the Profile Store.- Parameter - Description - profile - Required String. The name of the profile to add. - url - Optional String. The site url. - username - Optional String. The login user name. - password - Optional String. The login user password. - key_file - Optional String. The key file for PKI security. - cert_file - Optional String. The cert file for PKI security. - client_id - Optional String. The client ID for oauth login. - Returns:
- A boolean indicating success (True), or failure (False) 
 - # Usage Example >>> gis.ProfileManager.create("profile_name", >>> url= "www.foo.com", >>> username = "User1234", >>> password = "Password1234", >>> key_file = "key_file", >>> cert_fle = "cert_file_name") 
 - delete(profile: str)
- The - deletemethod deletes a profile permanently from the .arcgisprofile file- Parameter - Description - profile - Required String. The name of the profile to delete. - Returns:
- A boolean indicating success (True), or failure (False) 
 - # Usage Example >>> gis.ProfileManager.delete("profile_name") 
 - get(profile: str)
- The - getmethod retrieves the profile information for a given entry.- Parameter - Description - profile - Required String. The name of the profile to get the information about. - Returns:
- A dictionary 
 - # Usage Example >>> gis.ProfileManager.get("profile_name") 
 - list(as_df: bool = False)
- The - listmethod retrieves a list of profile names in the configuration file- Returns:
- List if as_df=False or Pandas DataFrame if as_df=True 
 
 - save_as(profile: str, gis: GIS)
- The - save_asmethod saves and adds the provided- GISobject to the profile.- Parameter - Description - name - Required String. The name of the profile to save. - gis - Required GIS. The connection object to update the profile with. - Returns:
- Boolean. True if successful else False 
 - # Usage Example >>> gis = GIS("pro") >>> gis.ProfileManager.save_as("Profile_name", gis) 
 - update(profile: str, url: str | None = None, username: str | None = None, password: str | None = None, key_file: str | None = None, cert_file: str | None = None, client_id: str | None = None)
- The - updatemethod updates an existing profile in the credential manager.- Parameter - Description - profile - Required String. The name of the profile to update. - url - Optional String. The site url. - username - Optional String. The login user name. - password - Optional String. The login user password. - key_file - Optional String. The key file for PKI security. - cert_file - Optional String. The cert file for PKI security. - client_id - Optional String. The client ID for oauth login. - Returns:
- A boolean indicating success (True), or failure (False) 
 - # Usage Example >>> gis.ProfileManager.update(profile = "profile_name1", >>> username = "User12345", >>> key_file = "new_key_file") 
 
InvitationManager
- class arcgis.gis._impl._invitations.InvitationManager(url, gis)
- Bases: - object- The - InvitationManagerprovides functionality to see the existing invitations set out via email to your organization.- Note - The manager has the ability to delete any invitation sent out by an organization. - delete(invite_id: str)
- The - deletemethod deletes an invitation by ID- Returns:
- A boolean indicating success (True), or failure (False) 
 
 - get(invite_id: str)
- The - getmethod retrieves information about a single invitation.- Returns:
- A dictionary 
 
 
CertificateManager
- class arcgis.gis._impl.CertificateManager(gis)
- Bases: - object- The - CertificateManagerclass provides the administrator the ability to register and unregister certificates with the- GIS.- Note - This resource is available via HTTPS only. - add(name: str, domain: str, certificate: str)
- The - addmethod allows allows administrators to register custom X.509 HTTPS certificates with their ArcGIS Online organizations. This will allow ArcGIS Online organization to trust the custom certificates used by a remote server when making HTTPS requests to it, i.e. store credentials required to access its resource and share with others.- Note - A maximum of 5 certificates can be registered with an organization. - Parameter - Description - name - Required String. The certificate name. - domain - Required String. Server domain that the certificate is used for. - certificate - Required String. Base64-encoded certificate text, enclosed between - —–BEGIN CERTIFICATE—– and —–END CERTIFICATE—–. - Returns:
- A boolean indicating success (True), or failure (False) 
 - # Usage Example >>> gis.admin.certificates.add(name="certificate_name", >>> domain = "domain_name", >>> certificate = "certificate_text") 
 - property certificates
- The - certificatesproperty retrieves the list of certificates registered with the organization- Returns:
- A List containing the information of registered certificates 
 
 - delete(cert_id: str)
- The - deletemethod unregisters the certificate from the organization.- Parameter - Description - cert_id - Required String. The ID of the certificate to delete. - Returns:
- A boolean indicating success (True), or failure (False) 
 - # Usage Example >>> gis.admin.certificates.delete(cert_id="certificate_id") 
 - get(cert_id: str)
- The - getmethod retrieves the certificate information for a single certificate- Parameter - Description - cert_id - Required String. The ID of the certificate to delete. - # Usage Example >>> gis.admin.certificates.get(cert_id= "certificate_id") - Returns:
- A Dictionary (if found), else None 
 - The dictionary contains the following information: - Key - Value - id - The ID of the registered certificate. - name - The certificate name. - domain - Server domain that the certificate is used for. - sslCertificate - Base64-encoded certificate text, enclosed between —–BEGIN CERTIFICATE—– and —–END CERTIFICATE—–. 
 - property properties
- The - propertiesmethod retrieves the properties of the certificate- Returns:
- A list of the certificate properties 
 
 - update(cert_id: str, name: str | None = None, domain: str | None = None, certificate: str | None = None)
- The - updateoperation allows organization’s administrators to update a registered custom X.509 HTTPS certificate.- Parameter - Description - cert_id - Required String. The ID of the certificate to delete. - name - Optional String. The certificate name. - domain - Optional String. Server domain that the certificate is used for. - certificate - Optional String. Base64-encoded certificate text, enclosed between ` - —–BEGIN CERTIFICATE—–` and —–END CERTIFICATE—–. - Returns:
- A boolean indicating success (True), or failure (False) 
 - # Usage Example >>> gis.admin.certificates.update(cert_id ="certificate_id", >>> name = "certificate_name", >>> domain ="certificate_domain", >>> certificate = "certificate_text") 
 
PortalDataStore
- class arcgis.gis._impl._datastores.PortalDataStore(url, gis)
- Bases: - object- The - PortalDatastoreobject provides access to operations that allow you to manage and work with user-managed data store items . Access an instance of this class using the datastore property of a- GISobject.- >>> gis = GIS("organization url", "username", "<password>") >>> >>> portal_dstore = gis.datastore >>> type(portal_dstore) <class 'arcgis.gis._impl._datastores._ds.PortalDataStore'> - With this class you can: - Validate a data store item against your server. 
- Register a data store item to your server. 
- Retrieve a list of servers your data store item is registered to. 
- Refresh your data store registration information on the server. 
- Unregister a data store from your server. 
- Publish and retrieve layers in bulk, and delete bulk-published layers. 
 - See User-managed data stores for detailed explanation of the item types this class manages. Also, see Data Item for technical details on managing server side components. - Note - This class provides different functionality than the - Datastoreobject which is used for data stores registered directly with a- Server.- delete_layers(item)
- The - delete_layersmethod removes all layers published from a database data store- Item.- Note - Before a data store - Itemcan be unregistered from a server, all of its bulk-published layers must be deleted.- Parameter - Description - item - Required Item. The database data store - Itemfrom which to delete all the published layers.- # Usage Example >>> # Get data store item sourced by a database >>> db_dsitem = gis.content.get("<item_id of data store item>") >>> >>> portal_ds = gis.datastore >>> portal_ds.delete_layers(db_dsitem) - Returns:
- A boolean indicating success ( - True), or failure (- False)
 
 - describe(item, server_id, path, store_type='datastore')
- The - describemethod is used to list the contents of a data store added to Enterprise as a data store item. A client can use this method multiple times to discover the contents of the data store incrementally. For example, the client can request a description of the root, and then request sub-folders.- Parameter - Description - item - Required Item. The data store - Itemto describe.- server_id - Required String. The unique id of the server the item is registered to. - Note - You can retrieve the server_id value from the dictionary returned by the federation. - # Retrieve server ids >>> gis_federation = gis.admin.federation.servers >>> >>> server_list = gis_federation["servers"] >>> server_list >>> >>> [{'id': 'W2ozgK50Le9CjrI4', 'name': 'mymachine.domain.com:6443', 'url': 'https://mymachine.domain.com/mywebadaptor_name', 'isHosted': True, 'adminUrl': 'https://mymachine.domain.com:6443/arcgis', 'serverRole': 'HOSTING_SERVER', 'serverFunction': '', 'webgisServerTrustKey': ''}] >>> >>> host_id = server_list[0]["id"] - path - Required String. The path to any data store’s root (“/”), or the path to a sub-folder or entity inside the root. - store_type - Required String. For root resource the object type should be datastore, and for sub-entities, the value depends upon data type of the data store. Value can be determined by looking at - typevalues returned by- describe()- # Usage Example: Data store item added using an enterprise geodatabase >>> ds_items = gis.content.search("*", item_type="Data Store") >>> >>> for ds_item in ds_items: >>> print(f"{ds_item.title:33}{ds_item.id}{' '*2}{ds_item.get_data()['type']}") >>> City_Service ea9a628b037........7cf29eda554d3 bigDataFileShare CityParks2 Datastore Item API a188c1f5b42........eb1f8dea03a8e egdb various_imagery c6971f24a25........fe22d7142f835 folder >>> >>> egdb_dsitem = ds_items[1] >>> >>> portal_ds = gis.datastore >>> >>> describe_job = portal_ds.describe(item=egdb_dsitem, server_id=host_id, path="/", store_type="datastore") >>> >>> while describe_job.status == "processing": >>> continue >>> if describe_job.status == "succeeded": >>> describe_egdb = describe_job.result() >>> else: >>> print(f"Job status: {describe_job.status}") >>> print(f"Job messages: {describe_job.messages}") >>> >>> describe_egdb {'id': '6bd436223f2b433285f58cf1df5bccef', 'definition': {'operation': 'describe', 'datastoreId': 'a25ae2f4c4674bf4799eb2f4fdae3b8f', 'serverId': 'K2ozgC10aL6ECdm2', 'path': '/', 'type': 'datastore'}, 'status': 'succeeded', 'created': 166512637...1, 'modified': 16574263...8, 'messages': [], 'result': {'datastore': {'name': 'world_db_0klt50rsl52d4', 'type': 'egdb', 'path': '/', 'datastoreId': 'a25ae2f4c4674bf4799eb2f4fdae3b8f'}, 'children': [{'name': 'world.DATAo.World_Data', 'displayName': 'World_Data', 'type': 'featureDataset', 'datastoreId': 'a25ae2f4c4674bf4799eb2f4fdae3b8f', 'path': '/world.DATAo.World_Data'}, {'name': 'world.DATAo.Forest_Landscapes', 'displayName': 'Forest_Landscapes', 'type': 'featureDataset', 'datastoreId': 'a25ae2f4c4674bf4799eb2f4fdae3b8f', 'path': '/world.DATAo.Forest_Landscapes'}]}} >>> >>> # describe sub-entity of the database data store >>> >>> describe_job_sub = portal_ds.describe(item=egdb_dsitem, server_id=host_id, path="/world.DATAo.Forest_Landscapes'", store_type="featureDataset") - Returns:
- A - StatusJobobject
 
 - layers(item)
- The - layersoperation returns a list of layers bulk published from a database data store item using the- publish_layers()method.- Note - The - layersmethod returns a list of dictionaries. Each dictionary contains a layer key and a dataset key for each layer created during publishing.- Parameter - Description - item - Required Item. The data store - Itemto list all published layers and registered datasets.- # Usage Example >>> ds_items = gis.content.get("*", item_type="Data Store") >>> >>> db_dsitem = [ds >>> for ds in ds_items >>> if ds.get_data()["type"] == "egdb"][0] >>> >>> portal_ds = gis.datastore >>> >>> portal_ds.layers(db_dsitem) [{'layer': {'id': '059...711', 'title': 'Boundary_GTM', 'created': 1667433642607, 'modified': 1667433732631, 'url': 'https://<url>/<webadaptor>/rest/services/<folder_name>/Boundary_GTM/FeatureServer', 'type': 'Feature Service'}, 'dataset': {'name': 'world.dto.CountryBoundary_GTM', 'displayName': 'CountryBoundary_Guatemala', 'type': 'featureClass', 'datastoreId': 'ad38...01b8e', 'path': '/world.dto.GTM_Datasets/world.dto.Boundary_GTM'}}, . . . {'layer': {'id': '0d5a6e6f2003483ba987eb044ca4dec6', 'title': 'dk_lau_2016', 'created': 1667433476227, 'modified': 1667433605914, 'url': 'https://<url>/<webadaptor>/rest/services/<folder_name>/dk_lau_2016/MapServer', 'type': 'Map Service'}, 'dataset': {'name': 'world.dto.dk_lau_2016', 'displayName': 'dk_lau_2016', 'type': 'table', 'datastoreId': 'ad38...01b8e', 'path': '/world.dto.dk_lau_2016'}}] - Returns:
- A list of dictionaries. For each layer, a dictionary of information about the layer and the source dataset from which it was published. 
 
 - property properties
- The - propertiesproperty retrieves the properties of the current- PortalDataStoreobject- Returns:
- A dictionary of properties pertaining to the - PortalDataStore
 
 - publish(config: dict, server_id, folder=None, description=None, tags: list | str = None)
- The - publishoperation is used to publish services by reference from specific datasets in a data store.- Parameter - Description - config - Required Dictionary. This is the service configuration property and it must contain the reference to the data in the data store. It specifies the data store Id and the path of the data. A client can discover the proper paths of the data by using the - describe()method.- Note - The - cacheStoreIdvalue for this dictionary corresponds to the datastore id value.- # Example format >>> config = {"type":"SceneServer", >>> "serviceName":"sonoma", >>> "properties":{"pathInCachedStore":"/v17_i3s/SONOMA_LiDAR.i3srest", >>> "cacheStoreId":"d7b072...00d9"}} - server_id - Required String. The unique Id of the server to publish to. - Note - Any - Serverid can be obtained from the dictionary returned by by the- serversproperty of- Federationobjects.- folder - Optional String. The name of the folder on the server to store the service. If none is provided, it is placed in the root. - description - Optional String. An optional string to attach to the generated - Item.- tags - Optional list. An array of descriptive words that describes the newly published - Item.- # Usage Example >>> portal_ds = gis.datastore >>> >>> service_config = {"type":"SceneServer", >>> "serviceName":"sonoma", >>> "properties":{"pathInCachedStore":"/v17_i3s/SONOMA_LiDAR.i3srest", >>> "cacheStoreId":"d7b072...00d9"}} >>> >>> server_list = gis.admin.Federation.servers["servers"] >>> gis_server_id = [s["id"] >>> for s in server_list >>> if s["serverRole"] == "HOSTING_SERVER"] >>> >>> pub_job = portal_ds.publish(config= service_config, >>> server_id= gis_server_id) >>> >>> if pub_job.status == "succeeded": >>> published_item = pub_job.result() - Returns:
- A - StatusJobobject
 
 - publish_layers(item: Item, srv_config: dict[str, Any], server_id: str, *, folder: str | None = None, server_folder: str | None = None, sync_metadata: bool | None = None, use_config: bool | None = None)
- The - publish_layersoperation publishes, or syncs, the datasets from a database data store- Item. This results in at least one layer per dataset.- Note - When this operation is called for the first time, an argument for every parameter must be provided. On subsequent calls, this method will synchronize the datasets in the data store with the layers created in the Enterprise, which includes both publishing layers from newly added datasets and removing layers for datasets no longer found in the data store. - Parameter - Description - item - Required Item. The data store - Itemholding the content to publish.- srv_config - Required Dict. The JSON that will be used as a template for all the services that will be published or synced. This JSON can be used to change the properties of the output map and feature services. - Note - Only map service configurations with feature services enabled are supported by this parameter. - server_id - Required String. The serverId that the datasets will be published to. - Note - Use gis.admin.federation.servers to get the id values for individual servers federated with the Enterprise portal. - folder - Required String. The folder to which the datasets will be published. - Note - This folder must exist in the Enterprise portal. - server_folder - Required String. The name of the server folder. - Note - If this folder does not exist, the method will create it. - sync_metadata - Optional bool. Determines if item info details are updated using the metadata of the source dataset when a sync is performed. The default is false. - use_config - Optional bool. When true, the new srv_config will be applied to all layers. - Returns:
- Boolean object. 
 - # Usage Example: bulk publishing from enterprise geodatabase data store item >>> ds_items = gis.content.search("*", item_type="Data Store") >>> >>> db_dsitem = [ds for ds in ds_items if ds.get_data()["type"] == "egdb"][0] >>> >>> portal_folderid = [f["id"] >>> for f in gis.users.me.folders >>> if f.name == "My_Bulk_Layers_Folder"] >>> >>> service_template = {"serviceName": None, >>> "type": "MapServer", >>> "capabilities":"Map,Query", >>> "extensions": [{"typeName": "FeatureServer", >>> "capabilities":"Query,Create,Update,Delete", >>> "enabled": "true", >>> "properties": {"maxRecordCount": 3500}}]} >>> >>> >>> portal_ds = gis.datastore >>> >>> bulk_publish_job = portal_ds.publish_layers(item = db_dsitem, >>> srv_config = service_template, >>> server_id = host_id, >>> folder = portal_folderid, >>> server_folder="bulk_egdb_layers") >>> bulk_publish_job True 
 - refresh_server(item, server_id)
- The - refresh_servermethod updates the server with information that changed in the data store. See Manage data store items for more information.- Note - After a data store - Itemhas been registered, there may be times in which the registration information may be changed. When changes like these occur, the server will need to be updated with the newly configured information so that your users will still be able to access the data store item without interruption.- Warning - This operation can only be performed after the data store information has been updated. - Parameter - Description - item - Required data store - Itemor item id (as string). The data store to register with the server. Note that a data store can be registered on multiple servers.- server_id - Required String. The unique id of the server you want to register the datastore with. - # Usage Example >>> portal_ds = gis.datastore >>> >>> ds_item = gis.content.search("*", item_type="Data Store")[0] >>> server_list = gis.admin.federation.servers["servers] >>> >>> host_id = [s["id"] >>> for s in server_list >>> if s["serverRole"] == "HOSTING_SERVER][0] >>> >>> portal_ds.refresh_server(item = ds_item, server_id = host_id) - Returns:
- A boolean indicating success (True), or failure (False) 
 
 - register(item, server_id, bind=False)
- The - registermethod allows for a data store- Itemthat has been added to the Enterprise portal to be registered with Enterprise servers.- Note - Before registering a data store - Item, it is recommended that you- validate()it with the server.- Parameter - Description - item - Required data store - Itemor Item Id string.- Note - A data store - Itemcan be registered on multiple servers.- server_id - Required String. The unique id of the server you want to register the data store item with. - bind - Optional Boolean. Specifies whether to bind the data store item to the federated server. For more information about binding a data store to additional federated servers, see the note below. The default value is - False.- # Usage Example: adding data store item sourced by an enterprise # geodatabase and registering with server >>> # Get the server id value for registration >>> servers_dict = gis.admin.federation.servers >>> server_list = servers_dict["servers"] >>> host_id = [srvr["id"] >>> for srvr in server_list >>> if srvr["serverRole"] == "HOSTING_SERVER"][0] >>> >>> # Get the host server's DataStoreManager to create an >>> # encrypted password string for the database >>> host = gis.admin.servers.get(role="HOSTING_SERVER")[0] >>> host_dsmgr = host.datastores >>> conn_file_sql = r"/pathway/to/connection_file/your_connection.sde" >>> conn_string = host_dsmgr.generate_connection_string(conn_file_sql) >>> >>> # Add the data store item to the Enterprise Portal >>> text_param = {"info": {"isManaged": False, >>> "dataStoreConnectionType": "shared", >>> "connectionString": conn_string}, >>> "type": "egdb", >>> "path": "/enterpriseDatabases/sql_server_datastore"} >>> item_properties = {"title": "SqlServer Datastore Item API", >>> "type": "Data Store", >>> "tags": "api_created,datastore_item,bulk_publishing", >>> "snippet": "Adding a datastore item to use api for management."} >>> >>> ds_item = folder.add(item_properties=item_properties, >>> text=text_param).result() >>> >>> # Get the Enterprises PortalDataStore and register with the server >>> portal_ds = gis.datastore >>> >>> portal_ds.register(item=ds_item, >>> server_id=host_id, >>> bind=False) - Returns:
- A boolean indicating success (True), or failure (False) 
 - Note - To create a data store - Itemfrom a data store previously registered with an Enterprise Server, see the Create a data store item from an existing data store page in the Enterprise Portal documentation.
 - servers(item)
- The - serversproperty returns a list of your servers that a given data store has been registered to. This operation returns the serverId, the server name, both the server and admin URLs, and whether or not the server is hosted.- Parameter - Description - item - Required Item. The data store - Itemto for which to list all registered servers.- # Usage Example >>> # Get a data store item >>> ds_item = gis.content.search("*", item_type="Data Store)[0] >>> >>> server_list = gis.datastore.servers(ds_item) >>> server_list[0] [{'id': 'T4omqC59LaH4vLi0', 'name': 'jserver.domain.com:6443', 'adminUrl': 'https://server.domain.com:6443/arcgis', 'url': 'https://jserver.domain.com/server', 'isHosted': True, 'serverType': 'ArcGIS', 'serverRole': 'HOSTING_SERVER', 'serverFunction': ''}] - Returns:
- A list of dictionaries with metadata about each server the item is registered with. 
 
 - unregister(item, server_id)
- The - unregistermethod removes the data store from the list of data stores on the server.- # Usage Example >>> ds_item = gis.content.get("<item id of data store>") >>> >>> server_info = gis.admin.federation.servers["servers"][0] >>> server_id = server_info["id"] >>> >>> gis.datastore.unregister(item = dsitem, >>> server_id = server_id) - Returns:
- A boolean indicating success (True), or failure (False) 
 
 - validate(server_id, item=None, config=None, future=False)
- The - validatemethod ensures that your ArcGIS Server can connect and use use the datasets accessed by a given data store item. The data store- Itemcan be validated by using either the id property, or an item object tself as the item argument.- Note - While this operation can be called before or after the data store item has been registered, it is recommended to validate before registration on the server. - Parameter - Description - server_id - Required String. The unique id of the server with which you want to register the data store. - item - Optional. The item id or data store - Itemto validate. Required if no- configprovided.- Note - A single data store item can be registered on multiple servers. - config - Optional dict. The connection information for a new datastore. Required if no - itemprovided.- future - Optional bool. Indicates whether to run the validate operation asynchronously. The default is False. - # Usage Example: Validating an added item against the Enterprise Raster Analytics server >>> gis = GIS(url="<url to GIS>", username="<username>", password="<password>") >>> >>> ds_item = gis.content.search("*", item_type="data store")[0] >>> >>> server_list = gis.admin.federation.servers["servers] >>> raster_id = [srv["id"] >>> for srv in server_list >>> if srv["function"] == "RasterAnalytics"][0] >>> >>> portal_ds = gis.datastore >>> portal_ds.validate(server_id = raster_id, >>> item = ds_item) - Returns:
- A boolean indicating success (True), or failure (False) 
 
 
StatusJob
- class arcgis.gis._impl._jb.StatusJob(future, op, jobid, gis, notify=False, extra_marker='Group', key=None)
- Bases: - object- Represents a Single Geoprocessing Job. The GPJob class allows for the asynchronous operation of any geoprocessing task. To request a GPJob task, the code must be called with future=True or else the operation will occur synchronously. This class is not intended for users to call directly. - Parameter - Description - future - Required current.futures.Future. The async object. - op - Required String. The name of the operation performed. - jobid - Required String. The unique ID of the job. - gis - Required GIS. The GIS connection object - notify - Optional Boolean. When set to True, a message will inform the user that the geoprocessing task has completed. The default is False. - extra_marker - Optional String. An extra piece of text to place infront of the Job string for the __repr__ object. - cancel() bool
- Cancels the Future process to end the job locally. Import/Export jobs cannot be terminiated on server. - Returns:
- Boolean 
 
 - done() bool
- Return True if the call was successfully cancelled or finished running. - Returns:
- Boolean 
 
 - result()
- Return the value returned by the call. If the call hasn’t yet completed then this method will wait. - Returns:
- Object 
 
 
MarketPlaceManager
- class arcgis.gis.sharing.MarketPlaceManager(gis: GIS)
- Bases: - object- Provides the ability for the manager to list and unlist marketplace items - customer_list(itemid: str | None = None, orgname: str | None = None, status: str = 'all', type: str = 'PURCHASE', modified: str | None = None, sort_fields: str | None = None, sort_order: str = 'asc', include_listing: bool = True, num: int = 10, start: int = 1) dict
- The customers_list resource returns a list of purchases, trials, and interests expressed by customers for items listed by this organization in the marketplace. This operation allows filtering and sorting of provisions. - Parameter - Description - itemid - Optional String. The item id of the provision to be returned. - orgname - Optional String. Purchaser organization name of the provisions to be returned. - status - Optional String. Status of the listings to be returned. The default value is active. - Accepted values are:
- active: Only listings that are currently active will be returned 
- expired: Only listings that have already expired will be returned 
- all: Both active and expired listings will be returned 
 
 - type - Optional String. Access type of the provisions to be returned:
- REQUEST: Only provisions that have been requested will be returned. 
- TRIAL: Only trial provisions will be returned. 
- PURCHASE: Only subscription provisions will be returned. 
- REQUESTANDTRIAL: Both provisions that have been requested and trial provisions will be returned. 
- REQUESTANDPURCHASE: Both provisions that have been requested and subscriptions will be returned. 
- TRIALANDPURCHASE: Both trial provisions and subscriptions will be returned. 
 
 - Values: “REQUEST” | “TRIAL” | “PURCHASE” | “REQUESTANDTRIAL” | “REQUESTANDPURCHASE” | “TRIALANDPURCHASE” - modified - Optional String. The last modified date of the provisions to be returned. The date specified should be in milliseconds from epoch. - sort_field - Optional String. The fields to sort provisions by. The allowed sort field names are orgname, created, endDate, and modified. - sort_order - Optional String. Describe whether the order returns in ascending (asc) or descending (desc) order. The default is asc. - include_listing - Optional Boolean. If True, listing objects are included in the provision response. The default is True. - num - Optional Integer. The maximum number of provisions to be included in the result set response. The default value is 10, and the maximum allowed value is 100. The start parameter, along with the num parameter, can be used to paginate the query results. Note that the actual number of returned results may be less than num. This happens when the number of results remaining after start is less than num. - start - Optional Integer. The number of the first entry in the result set response. The index number is 1-based. The default value of start is 1. (i.e. the first search result). The start parameter, along with the num parameter, can be used to paginate the query results. - Returns:
- A dictionary. 
 
 - delete_provision(itemid: str) dict
- This operation deletes all provisions to this item for the specified purchaser. - This operation cannot be invoked if the item has not been provisioned to the specified purchaser. - Note - Only vendor org admins can invoke this operation. - Parameter - Description - itemid - Required String. The item id. - Returns:
- A dictionary with syntax: {“success”: <true | false>,”itemId”: “<itemId>”,”purchaserOrgId”: “<purchaserOrgId>”}
 
 - express_interest(itemid: str) dict
- A purchaser can express interest in a marketplace listing by invoking this operation. - This operation cannot be invoked if the item has already been purchased or if the purchaser has previously expressed interest. - Only administrators and members with request purchase information privilege of purchasing orgs can invoke this operation. - Note that interests cannot be expressed for free listings, because they can be directly purchased by purchasing org admins or members with request purchase information privilege. - Parameter - Description - itemid - Required String. The item id. - Returns:
- A dictionary of the listed item with properties. 
 
 - list(itemid: str) dict
- This operation lists the item in the marketplace. - This operation is only available to organizations that have permissions to list items in the marketplace. The permissions are returned with the Portal Self response. - The listing properties must be specified for the item before calling this operation. This operation will fail if listing properties have not already been specified. - Listing an item will set its listed property to true. - This operation is available to the user and to the administrator of the organization to which the user belongs. - Returns:
- A dictionary indicating success or failure and the item id of the listed item. 
 
 - listing(itemid: str) dict
- A listing in the marketplace. The listing and its corresponding item share the same ID. - Parameter - Description - itemid - Required String. The item id. - Returns:
- A dictionary of the listed item with properties. 
 
 - listings(query: str = '*', my_listings: bool = False, start: int = 1, num: int = 10, sort_field: str | None = None, sort_order: str = 'asc') dict
- This operation searches for marketplace listings. The searches are performed against a high performance index that indexes the most popular fields of a listing. - By default, this search spans all public listings in the marketplace. However, if you’re logged in as a vendor org admin and you specify the my_listings=true parameter, it then searches all public and private listings in your organization. - Parameter - Description - query - Optional string. The query string to use to search. - my_listings - Optional boolean. If True and you’re logged in as a vendor org admin, it searches all public and private listings in your organization. Note that if my_listings=True, the query parameter is optional. Default is False. - start - Optional integer. The number of the first entry in the result set response. The index number is 1-based. - The default value of start is 1. (i.e., the first search result). - The start parameter, along with the num parameter, can be used to paginate the search results. - num - Optional integer. The maximum number of results to be included in the result set response. - The default value is 10, and the maximum allowed value is 100. - The start parameter, along with the num parameter, can be used to paginate the search results. - Note that the actual number of returned results may be less than num. This happens when the number of results remaining after start is less than num. - sort_field - Optional string. The field to sort by. You can also sort by multiple fields (comma separated) for listings, sort field names are case-insensitive. - Supported sort field names are: “title”, “created”, “listingpublisheddate”, “type”, “owner”, “avgrating”, “numratings”, “numcomments”, and “numviews” - sort_order - Optional string. Describes whether the order returns in ascending(asc) or descending(desc) order. Default is asc. - Returns:
- A dictionary with response syntax of: {“query”: “<query string>”,”total”: <total number of results>,”start”: <results in first set>,”num”: <number of results per page>,”nextStart”: <result number of next page>,”listings”: [{<listing1>}, {<listing2>}]}
 
 - provision_org_entitlements(itemid: str, purchaser_org_id: str, purchaser_subscription_id: str | None = None, org_entitlements: dict | None = None) dict
- For a license-by-user listing, selling organization administrator or members can use this operation to provision entitlements to a purchasing organization. It can only be made if the item has already been purchased, or is being tried by the purchasing org. - This operation is HTTPS only for Esri apps that require a signature, otherwise it can be either for provider apps. - It can only be invoked by org admins or members with request purchase information privilege. - Parameter - Description - itemid - Required String. The item id. - purchaser_org_id - Required String. The org ID of the purchasing organization - purchaser_subscription_id - Optional String. The subscription(SMS) ID of the purchasing organization. - org_entitlements - Required Dictionary. A JSON object representing the set of entitlements available to the purchasing org. - Example: {“maxUsers”: 10,“entitlements”: {“standard”: {“num”: 8}, (‘standard’ is an entitlement string that uniquely identifies entitlement, listingID is used typically for provider apps)“advanced”: {“num”: 2},“spatialAnalyst”: {“num”: 2}}}- Returns:
- A dictionary of the provision item. 
 
 - provision_user_entitlements(itemid: str, user_entitlements: dict) bool
- For a license-by-user listing, purchasing organization administrator can use this operation to provision entitlements to org members. It can only be made if the item has already been purchased, or is being tried by the purchasing org. A maximum of 25 users can be provisioned in one request. - Parameter - Description - itemid - Required String. The item id. - user_entitlements - Required Dictionary. A JSON object representing the set of entitlements assigned to the specified set of users. - Example: {“users”: [“username1”, “username2”],“entitlements”: [“standard”, “networkAnalyst”] (“standard” is an entitlement string that uniquely identifies entitlement, listing itemId is used typically for provider apps)}- Only members of the purchasing org can be specified in the request. - Specified entitlements are assigned to all specified users. If different sets of entitlements are to be assigned to different users, multiple requests with this operation are required. - When there is no entitlements specified, it will revoke access to the item completely for the specified users. - The total number of currently provisioned users plus users specified in requests should be no larger than the maximum number of users allowed for the purchasing org. - Returns:
- A boolean indicating success (True) or failure (False). 
 
 - purchase(itemid: str, purchase_org_id: str | None = None, provisioned_itemid: str | None = None, end_date: str | None = None) dict
- Parameter - Description - itemid - Required String. The item id. - purchase_org_id - Required String. The org ID of the purchaser organization. This parameter is required only when the call is made by the vendor. It is ignored otherwise. - provisioned_itemid - Required String. The ID of the item to be provisioned if different from the one listed. - Note that the listed item and the provisioned item must be related by the Listed2Provisioned relationship otherwise it will result in an error. - This parameter is allowed only when the call is made by the vendor. It is ignored otherwise. - end_date - Required String. The end/expiry date of this purchase if any. If this parameter is not specified, it implies an unexpiring purchase. The end date specified should be in milliseconds from epoch. - Returns:
- A dictionary of the provision item. 
 
 - purchases(status: str = 'active') dict
- The purchases resource returns a list of purchases, trials, and interests expressed by this organization for items in the marketplace. - Parameter - Description - status - Optional String. Status of the listings to be returned. The default value is active. - Accepted values are:
- active: Only listings that are currently active will be returned 
- expired: Only listings that have already expired will be returned 
- all: Both active and expired listings will be returned 
 
 - Returns:
- A dictionary depicting the purchases, trials, and interests. 
 
 - trial(itemid) dict
- A purchaser can start a trial for a marketplace listing by invoking this operation. - This operation is only supported for listings that support trials (whose trialSupported property is true). Once started, the trial will be valid for the duration of the trial specified on the listing (the trialDuration property). - This operation cannot be invoked if the item has already been purchased or if the purchaser has started a trial previously. - Only admins or members with request purchase information privilege of purchasing orgs can invoke this operation. - Parameter - Description - itemid - Required String. The item id. - Returns:
- A dictionary of the provision item. 
 
 - unlist(itemid: str) dict
- This operation unlists a previously listed item from the marketplace. - Unlisting an item will reset its listed property to false. - This operation is available to the user and the administrator of the organization to which the user belongs. - Returns:
- A dictionary indicating success or failure and the item id of the listed item. 
 
 - user_entitlement(itemid: str, username: str) dict
- This resource allows user, purchasing organization administrator, and members with the manage licenses privilege to retrieve entitlements assigned to the user. - Parameter - Description - itemid - Required String. - username - Required String. 
 - user_entitlements(itemid: str) dict
- This operation allows purchasing organization administrators or a user with Manage Licenses privilege to retrieve all user entitlements assigned to users in their organization. - Parameter - Description - itemid - Required String. The item id. - Returns:
- A JSON document representing the set of entitlements assigned to the specified set of users. 
 
 
ViewManager
- class arcgis.gis.ViewManager(item: Item)
- Bases: - object- A helper class to work with hosted feature layer views created from hosted feature layer - items.- Objects of this class are not meant to be created, but rather accessed from the - view_managerproperty on a feature layer or feature layer view- Item.- # Usage Example: Accessing a ViewManager >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_organization_profile") >>> view_item = gis.content.get("<view_item_id>") >>> vw_mgr = view_item.view_manager >>> vw_mgr <arcgis.gis.ViewManager object at <mem_addr>> - create(name: str, spatial_reference: dict[str, Any] | None = None, extent: dict[str, int | float] | None = None, allow_schema_changes: bool = True, updateable: bool = True, capabilities: str = 'Query', view_layers: list[int] | None = None, view_tables: list[int] | None = None, *, description: str | None = None, tags: str | None = None, snippet: str | None = None, overwrite: bool | None = None, set_item_id: str | None = None, preserve_layer_ids: bool = False, visible_fields: list[str] | None = None, query: str | None = None) Item
- Creates a view of an existing feature service Item. You can create a view if you need a different view of the data represented by a hosted feature layer. For example, you want to apply different editor settings, styles or filters or define which features or fields are available, or share the data to different groups than the hosted feature layer. - When you create a feature layer view, a new hosted feature layer - Itemis added to your content. This new layer is a view of the data in the- hosted feature layer, which means updates made to the data appear in the hosted feature layer and all of its hosted feature layer views. However, since the view is a separate layer, you can change properties and settings on this item separately from the hosted feature layer from which it is created.- For example, you can allow members of your organization to edit the hosted feature layer but share a read-only feature layer view with the public. - See Create hosted feature layer views to learn more details. - Parameter - Description - name - Required string. Name of the new view item - spatial_reference - Optional dict. Specify the spatial reference of the view - extent - Optional dict. Specify the extent of the view - allow_schema_changes - Optional bool. Default is True. Determines if a view can alter a service’s schema. - updateable - Optional bool. Default is True. Determines if view can update values - capabilities - Optional string. Specify capabilities as a comma separated string. For example “Query, Update, Delete”. Default is ‘Query’. - view_layers - Optional list. Specify list of layers present in the - FeatureLayerCollectionyou want in the view.- view_tables - Optional list. Specify list of tables present in the - FeatureLayerCollectionyou want in the view- description - Optional String. A user-friendly description for the published dataset. - tags - Optional String. The comma separated string of descriptive words. - snippet - Optional String. A short description of the view item. - overwrite - Optional Boolean. If true, the view is overwritten, False is the default. - set_item_id - Optional String. If set, the item id is defined by the user rather than the system. The parameter requires ArcGIS Enterprise 11.1 or higher. - Note - This parameter is not available for ArcGIS Online. - preserve_layer_ids - Optional Boolean. Preserves the layer’s id on it’s definition when True. The default is False. - visible_fields - Optiona list[str]. A list of field you want to be visible. - query - Optional String. The SQL statement used to reduce the data shared with the view. - # USAGE EXAMPLE: Create a view from a hosted feature layer >>> flyr_item = gis.content.search("*", item_type="Feature Service")[0] >>> view_item = flyr_item.view_manager.create( name="flyr_view", extent={ "xmin" : -9982417.919074, "ymin" : 4370975.025460, "xmax" : -8954750.737665, "ymax" : 4769966.758480, "spatialReference" : { "wkid" : 102100, "latestWkid" : 3857 } }, view_layers=[ flyr_item.layers[0] ], allow_schema_changes=True, updateable=True, capabilities="Query,Update,Delete", ) - Returns:
- The view - Item.
 
 - create_join_layer(join_name: str, target_join_fields: list[str], join: Item | FeatureLayer, join_fields: list[str], join_type: JoinType, *, include_geometry: bool = True, owner: User | None = None)
- create_join_layer creates a table join on two different FeatureLayer services. - Parameter - Description - name - Required string. Name of the new view item - target_join_fields - Required list[str]. A list of fields to join on from the target. The size of the join_fields and target_join_fields must match. - join - Required FeatureLayer or Item. The child layer to perform the join on. - join_fields - Required list[str]. A list of fields to join on. The size of the join_fields and target_join_fields must match. - join_type - Required JoinType. The type of table join to perform. - include_geometry - Optional Boolean. If True (default) a geometry field will be included in the view. For Tables, this should be set to False. - owner - Optional User. If specified, the owner of the view will be this User over yourself. The owner must own all the service data. 
 - get_definitions(item: Item) list[ViewLayerDefParameter]
- Gets the - ViewLayerDefParameterobjects that define the views for the item argument.- Argument - Description - item - The view - Itemto return the view definitions for.- Returns:
- List of - ViewLayerDefParameterobjects or None.
 - # Usage Example: Getting ViewLayerDefParameter object from a view >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_organization_profile") >>> fsvc_items = gis.content.search("flyr_view", item_type="Feature Service") >>> view_item = [ vi for vi in fsvc_items if "View Service" in vi.typeKeywords ][0] >>> vw_mgr = view_item.view_manager >>> vw_def_list = vw_mgr.get_definitions(view_item) [<ViewLayerDefParameter>] >>> vw_def = vw_def_list[0] >>> vw_def.as_json() {'viewLayerDefinition': {'filter': {'geometry': {'rings': [[[-9982417.919074,4370975.02546], ... [-9982417.919074,4370975.02546]]], 'spatialReference': {'latestWkid': 3857, 'wkid': 102100}}, 'geometryType': 'esriGeometryPolygon', 'spatialRel': 'esriSpatialRelIntersects', 'inSR': {'latestWkid': 3857, 'wkid': 102100}}}, 'fields': [{'name': 'objectid', 'visible': True}, ... {'name': 'globalid', 'visible': True}] } 
 - list() list[Item]
- Provides all the views for a given Feature Layer - Item- Returns:
- List of feature layer view - itemsfor the hosted feature layer.
 - # Usage Example: >>> flyr_item = gis.content.get("<item_id>") >>> flyr_vw_items = flyr_item.view_manager.list() >>> flry_vw_items [<Item title:"flyr_view" type:Feature Layer Collection owner:gis_user>] 
 - update(layer_def: list[ViewLayerDefParameter] | None = None) bool
- Updates a view definition with new queries, geometries, and column visibilities. - Argument - Description - layer_def - List of - ViewLayerDefParameterobjects for modifying the layers.- Returns:
- Boolean 
 
 
Enumerations
ItemTypeEnum
MetadataFormatEnum
ServiceTypeEnum
SpatialRelationship
- class arcgis.gis._impl._dataclasses.SpatialRelationship(*values)
- Bases: - Enum- Parameter - Description - INTERSECTS - Query Geometry Intersects Target Geometry. - ENVELOPEINTERSECTS - Envelope of Query Geometry Intersects Envelope of Target Geometry. - INDEXINTERSECTS - Query Geometry Intersects Index entry for Target Geometry (Primary Index Filter). - TOUCHES - Query Geometry Touches Target Geometry. - OVERLAPS - Query Geometry Overlaps Target Geometry. - CROSSES - Query Geometry Crosses Target Geometry. - WITHIN - Query Geometry is Within Target Geometry. - CONTAINS - Query Geometry Contains Target Geometry. 
Dataclasses
ItemProperties
- class arcgis.gis._impl._dataclasses.ItemProperties(title: str, item_type: ItemTypeEnum | str, tags: list[str] | str | None = None, thumbnail: str | None = None, thumbnail_url: str | None = None, metadata: str | None = None, metadata_editable: bool | None = None, metadata_formats: MetadataFormatEnum | str | None = MetadataFormatEnum.ISO19139, type_keywords: list[str] | None = None, description: str | None = None, snippet: str | None = None, extent: str | list = None, spatial_reference: str | None = None, access_information: str | None = None, license_info: str | None = None, culture: str | None = None, properties: dict | str | None = None, app_categories: list[str] | None = None, industries: list[str] | None = None, listing_properties: dict | None = None, service_username: str | None = None, service_password: str | None = None, service_proxy: dict | None = None, categories: list[str] | None = None, text: dict | str | None = None, extension: str | None = None, overwrite: bool | None = None, file_name: str | None = None, classification: dict | None = None, api_token1_expiration: datetime | None = None, api_token2_expiration: datetime | None = None, is_personal_api_token: bool | None = None, subscription_type: str | None = None)
- Bases: - object- Item parameters correspond to properties of an item that are available to update on the - add()and- update()operations.- classmethod fromitem(item: Item) ItemProperties
- Loads the ItemProperties from an Item 
 - item_type: ItemTypeEnum | str
 - metadata_formats: MetadataFormatEnum | str | None = 'iso19139'
 
CreateServiceParameter
- class arcgis.gis._impl._dataclasses.CreateServiceParameter(name: str, output_type: ServiceTypeEnum | str = ServiceTypeEnum.FEATURE_SERVICE, itemid_to_create: str | None = None, overwrite: bool = False, service_description: str | None = '', is_view: bool = False, description: str | None = None, tags: list[str] | None = None, snippet: str | None = None, static_data: bool = True, max_record_count: int = 1000, query_formats: str = 'JSON', capabilities: str = 'Query', copyright_text: str | None = None, spatial_reference: dict | None = None, initial_extent: dict | None = None, allow_geometry_updates: bool | None = None, units: str | None = None, xssPreventionInfo: dict | None = None, provider: str | None = None, connection: dict | None = None)
- Bases: - object- The create service parameter description. - Parameter - Description - name - Required String. Name of the Service - output_type - Required - ServiceTypeEnumor string. The type of service to create.- service_description - Optional String. Description given to the service. - is_view - Optional Bool. Specifies if the request is generating a view. The default is False. - description - Optional String. A user-friendly description for the published dataset. - tags - Optional String. The tags for the resulting Item - snippet - Optional String. A short description of the Item. - static_data - Optional Boolean. Boolean value indicating whether the data changes. - max_record_count - Optional Integer. An integer value indicating any constraints enforced on query operations. - query_formats - Optional String. The formats in which query results are returned. The default is JSON. - capabilities - Optional String. Specify the service capabilities. - copyright_text - Optional String. Copyright information associated with the dataset. - spatial_reference - Optional Dictionary. All layers added to a hosted feature service need to have the same spatial reference defined for the feature service. When creating a new empty service without specifying its spatial reference, the spatial reference of the hosted feature service is set to the first layer added to that feature service. - initial_extent - Optional Dictionary. The initial extent set for the service. - allow_geometry_updates - Optional Boolean. Boolean value indicating if updating the geometry of the service is permitted. - units - Optional String. Units used by the feature service. - xssPreventionInfo - Optional Dictionary. A JSON object specifying the properties of cross-site scripting prevention. - overwrite - Optional Boolean. Overwrite an existing service when true. The default is False - itemid_to_create - Optional String. The item id to create. This is only valid on ArcGIS Enterprise. - output_type: ServiceTypeEnum | str = 'featureService'
 
ViewLayerDefParameter
- class arcgis.gis._impl._dataclasses.ViewLayerDefParameter(layer: FeatureLayer, query_definition: str | None = None, spatial_filter: SpatialFilter | None = None, fields: list[dict] | None = None)
- Bases: - object- When updating views, an ViewLayerDefParameter object can be provided to change the view definition. Objects of this class can be created directly, obtained from the - get_definitions()method of the- ViewManagerclass, or accessed using the- from_layer()method.- # Usage Example 1: Initializing an object directly >>> from arcgis.gis import GIS, ViewLayerDefParameter >>> from arcgis.gis import SpatialFilter, SpatialRelationship >>> from arcgis.geometry import Envelope, SpatialReference >>> gis = GIS(profile="your_organization_profile") >>> filter_geom = Envelope( iterable={ "xmin": -10571116.801669, "ymin": 3877172.713480, "xmax": -9897056.867736, "ymax": 4391087.518527, "spatialReference": { "wkid": 102100, "latestWkid": 3857 } } ) >>> spat_filter = SpatialFilter( goemetry= filter_geom, spatial_rel= SpatialRelationship.CROSSES, sr= SpatialReference({"latestWkid": 3857, "wkid": 102100}) ) >>> vw_def = ViewLayerDefParameter( layer= view_item.layers[0], query_definition= "unit_field IS NOT NULL", spatial_filter= spat_filter fields= [ {"name": "OBJECTID", "visible": True}, {"name": "unit_field", "visible": True}, {"name": "create_date", "visible": False}, {"name": "system_id", "visible": False} ] ) # Usage Example 2: Accessing from a Feature Layer view >>> from arcgis.gis import GIS >>> gis = GIS(profile="your_organization_profile") >>> view_item = gis.content.get("<item_id_for_view>") >>> vw_mgr = view_item.view_manager >>> vw_defs = vw_mgr.get_definitions(view_item) >>> vw_def - vw_defs[0] <ViewLayerDefParameter> >>> vw_def.as_json() {'viewLayerDefinition': {'filter': {'geometry': {'rings': [[[-9982417.919074,4370975.02546], [-9982417.919074,4769966.75848], [-8954750.737665,4769966.75848], [-8954750.737665,4370975.02546], [-9982417.919074,4370975.02546]]], 'spatialReference': {'latestWkid': 3857,'wkid': 102100}}, 'geometryType': 'esriGeometryPolygon', 'spatialRel': 'esriSpatialRelIntersects', 'inSR': {'latestWkid': 3857, 'wkid': 102100}}}, 'fields': [{'name': 'objectid', 'visible': True}, ... {'name': 'feature_code', 'visible': True}] } - fields: list[dict] | None = None
- A list of dictionaries indicating whether a specific field is to be visible in the view layer. Each dictionary must contain a name and visible key. If this property is not defined, all fields will be visible. - # Format for dictionary to define field visibility in a view >>> view_lyr_def = ViewLayerDefParameter( ... fields=[ {"name": <field_name>, "visible": True|False}, ... {"name": <field2_name>}, "visible": True|False} ] ) 
 - classmethod fromlayer(layer: FeatureLayerManager | FeatureLayer) ViewLayerDefParameter
- Creates a view layer definition parameter object from a feature layer or feature layer manager. - Parameter - Description - layer - Required - FeatureLayeror- FeatureLayerManagerobject.
 - layer: FeatureLayer
- A - FeatureLayerobject.
 - query_definition: str | None = None
- A string representing a where clause to filter records in the view. 
 - spatial_filter: SpatialFilter | None = None
- A - SpatialFilterobject.
 
SpatialFilter
- class arcgis.gis._impl._dataclasses.SpatialFilter(geometry: Point | Polygon | Polyline | Envelope | MultiPoint, spatial_rel: SpatialRelationship = SpatialRelationship.INTERSECTS, sr: SpatialReference | None = None)
- Bases: - object- Creates a spatial filter that can be used in query and create view operations. A SpatialFilter object is also returned from the - spatial_filterproperty of- ViewLayerDefParameterobjects.- #Usage Example 1: Get SpatialFilter from view >>> gis = GIS(profile="your_organization_profile") >>> view_item = gis.content.get("<view_item_id>") >>> vw_mgr = view_item.view_manager >>> vw_def = vw_mgr.get_definitions(view_item)[0] >>> vw_def.spatial_filter SpatialFilter() >>> vw_def.spatial_filter.sr {'latestWkid': 3857, 'wkid': 102100} >>> vw_def.spatial_filter.as_json() {'geometry': {'rings': [[[-9982417.919074, 4370975.02546], [-9982417.919074, 4769966.75848], [-8954750.737665, 4769966.75848], [-8954750.737665, 4370975.02546], [-9982417.919074, 4370975.02546]]], 'spatialReference': {'latestWkid': 3857, 'wkid': 102100}}, 'geometryType': 'esriGeometryPolygon', 'spatialRel': 'esriSpatialRelIntersects', 'inSR': {'latestWkid': 3857, 'wkid': 102100}} #Usage Example 2: Initialize a SpatialFilter >>> from arcgis.gis import SpatialFilter, SpatialRelationship >>> from arcgis.geomtry import Polygon, SpatialReference >>> filter_poly = Polygon( {'geometry': {'rings': [ [[-12942501.854427, 5403724.074921], [-12942126.536675, 5409036.448386], [-12933473.476917, 5408301.189862], [-12933489.152479, 5404117.456892], [-12942501.854427, 5403724.074921]] ], 'spatialReference': {'latestWkid': 3857, 'wkid': 102100} } } ) >>> spatial_filt = SpatialFilter( geometry= filter_poly, spatial_rel= SpatialRelationship.INTERSECTS, sr=SpatialReference({'latestWkid': 3857, 'wkid': 102100}) ) - geometry: Point | Polygon | Polyline | Envelope | MultiPoint
- An instance of an arcgis.geometry.Geometry class. Can be one of: 
 - spatial_rel: SpatialRelationship = 'esriSpatialRelIntersects'
- A member of the - SpatialRelationshipenumeration.
 - sr: SpatialReference | None = None
- A - SpatialReferenceobject
 
StatisticFilter
- class arcgis._impl.common._filters.StatisticFilter
- The definitions for one or more field-based statistics to be calculated during a query. To use, initialize an empty object, then populate it using the - add()method.- add(statisticType, onStatisticField, outStatisticFieldName=None)
- Adds the attribute field-based statistical metrics to calculate during a query. - Parameter - Description - statisticType - Required String. The stastic to calculate. Options: - count 
- sum 
- min 
- max 
- avg 
- stddev 
- var 
 - onStatisticField - Required String. The name of the attribute field whose values will be used to calculate statistics. - outStatisticFieldName - Optional String. The name of the field in the output table that will contain the result value. - # Usage example >>> from arcgis.gis import GIS, StatisticFilter >>> gis = GIS(profile='your_organization_profile') >>> hospitals_item = gis.content.get("<item_id>") >>> hosp_flyr = flyr_item.layers[0] >>> sfilter = StatisticFilter() >>> sfilter.add( >>> statisticType="avg", >>> onStatisticField="LICENSEDBE", >>> outStatisticFieldName="avg_HospitalBeds" >>> ) >>> sfilter.add( >>> statisticType="sum", >>> onStatisticField="MEDICAREBE", >>> outStatisticFieldName="sum_Medcare_Beds" >>> ) >>> stats = hosp_flyr.query( >>> where="1=1", >>> statistic_filter=sfilter, >>> group_by_fields_for_statistics="TYPE" >>> ) >>> stats.features [ {"attributes": {"avg_HospitalBeds": 214.32, "sum_Medcare_Beds": 8306, "TYPE": "GENERAL HOSPITAL"}}, {"attributes": {"avg_HospitalBeds": 28.6, "sum_Medcare_Beds": 143, "TYPE": "CRITICAL ACCESS HOSPITAL"}}, {"attributes": {"avg_HospitalBeds": 95.66, "sum_Medcare_Beds": 976, "TYPE": "PSYCHIATRIC HOSPITAL"}}, ] 
 - property filter
- Returns a list of dictionaries with key/value pairs reflecting the arguments used with the - add()method to populate the- StatisticFilter.- # Usage Example: Return from code used in the StatisticFilter.add() snippet >>> sfilter.filter [{'statisticType': 'avg', 'onStatisticField': 'LICENSEDBE', 'outStatisticFieldName': 'avg_HospitalBeds'}, {'statisticType': 'sum', 'onStatisticField': 'MEDICAREBE', 'outStatisticFieldName': 'sum_Medcare_Beds'}] 
 
Submodules
- arcgis.gis.admin module- AGOLAdminManager
- PortalAdminManager
- Kubernetes- KubernetesAdmin
- KbertnetesPy
- KubeServiceDirectory
- WebAdaptorManager
- ArchitectureManager
- ExternalContentManager
- LanguageManager
- DataStores
- DataStore
- DeploymentManager
- Deployment
- DeploymentProperty
- Job
- JobManager
- Backup
- BackupStoresManager
- BackupStore
- RecoveryManager
- LicenseManager
- LogManager
- Mode
- Overview
- KubeEnterpriseGroups
- KubeEnterpriseUser
- KubeOrganization
- KubeOrganizations
- KubeOrgFederations
- KubeOrgLicense
- KubeOrgSecurity
- KubeSecurity
- KubeSecurityCert
- KubeSecurityConfig
- KubeSecurityIngress
- KubeSecuritySAML
- KubeService
- HealthCheckManager
- SuitesManager
- Suite
- ReportManager
- Report
- ReportJob
- GPJobManager
- ServicesManager
- Container
- EnterpriseFunctions
- Indexer
- KubernetesNotebook
- KubeNotebookDataAccess
- KubeNotebookFile
- KubeNotebook
- KubeNotebookManager
- KubeRuntime
- KubeSnapshot
- KubeSnapshotManager
- Server
- ServerDefaults
- ServerManager
- SystemManager
- TaskManager
- UpgradeManager
- Uploads
- UsageStatistics
 
- AboutManager
- AGOLUsageReports
- Bundle
- CategoryManager
- ClassificationManager
- CollaborationManager
- Collaboration
- CreditManager
- DataStoreMetricsManager
- DataStoreAggregation
- DataStoreTimeUnit
- DataStoreMetric
- DeveloperCredential
- DeveloperCredentialManager
- TokenPrivilege
- License
- LicenseManager
- LivingAtlas
- LivingAtlasManager
- LivingAtlasJob
- IdentityProviderManager
- PasswordPolicy
- PartneredCollabManager
- PartneredCollaboration
- PortalResourceManager
- UX
- HomePageSettings
- ItemSettings
- MapSettings
- SecuritySettings
- EmailManager
- Federation
- Indexer
- Logs
- Machines
- Security
- OAuth
- SSLCertificate
- SSLCertificates
- EnterpriseUsers
- EnterpriseGroups
- Site
- System
- Licenses (Deprecated 10.7+)
- PortalLicense
- Directory
- WebAdaptor
- WebAdaptors
- WebhookManager
- Webhook
- SocialProviders
- MetadataManager
 
- arcgis.gis.server module- Server
- ServicesDirectory
- Service
- Extension
- Machine
- Report
- Datastore
- User
- Role
- ServerManager
- ServiceManager
- MachineManager
- LogManager
- ReportManager
- DataStoreManager
- UserManager
- RoleManager
- SystemManager
- SiteManager
- TypesManager
- ProvidersManager
- ExtensionManager
- RegisteredExtension
- DirectoryManager
- ConfigurationStore
- Jobs
- ServerDirectory
- ServerProperties
- ItemInformationManager
- JobManager
- Job
- Mode
- ServiceWebHook
- ServiceWebHookManager
- AsyncJob
 
- arcgis.gis.agonb module
- arcgis.gis.agoserver module
- arcgis.gis.mission module
- arcgis.gis.nb module- NotebookServer
- NotebookManager
- Notebook
- Runtime
- SnapshotManager
- SnapShot
- SystemManager
- Container
- ContainerNotebook
- DirectoryManager
- WebAdaptor
- WebAdaptorManager
- SiteManager
- LogManager
- MachineManager
- Machine
- SecurityManager
- NotebookDataAccess
- NotebookFile
- NotebookFolder
- DATAACCESSTYPE
- NBServicesManager
- NBService
 
- arcgis.gis.workflowmanager module
- arcgis.gis.tasks module
- arcgis.gis.sharing module