The gis module provides an information model for GIS hosted
within ArcGIS Online or ArcGIS Enterprise.
This module provides functionality to manage
(create, read, update and delete) GIS users, groups and content. This module
is the most important and provides the entry point into the GIS.

A GIS is representative of a single ArcGIS Online organization or an ArcGIS Enterprise deployment. The GIS object
provides helper objects to manage (search, create, retrieve) GIS resources such as content, users, and groups.

Additionally, the GIS object has properties to query its state, which is accessible using the properties attribute.

The GIS provides 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 map() method.

The constructor constructs a GIS object 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.

Optional string. If URL is None, then the URL will be ArcGIS
Online. This should be a web address to either a local Portal
or to ArcGIS Online in the form:
<scheme>://<fully_qualified_domain_name>/<web_adaptor> (Portal Example)
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. 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 False can 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.

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 geocoders and if a match is found, the geographic
extent of the matched address is used as the map extent. If a zoomlevel is also
provided, the map is centered at the matched address instead and the map is zoomed
to the specified zoomlevel. See widgets for more information.

Note: The map widget is only supported within Jupyter Notebook.

Argument

Description

location

Optional string. The address or lat-long tuple of where the map is to be centered.

zoomlevel

Optional integer. The desired zoom level.

mode

Optional string of either ‘2D’ or ‘3D’ to specify map mode. Defaults to ‘2D’.

An item (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.
An 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 layers and tables properties to get to the individual layers/tables in this item.

Relationships are not tied to an item. They are directional links from an origin item
to a destination item and have a type. The type 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.

Argument

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.

If the parent item is registered using the register app operation,
this resource returns information pertaining to the registered app.
Every registered app gets an App ID and App Secret which in OAuth
speak are known as client_id and client_secret respectively.

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.

Argument

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.

Deletes the item. If unable to delete, raises a RuntimeException. To know if you can safely delete the item,
use the optional parameter ‘dry_run’

Argument

Description

force

Optional bool. 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 bool. 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.

Returns:

A bool containing True (for success) or False (for failure). When dry_run is used, a dictionary with
details is returned.

USAGEEXAMPLE:Dryruntocheckdeletionofanitemitem1=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':[<Itemtitle:"Chicago_accidents_WFS"type:WFSowner: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_run’ on those items to ensure they can be deleted safely.

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:

Returns True if the relationship was deleted, False if the deletion failed.

Exports a service item to the specified export format.
Available only to users with an organizational subscription.
Invokable only by the service item owner or an administrator.
This is useful for long running exports that could hold up a script.

Retrieves the data associated with an item. Note that this call may
return different results for different item types: some item types may
even return None. See
this REST API page
for more information.

Argument

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.

Required string. The name of the folder to move the item to.
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.

Publishes a hosted service based on an existing source item (this item).
Publishers can create feature, tiled map, vector tile and scene services.

Feature services can be created using input files of type csv, shapefile, serviceDefinition, featureCollection, and fileGeodatabase.
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 for 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.

Optional string. Only used when a feature service is published as a tile service.
eg: output_type=’Tiles’

overwrite

Optional boolean. If True, the hosted feature service is overwritten.
Only available in ArcGIS Online and Portal for ArcGIS 10.5 or later.

file_type

Optional string. Some formats are not automatically detected, when this occurs, the
file_type can be specified: serviceDefinition,shapefile,csv,
tilePackage, featureService, featureCollection, fileGeodatabase,
geojson, scenepackage, vectortilepackage, imageCollection,
mapService, and sqliteGeodatabase are valid entries. This is an
optional parameter.

build_initial_cache

Optional boolean. The boolean value (default False), if true
and applicable for the file_type, the value will built cache
for the service.

The register method registers an app item with the enterprise. App
registration results 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.

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.

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.

Argument

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.

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, to all members in the organization or to everyone (including
anonymous users). 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:

Dictionary of the following kind
{
‘groups’: [], # one or more Group objects
‘everyone’: True | False,
‘org’: True | False
}

Provides the status when publishing an item, adding an item in
async mode, or adding with a multipart upload. “Partial” is
available for Add Item Multipart, when only a part is uploaded
and the item is not committed.

Argument

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

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 file, provide a path or URL
to the file 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.

For item owners and administrators, usage 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,
nonhosted 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. You can change the time frame for the credit usage
reporting period.

Argument

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

as_df

Optional boolean. Returns a Pandas DataFrame when True, returns data
as a dictionary when False

Represents a registered user of the GIS (ArcGIS Online, or Portal for ArcGIS).

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 as a UNIX timestamp.

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 user’s subscription.

storageQuota

Applicable to public users as it sets the total amount of storage available for a subscription. The maximum quota is 2GB.

orgId

The ID of the organization the user belongs to.

role

Defines the user’s role in the organization.<br><br>Values: org_admin (organization administrator or custom role with administrative privileges) , org_publisher (organization publisher or custom role with publisher privileges) , org_user (organization 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

Disables access to the organization by 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 and Spanish, i.e. when culture is en or es).<br><br>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 UNIX time.

modified

The date the user was last modified. Shown in UNIX time.

groups

A JSON array of groups the user belongs to. See Group for properties of a group.

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 someone in the reassign_to
argument, then items and groups will be transferred to that user. If that
argument is not set then the method will fail if the user has items or groups
that need to be reassigned.

Argument

Description

reassign_to

Optional string. The new owner of the items and groups
that belong to the user being deleted.

When getting, will return a string describing the current user’s esri access
When setting, supply a bool to enable or disable esri_access for that user (Administrator privileges required)

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.

Provides a list of items in the specified folder. For content in the root folder, use
the default value of None for the folder argument. For other folders, pass in the folder
name as a string, or as a dictionary containing
the folder ID, such as the dictionary obtained from the folders property.

Argument

Description

folder

Optional string. The specifc folder (as a string or dictionary)
to get a list of items in.

max_items

Optional integer. The maximum number of items to be returned. The default is 100.

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.

Allows only 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. 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.

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.

Argument

Description

level

Required string. The values of 1 or 2. This
is the user level for the given user.

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.

Argument

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).

Users apply to join a group using the Join Group operation. 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.
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.

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.

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. (This privilege is only applicable to ArcGIS Online.)

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 organization; however, it does not grant the ability to promote a member to, 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:reassignUsers: grants the ability to assign all groups and content of a member to another within organization.

Groups

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. (This privilege is only applicable to Portal for ArcGIS.)

Content

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.

ArcGIS Marketplace Subscriptions

marketplace:admin:purchase: grants the ability to request purchase information about apps and data in ArcGIS Marketplace. (This privilege is only applicable to ArcGIS Online.)

marketplace:admin:startTrial: grants the ability to start trial subscriptions in ArcGIS Marketplace. (This privilege is only applicable to ArcGIS Online.)

marketplace:admin:manage: grants the ability to create listings, list items and manage subscriptions in ArcGIS Marketplace. (This privilege is only applicable to ArcGIS Online.)

When a user applies to join a group, a group application is
created. Group administrators choose to accept this application
using the Accept Group Application operation. 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. Available only to group
owners and admins.

When a user applies to join a group, a group application is
created. Group administrators can decline this application using
this method. This method
deletes the application and creates a notification for the user
indicating that the user’s group application was declined. The
applying user will not be added to the group. Available only to
group owners and admins.

Helper class for managing content in ArcGIS Online or ArcGIS Enterprise.
This class is not created by users directly. 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.

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.

The Analyze call helps a client analyze a CSV or Excel file (.xlsx, .xls) prior to publishing or generating features using the Publish or Generate operation, respectively.

Analyze returns information about the file including the fields present as well as sample records. Analyze attempts to detect the presence of location fields that may be present as either X,Y fields or address fields.

Analyze packages 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. Analyze will suggest defaults for the renderer.

In a typical workflow, the client will present portions of the Analyze results to the user for editing before making the call to Publish or Generate.

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.

Argument

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 or excel

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.

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.

This creates an exact copy of the application, map, and layers
in the GIS.

Argument

Description

items

Required list. Collection of Items 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. Indicating whether the data should be copied with any
feature layer or feature collections. Default is True, data will be copied.

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.

Optional boolean. Indicating whether the data can change. Default is True, data is not allowed to change.

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

Imports a Pandas data frame (that has an address column), or an arcgis
spatial dataframe into 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.

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.

In addition to the parameters aboce, 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.

The replace_service operation 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: If you are looking to clone services, use the clone_items() method instead.
Note: This functionality is only available for Vector Tile Services.

Workflow for replace_service:

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.

3. Call the replace_service operation. The service running on the hosting server gets replaced
(for example, its cache).

*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.

The query syntax has many features that can’t be adequately
described here. The query syntax is available in ArcGIS Help.
A short version of that URL is http://bitly.com/1fJ8q31.

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.

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.

This operation is used to pre-create built-in or enterprise accounts within the portal,
or built-in users in an ArcGIS Online organization account. Only an administrator
can call this method.

To create a viewer account, choose role=’org_viewer’ and level=’viewer’

Argument

Description

username

Required string. The user name, which must be unique in the Portal, and
6-24 characters long.

password

Required string. The password for the user. It must be at least 8 characters.
This is a required parameter only if
the provider is arcgis; otherwise, the password parameter is ignored.
If creating an account in an ArcGIS Online org, it can be set as None to let
the user set their password by clicking on a link that is emailed to him/her.

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 to have correct.

description

Optional string. The description of the user account.

thumbnail

Optional string. The URL to user’s image.

role

Optional string. The role for the user account. The default value is org_user.
Other possible values are org_user, org_publisher, org_admin, viewer,
view_only, viewplusedit or a custom role object (from gis.users.roles).

provider

Optional string. The provider for the account. The default value is arcgis.
The other possible value is enterprise.

idp_username

Optional string. The name of the user as stored by the enterprise user store.
This parameter is only required if the provider parameter is enterprise.

This 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.

The query syntax has quite a few features that can’t
be adequately described here. The query syntax is
available in ArcGIS help. A short version of that URL
is http://bitly.com/1fJ8q31.

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.

Argument

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. This parameter allows for the filting
of the users based on a role.

Givens a List of Users, the user_groups will report back all group ids
that each user belongs to. This method is designed to be a reporting
tool for administrators so they can easily manage a user or users groups.

Helper class for managing GIS groups. This class is not created by users directly.
An instance of this class, called ‘groups’, is available as a property of the Gis object.
Users call methods on this ‘groups’ object to manipulate (create, get, search, etc) users.

Creates a group with the values for any particular arguments that are specified.
Only title and tags are required.

Argument

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.

provider

Optional string. Name of the provider.

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.

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.

Argument

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.

Helper class for managing the GIS data stores in on-premises ArcGIS Portals.
This class is not created by users directly.
Instances of this class are returned from arcgis.geoanalytics.get_datastores() and
arcgis.raster.analytics.get_datastores() functions to get the corresponding datastores.
Users call methods on this ‘datastores’ object to manage the datastores in a site
federated with the portal.

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.

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. You can get a data store
item 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.

Argument

Description

name

Required string. The name of the cloud store.

conn_str

Required string. The connection information for the cloud storage
product.

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.

Gets or 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. 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.

You can use this operation 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.

Argument

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.

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.

Helper class for managing resource files of an item. This class is not created by users directly.
An instance of this class, called ‘resources’, is available as a property of the Item object.
Users call methods on this ‘resources’ object to manage (add, remove, update, list, get) item resources.

The add resources operation adds new file resources to an existing item. For example, an image that is
used as custom logo for Report Template. All the files are added to ‘resources’ folder of the item. File
resources use storage space from your quota and are scanned for viruses. The item size is updated to
include the size of added resource files. Each file added should be no more than 25 Mb.

Gets a specific file resource of an existing item. This operation is only
available to the item owner and the organization administrator.

Argument

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>

Removes a single resource file or all resources. The item size is updated once
resource files are deleted. This operation is only available to the item owner
and the organization administrator.

Argument

Description

file

Optional string. 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>

If not specified, all resource files will be removed.

Returns:

If succeeded a boolean of True will be returned,

else a dictionary with error info
{“error”: {“code”: 404,

”message”: “Resource does not exist or is inaccessible.”,
“details”: []

The update resources operation allows you to update 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, and ZIP.
This operation is only available to the item owner and the organization administrator.

Argument

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.