arcgis.gis.admin module

Classes for administering your GIS.

The gis.admin property is dynamically set at runtime based on what kind of GIS (ArcGIS Enterprise or ArcGIS Online) an administrator connects to. For ArcGIS Online GIS, administrators will get an instance of AGOLAdminManager from the gis.admin property. For ArcGIS Enterprise GIS , administrators will get an instance of PortalAdminManager from the gis.admin property.

AGOLAdminManager

class arcgis.gis.admin.AGOLAdminManager(gis, ux=None, metadata=None, collaborations=None)

Bases: object

This is the root resource for administering your online GIS. Starting from this root, all of the GIS’s environment is organized into a hierarchy of resources and operations.

Parameter: :param gis: GIS object containing Administrative credentials :param ux: the UX object (optional) :param metadata: the metadata manager object (optional) :param collaborations: the CollaborationManager object (optional)

property category_schema

This resource allows for the setting and manipulating of category schemas.

Returns:

CategoryManager object

property certificates

Provides access to managing the organization’s certificates.

Returns:

CertificateManager object

property collaborations

The collaborations resource lists all collaborations in which a portal participates

Returns:

CollaborationManager object

content(item_type=None, sort_field='created', order='asc')

The portal content operation allows an administrator to return a list of all items in the organization. Only available to administrators with a privilege to view all items in the organization.

Parameter

Description

item_type

Optional ItemTypeEnum. The item type to filter by.

sort_field

Optional String. Field to sort by.

order

Optional String. The sort order of the return data.

property credits

Manages the credits on a ArcGIS Online

Returns:

CreditManager object

property datastore_metrics

Provides administrators information about the datastore on ArcGIS Online.

return:

DataStoreMetricsManager object

history(start_date, to_date=None, num=100, all_events=True, event_ids=None, event_types=None, actors=None, owners=None, actions=None, ips=None, sort_order='asc', data_format='csv', save_folder=None)

Returns a CSV file or Pandas’s DataFrame containing the login history from a start_date to the present.

Parameter

Description

start_date

Required datetime.datetime object. The beginning date to start with.

to_date

Optional datetime.datetime object. The ending date. If not provided, the query will attempt to obtain all records till the current date.

num

Optional Integer. The maximum number of records to return. The maximum value is 10,000 set by the ArcGIS REST API. If the value of -1 is provided it will attempt to get all records for the date range. The default is 100.

all_events

Optional Boolean. If True, all types of events are included. If False, only actions targeted by the organization are included. When exporting as csv this parameter is True.

event_id

Optional String. Filter events by specific target user name or target ID in a batch result set. It can be the ID of an item, a group, a role, a collaboration, an identity provider, and so on.

event_types

Optional String. Filter events by a comma-separated list of target types in a batch result set.

Values: a (organization), c (collaboration), cp (collaboration participate),

cpg (collaboration participate group), cw (collaboration workspace), cwp (collaboration workspace participate), g (group), i (item), idp (identity provider), inv (invitation), r (role), u (user)

actors

Optional String. Comma seperated list of usernames.

owners

Optional String. Filter events by a comma-separated list of user names who own the action targets in a batch result set.

actions

Optional String. Comma seperated list of actions to query for.

Values: add, addusers, create, delete, removeusers, share, unshare, update, failedlogin, login, and updateUsers.

ips

Optional String. Filter events by a comma-separated list of IP addresses in a batch result set.

sort_order

Optional String. Describes whether the results return in ascending or descending chronological order. The default is ascending.

Values: asc or desc

data_format

Optional String. The way the data is returned to the user. The response can be a df, csv, or ‘raw’. ‘df’ returns a DataFrame, ‘csv’ returns a comma seperated file, and ‘raw’ returns the JSON string as a dictionary.

Values: df, csv, ‘raw’

save_folder

Optional String. The save location of the CSV file.

Returns:

string or pd.DataFrame or dict

property idp

This resource allows for the setting and configuration of the identity provider

Returns:

IdentityProviderManager object

property license

provides a set of tools to access and manage user licenses and entitlements.

property location_tracking

The manager for Location Tracking. See LocationTrackingManager

Returns:

LocationTrackingManager object

property metadata

resources to work with metadata on GIS

Returns:

MetadataManager object

property org_recyclebin

Returns the organization recyclebin, which will allow administrators to look at the entire organization recyclebin contents.

Returns:

OrgRecycleBin

property partnered_collaboration

Returns a manager to work with partnered collaborations

Returns:

PartneredCollabManager

property password_policy

tools to manage a Site’s password policy

scheduled_tasks(item=None, active=None, user=None, types=None)

This property allows org_admins to be able to see all scheduled tasks on the enterprise

Parameter

Description

item

Optional Item. The item to query tasks about.

active

Optional Bool. Queries tasks based on active status.

user

Optional User. Search for tasks for a single user.

types

Optional String. The type of notebook execution for the item. This can be ExecuteNotebook, or UpdateInsightsWorkbook.

Yields:

Task

property servers

Provides access to managing the services hosted on ArcGIS Online

Returns:

AGOLServersManager

property social_providers

This resource allows for the setting and configuration of the social providers for a GIS.

Returns:

SocialProviders object

property urls

returns the URLs to the Hosting and Tile Server for ArcGIS Online

property usage_reports

provides access to the usage reports of the ArcGIS Online organization

Returns:

AGOLUsageReports object

property ux

returns a UX/UI manager

Returns:

UX object

DataStoreMetricsManager

class arcgis.gis.admin.DataStoreMetricsManager(gis)

Bases: object

This class allows for ArcGIS Online administrators to query statistics about the managed datastore. It is not meant to be initialized directly, but instead an instance is returned from the datastore_metrics property.

# Usage Example;
>>> gis = GIS(profile="your_online_admin_profile")

>>> ago_mgr = gis.admin
>>> ds_mgr = ago_mgr.datastore_metrics
property feature_storage

Returns storage percentage of total storage used

Returns:

list[dict[str,Any]]

query(metric, bin_size, bin_unit, aggregation=DataStoreAggregation.SUM, start_time=None, end_time=None, ago=None, ago_unit=None)

A query operation used to gather metrics about the ArcGIS Online Datastore

Parameter

Description

metric

Required DataStoreMetric. The statistical method to gather.

bin_size

Required Float or Int. The size of the bin to aggregate on.

bin_unit

Required DataStoreTimeUnit. The size of the bin.

aggregation

Required DataStoreAggregation. The type of aggregation to perform.

start_time

Optional datetime.datetime. The starting date point.

end_time

Optional datetime.datetime. The ending date point.

ago

Optional Int. The time to look back from today.

ago_unit

Optional DataStoreTimeUnit. The time unit to look back.

Returns:

list[dict[str,Any]]

query_resource_usage(query_period)

Allows administrators to view the average and max CPU usage for the organization’s datastore.

Parameter

Description

query_period

Required String. The time period to query. The allowed values are: day, week, or hour.

Returns:

dictionary containing the average and max usage.

DataStoreAggregation

class arcgis.gis.admin.DataStoreAggregation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

AVG = 'avg'
COUNT = 'count'
MAX = 'max'
MIN = 'min'
STDEV = 'stdev'
SUM = 'sum'
VARIANCE = 'variance'

DataStoreTimeUnit

class arcgis.gis.admin.DataStoreTimeUnit(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Time Units for DataStore Metrics class

DAY = 'd'
HOUR = 'h'
MILLISECOND = 'ms'
MINUTE = 'm'
SECOND = 's'

DataStoreMetric

class arcgis.gis.admin.DataStoreMetric(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

The allowed metric values

ALLOCATED_STORAGE = 'db_allocated_storage_mb'
AVG_CPU = 'db_avg_cpu'
FEATURESTORAGE = 'db_featurestorage_mb'
PERCENT_STORAGE = 'db_percent_storage'
STORAGE_MB = 'db_used_storage_mb'

PortalAdminManager

class arcgis.gis.admin.PortalAdminManager(url, gis=None, **kwargs)

Bases: BasePortalAdmin

This is the root resource for administering your portal. Starting from this root, all of the portal’s environment is organized into a hierarchy of resources and operations. A version number is returned as a part of this resource. After installation, the portal can be configured using the Create Site operation. Once initialized, the portal environment is available through System and Security resources.

Parameter

Description

url

web address to portaladmin rest API (ends with: portal//sharing/rest/)

gis

GIS object containing Administrative credentials

initialize

Optional if True, properties of REST endpoint are loaded on creation of object. False (default) means they are loaded when needed.

property category_schema

This resource allows for the setting and manipulating of category schemas.

Returns:

CategoryManager object

property classification

Provides access to the functionality for managing the ArcGIS Enterprise classification schema if it has been configured.

Returns:

An instance of the ClassificationManager.

property collaborations

The collaborations resource lists all collaborations in which a portal participates

Returns:

CollaborationManager object

content(item_type=None, sort_field='created', order='asc')

The portal content operation allows an administrator to return a list of all items in the organization. Only available to administrators with a privilege to view all items in the organization.

Parameter

Description

item_type

Optional ItemTypeEnum. The item type to filter by.

sort_field

Optional String. Field to sort by.

order

Optional String. The sort order of the return data.

property federation

provides access into the federation settings of a server.

Returns:

Federation object

history(start_date, num=100, save_folder=None)

Returns a CSV file containing the login history from a start_date to the present.

Parameter

Description

start_date

Required datetime.datetime object. The beginning date.

num

Optional Integer. The maximum number of records to return.

save_folder

Optional String. The save location of the CSV file.

Returns:

string

property idp

This resource allows for the setting and configuration of the identity provider

Returns:

IdentityProviderManager object

property info

Returns the current version and build number of the Enterprise system

Returns:

dict

property license

provides a set of tools to access and manage user licenses and entitlements.

Returns:

LicenseManager object

property living_atlas

provides a set of tools to manage and setup Living Atlas content.

Returns:

LivingAtlas object

property location_tracking

The manager for Location Tracking. See LocationTrackingManager.

Returns:

LocationTrackingManager object

property logs

returns a class to work with the portal logs

Returns:

Logs object

property machines

This resource lists all the portal machines in a site. Each portal machine has a status that indicates whether the machine is ready to accept requests.

Returns:

Machines object

property metadata

returns a set of tools to work with ArcGIS Enterprise metadata settings.

Returns:

MetadataManager object

property mode

Gets/Set the mode of the ArcGIS Enterprise deployment. When obtaining the mode, it returns information about the current state of the system.

Key

Description

read_only

Required Boolean. A boolean that specifies whether the Enterprise portal is in read-only mode. Read-only mode will block requests to modify or create any data, including content, users, groups, or site settings. The default value is false.

message

Optional String. Sets a custom message to be displayed whenever an attempt to modify or update content or site settings is made through the API.

>>> gis.admin.mode({'read_only' : False})
>>> assert gis.admin.mode['isReadOnly'] == False
property password_policy

tools to manage a Site’s password policy

Returns:

PasswordPolicy object

scheduled_tasks(item=None, active=None, user=None, types=None)

This property allows org_admins to be able to see all scheduled tasks on the enterprise

Parameter

Description

item

Optional Item. The item to query tasks about.

active

Optional Bool. Queries tasks based on active status.

user

Optional User. Search for tasks for a single user.

types

Optional String. The type of notebook execution for the item. This can be ExecuteNotebook, or UpdateInsightsWorkbook.

Yields:

Task

property security

accesses the controls for the security of a local portal site

Returns:

Security object

property servers

returns a server manager object

Returns:

ServerManager

property site

Site is the root resources used after a local GIS is installed. Here administrators can create, export, import, and join sites.

Returns:

Site object

property social_providers

This resource allows for the setting and configuration of the social providers for a GIS.

Returns:

SocialProviders object

property system

This resource provides access to the ArcGIS Web Adaptor configuration, portal directories, database management server, indexing capabilities, license information, and the properties of your portal.

Returns:

System object

property ux

returns a UX/UI manager with properties such as description, featured_content, name, etc.

Returns:

UX object

property webhooks

Provides access to Portal’s WebHook Manager

Returns:

WebhookManager object

KubernetesAdmin

class arcgis.gis.kubernetes.KubernetesAdmin(url, gis)

Bases: _BaseKube

Kubernetes Administration Class. This class is not meant to be initialized directly, but instead is returned by the _admin_ property on the gis object when logged in as an administrator.

#Usage Example:

>>> gis = GIS(profile="your_kubernetes_admin_profile")
>>> kube_admin = gis.admin
>>> kube_admin

<KubernetesAdmin at https://kubenetes.example.com/arcgis/admin>
property category_schema

This resource allows for the setting and manipulating of catagory schemas.

Returns:

CategoryManager object

property collaborations

The collaborations resource lists all collaborations in which a portal participates

content(item_type=None, sort_field='created', order='asc')

The portal content operation allows an administrator to return a list of all items in the organization. Only available to administrators with a privilege to view all items in the organization.

Parameter

Description

item_type

Optional ItemTypeEnum. The item type to filter by.

sort_field

Optional String. Field to sort by.

order

Optional String. The sort order of the return data.

property datastores

Provides access to the _Datastore Manager_, allowing the administrator to manage registered datastores.

Returns:

A Kubernetes DataStores object.

property jobs

This resource is a collection of the asynchronous jobs created in your deployment. When operations that support asynchronous executions are run with the async option enabled, a new job entry is created that can be queried for its current status and messages.

property license

Provides access to the LicenseManager, and its set of tools to access and manage user licenses and entitlements.

property logs

Accesses a LogManager object to manage and query the Kubernetes logs.

property metadata

Accesses the MetadataManager which provides a set of tools to work with the organization’s metadata settings.

property mode

Provides access to a Mode object to help manage service deployment modes.

property organizations

Provides access to the KubeOrganizations object to work with the organization’s settings.

property overview

Provides access to the overview resource to access persisted cache or real-time information.

Returns:

Overview object

scheduled_tasks(item=None, active=None, user=None, types=None)

This method allows organization admins to see all scheduled tasks on the organization.

Parameter

Description

item

Optional Item. The item to query tasks about.

active

Optional Bool. Queries tasks based on active status.

user

Optional User. Search for tasks for a single user.

types

Optional String. The type of notebook execution for the item:

  • ExecuteNotebook

  • UpdateInsightsWorkbook

Returns:

List of Tasks.

property security

Gets a KubeSecurity object to work with the site’s security settings

Returns:

KubeSecurity object.

property services

Provides access to the Kubernetes ServicesManager object for the site

property services_catalog

Provides access to the kubernetes KubeServiceDirectory work with the services on the site.

property social_providers

Accesses the SocialProviders resource to allow for the setting and configuration of the social providers for the organization.

property system

This is a collection of system-wide resources for your deployment such as the configuration store, licenses, and deployment-wide security.

Returns:

SystemManager object.

property uploads

Gets the Uploads object to work with the site uploads.

property usage

Provides access to the metrics viewer and metrics API tools.

Returns:

An UsageStatistics object.

property webhooks

Provides access to the organiztion’s Webhook Manager.

KbertnetesPy

class arcgis.gis.kubernetes.KbertnetesPy(url, username=None, password=None, key_file=None, cert_file=None, expiration=60, referer=None, proxy_host=None, proxy_port=None, connection=None, workdir='/tmp', tokenurl=None, verify_cert=True, client_id=None, custom_auth=None, token=None, api_key=None, **kwargs)

Bases: object

Kubernetes Sharing API Implementation

add_group_users(user_names, group_id, admin_names)

Adds users to the group specified.

Note

This method will only work if the user for the Portal object is either an administrator for the entire Portal or the owner of the group.

Returns:

A dictionary with a key of “not_added” which contains the users that were not added to the group.

add_item(item_properties, data=None, thumbnail=None, metadata=None, owner=None, folder=None)

Adds content to a Portal.

Note

That content can be a file (such as a layer package, 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 below are required. However, it is strongly recommended that title, type, typeKeywords, tags, snippet, and description be provided.

Parameter

Description

item_properties

Required dictionary, see below for the keys and values

data

Optional string, either a path or URL to the data

thumbnail

Optional string, either a path or URL to an image

metadata

Optional string, either a path or URL to metadata.

owner

Optional string, defaults to logged in user.

folder

Optional string, content folder where placing item

Key

Value

type

Optional string, indicates type of item. See URL 1 below for valid values.

typeKeywords

Optional string list. Lists all sub-types. See URL 1 for valid values.

description

Optional string. Description of the item.

title

Optional string. Name of the item.

url

Optional string. URL to item that are based on URLs.

tags

Optional string of comma-separated values. Used for searches on items.

snippet

Optional string. Provides a very short summary of the what the item is.

extent

Optional string with 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: private, shared, org, or public.

commentsEnabled

Optional boolean. Default is true. Controls whether comments are allowed.

culture

Optional string. Language and country information.

overwrite

Optional boolean. Default is false. Controls whether item can be overwritten.

URL 1: http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000ms000000

Returns:

The item id of the uploaded item if successful, None if unsuccessful.

can_delete(item_id, owner, folder=None)

checks if you can delete the item.

Parameter

Description

item_id

required string, unique identifier for the item

owner

required string, owner of the item currently

folder

optional string, folder containing the item. Defaults to the root folder.

Returns:

a tuple containing a boolean and a dict with details

con = None
create_folder(owner, title)

Creates a folder for the given user with the given title.

Parameter

Description

owner

required string, the name of the user

title

required string, the name of the folder to create for the owner

Returns:

a json object like the following: {“username” : “portaladmin”,”id” : “bff13218991c4485a62c81db3512396f”,”title” : “testcreate”}

create_group(title, tags, description=None, snippet=None, access='public', thumbnail=None, is_invitation_only=False, sort_field='avgRating', sort_order='desc', is_view_only=False, auto_join=False, provider_group_name=None, provider=None, max_file_size=None, users_update_items=False, display_settings=None, is_open_data=False, leaving_disallowed=False)

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

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.

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.

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.

Returns:

a dict containing group properties

create_group_from_dict(group, thumbnail=None)

Creates a group and returns a group id if successful.

Note

Use create_group in most cases. This method is useful for taking a group dict returned from another PortalPy call and copying it.

Example

create_group({'title': 'Test', 'access':'public'})
create_role(name, description)

Creates a custom role with specified name and description

Returns:

role_id if role is created, else None

create_service(name, service_description='', has_static_data=False, max_record_count=1000, supported_query_formats='JSON', capabilities=None, description='', copyright_text='', wkid=102100, service_type='imageService', create_params=None, owner=None, folder=None, common_params=None, is_view=False, item_id=None, tags=None, snippet=None)
Creates service.

#”Create,Delete,Query,Update,Editing”,

Returns:

The item id of the created service item if successful, None if unsuccessful.

delete_folder(owner, folder)

Deletes folder owned by owner with the given folder name.

Parameter

Description

owner

required string, the name of the user

folder

required string, the folder name

Returns:

a boolean if succeeded.

delete_group(group_id)

Deletes a group.

Parameter

Description

group_id

string containing the id for the group to be deleted.

Returns

a boolean indicating whether it was successful.

delete_group_thumbnail(group_id)

Removes the group’s thumbnail

Returns:

Boolean

delete_item(item_id, owner, folder=None, force=False, permanent=False)

Deletes an item.

Parameter

Description

item_id

Required string, unique identifier for the item

owner

Required string, owner of the item currently

folder

Optional string, folder containing the item. Defaults to the root folder.

force

Optional bool. If True, will force delete orphaned items

permanent

Optional bool. If True, item will not be sent to recycle bin.

Returns:

a boolean, indicating success

delete_user(username, reassign_to=None)

Deletes a 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. 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.

Parameter

Description

username

Required string, the name of the user

reassign_to

Optional string, new owner of items and groups

Returns:

a boolean indicating whether the operation succeeded or failed.

generate_token(username, password, expiration=60)

Generates and returns a new token, but doesn’t re-login.

Note

This method is not needed when using the Portal class to make calls into Portal. It’s provided for the benefit of making calls into Portal outside of the Portal class.

Portal uses a token-based authentication mechanism where a user provides their credentials and a short-term token is used for calls. Most calls made to the Portal REST API require a token and this can be appended to those requests.

Parameter

Description

username

required string, name of the user

password

required password, name of the user

expiration

optional integer, number of minutes until the token expires

Returns:

a string with the token

get_folder_id(owner, folder_name)

Finds the folder for a particular owner and returns its id.

Parameter

Description

owner

required string, the name of the user

folder_name

required string, the name of the folder to search for

Returns:

a boolean if succeeded.

get_group(group_id)

Returns group information for the specified group group_id.

Arguments

group_id : required string, indicating group.

Returns:

a dictionary object with the group’s information. The keys in the dictionary object will often include:

Key

Value

title:

the name of the group

isInvitationOnly

if set to true, users can’t apply to join the group.

owner:

the owner username of the group

description:

explains the group

snippet:

a short summary of the group

tags:

user-defined tags that describe the group

phone:

contact information for group.

thumbnail:

File name relative to http://<community-url>/groups/<groupId>/info

created:

When group created, ms since 1 Jan 1970

modified:

When group last modified. ms since 1 Jan 1970

access:

Can be private, org, or public.

userMembership:

A dict with keys username and memberType.

memberType:

provides the calling user’s access (owner, admin, member, none).

get_group_content(group_id, max_items=10)

Returns members of the specified group.

Arguments

group_id: required string, specifies the group

Returns

a dictionary with keys: owner, admins, and users.

Key

Value

owner

string value, the group’s owner

admins

list of strings, typically this is the same as the owner.

users

list of strings, the members of the group

Example (to print items in a group)

response = portal.get_group_content("67e1761068b7453693a0c68c92a62e2e")
for i in response["items"] :
    print (i)
get_group_members(group_id)

Returns members of the specified group.

Arguments

group_id: required string, specifies the group

Returns

a dictionary with keys: owner, admins, and users.

Key

Value

owner

string value, the group’s owner

admins

list of strings, typically this is the same as the owner.

users

list of strings, the members of the group

Example (to print users in a group)

response = portal.get_group_members("67e1761068b7453693a0c68c92a62e2e")
for user in response['users'] :
    print user
get_group_thumbnail(group_id)

Returns the bytes that make up the thumbnail for the specified group group_id.

Arguments

group_id: required string, specifies the group’s thumbnail

Returns

bytes that represent he image.

Example

response = portal.get_group_thumbnail("67e1761068b7453693a0c68c92a62e2e")
f = open(filename, 'wb')
f.write(response)
get_item(itemid)

Returns the item information for the specified item.

Arguments

itemid required string, the item-id whose information you want.

Returns:

None if the item is not found and returns a dictionary object if the item is found the dictionary has the following keys:

get_item_data(itemid, try_json=True, folder=None)
get_item_dependencies(itemid)
get_item_dependents_to(itemid)
get_org_roles(max_roles=1000)

Returns all roles within the portal organization.

Arguments

max_roles : optional int, the maximum number of users to return.

Returns:

a list of dicts. Each dict has the following keys:

get_org_users(max_users=1000, exclude_system=True, user_type=None, role=None)

Returns all users within the portal organization.

Arguments

max_users : optional int, the maximum number of users to return.

Returns:

a list of dicts. Each dict has the following keys:

Key

Value

username :

string

storageUsage:

int

storageQuota:

int

description:

string

tags:

list of strings

region:

string

created:

int, when account created, ms since 1 Jan 1970

modified:

int, when account last modified, ms since 1 Jan 1970

email:

string

culture:

string

orgId:

string

preferredView:

string

groups:

list of strings

role:

string (org_user, org_publisher, org_admin)

fullName:

string

thumbnail:

string

idpUsername:

string

Example (print all usernames in portal):

resp = portalAdmin.get_org_users()
for user in resp:
    print user['username']
get_properties(force=False)

Returns the portal properties (using cache unless force=True).

get_user(username)

Returns the user information for the specified username.

Arguments

username required string, the username whose information you want.

Returns:

None if the user is not found and returns a dictionary object if the user is found the dictionary has the following keys:

Key

Value

access

string

created

time (int)

culture

string, two-letter language code (‘en’)

description

string

email

string

fullName

string

idpUsername

string, name of the user in the enterprise system

groups

list of dictionaries. For dictionary keys, see get_group doc.

modified

time (int)

orgId

string, the organization id

preferredView

string, value is either Web, GIS, or null

region

string, None or two letter country code

role

string, value is either org_user, org_publisher, org_admin

storageUsage

int

storageQuota

int

tags

list of strings

thumbnail

string, name of file

username

string, name of user

get_version(force=False)

Returns the portal version (using cache unless force=True).

Note

The version information is retrieved when you create the Portal object and then cached for future requests. If you want to make a request to the Portal and not rely on the cache then you can set the force argument to True.

Arguments:

force boolean, true=make a request, false=use cache

Returns:

a string with the version. The version is an internal number that may not match the version of the product purchased. So 2.3 is returned from Portal 10.2.1 for instance.

invite_group_users(user_names, group_id, role='group_member', expiration=10080)

Invites users to a group.

Note

A user who is invited to a group will see a list of invitations in the “Groups” tab of portal listing invitations. The user can either accept or reject the invitation.

Requires

The user executing the command must be group owner

Parameter

Description

user_names:

a required string list of users to invite

group_id :

required string, specifies the group you are inviting users to.

role:

an optional string, either group_member or group_admin

expiration:

an optional int, specifies how long the invitation is valid for in minutes.

Returns:

a boolean that indicates whether the call succeeded.

property is_all_ssl

Returns true if this portal requires SSL.

property is_arcgisonline

Returns true if this portal is ArcGIS Online.

property is_kubernetes

Returns true if this portal is kubernetes.

property is_logged_in

Returns true if logged into the portal.

property is_multitenant

Returns true if this portal is multitenant.

property is_org

Returns true if this portal is an organization.

property is_subscription

Returns true if this portal is an ArcGIS Online subscription.

leave_group(group_id)

Removes the logged in user from the specified group.

Requires:

User must be logged in.

Arguments:

group_id: required string, specifies the group id

Returns:

a boolean indicating whether the operation was successful.

logged_in_user()

Returns information about the logged in user.

Returns:

a dict with the following keys:

Key

Value

username

string

storageUsage

int

description

string

tags

comma-separated string

created

int, when group created (ms since 1 Jan 1970)

modified

int, when group last modified (ms since 1 Jan 1970)

fullName

string

email

string

idpUsername

string, name of the user in their identity provider

login(username, password, expiration=60)

Logs into the portal using username/password.

Note

You can log into a portal when you construct a portal object or you can login later. This function is for the situation when you need to log in later.

Parameter

Description

username

required string

password

required string

expiration

optional int, how long the token generated should last.

Returns:

a string, the token

logout()

Logs out of the portal.

Note

The portal will forget any existing tokens it was using, all subsequent portal calls will be anonymous until another login call occurs.

Returns:

No return value.

move_item(itemid, owner, current_folder, folder_id)

Moves the item to given folder

protect_item(item_id, owner, folder=None, enable=True)

Enable or disable delete protection on the item

Parameter

Description

item_id

required string, unique identifier for the item

owner

required string, owner of the item currently

folder

optional string, folder containing the item. Defaults to the root folder.

enable

optional boolean, True to enable delete protection, False to to disable it

Returns:

dict with key “success” containing boolean whether process completed or not

publish_item(itemid, data=None, text=None, fileType='serviceDefinition', publishParameters=None, outputType=None, overwrite=False, owner=None, folder=None, buildInitialCache=False, item_id=None)

Publishes a hosted service based on an existing source item. Publishers can create feature services as well as tiled map services. Feature services can be created using input files of type csv, shapefile, serviceDefinition, featureCollection, and fileGeodatabase. CSV files that contain location fields, (ie.address fields or X, Y 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. 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. Use the Analyze operation to generate the default publishing parameters for CSVs. See http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Publish_Item/02r300000080000000/

reassign_group(group_id, target_owner)

Reassigns a group to another owner.

Parameter

Description

group_id

required string, unique identifier for the group

target_owner

required string, username of new group owner

Returns:

a boolean, indicating success

reassign_item(item_id, current_owner, target_owner, current_folder=None, target_folder=None)

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 reassign_user method. This method only moves one item at a time.

Parameter

Description

item_id

required string, unique identifier for the item

current_owner

required string, owner of the item currently

current_folder

optional string, folder containing the item. Defaults to the root folder.

target_owner

required string, desired owner of the item

target_folder

optional string, folder to move the item to.

Returns:

a boolean, indicating success

reassign_user(username, target_username)

Reassigns all of a 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

username

Required string, user who will have items/groups transferred

target_username

Required string, user who will own items/groups after this.

Returns:

a boolean indicating success

remove_group_users(user_names, group_id)

Remove users from a group.

Parameter

Description

user_names

required string, comma-separated list of users

group_id

required string, the id for a group.

Returns:

a dictionary with a key notRemoved that is a list of users not removed.

reset_user(username, password, new_password=None, new_security_question=None, new_security_answer=None)

Resets a user’s password, security question, and/or security answer.

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.

If a new security question is specified, a new security answer should be provided.

Parameter

Description

username

Required string, account being reset

password

Required string, current password

new_password

Optional string, new password if resetting password

new_security_question

Optional int, new security question if desired

new_security_answer

Optional string, new security question answer if desired

Returns:

a boolean, indicating success

search(q, bbox=None, sort_field='title', sort_order='asc', max_results=1000, outside_org=False, categories=None, category_filters=None)
search_groups(q, sort_field='title', sort_order='asc', max_groups=1000, outside_org=False, categories=None, filter=None)

Searches for portal groups.

Note

A few things that will be helpful to know.

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

  2. Most of the time when searching groups 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.

Parameter

Description

q

required string, query string. See notes.

sort_field

optional string, valid values can be title, owner, created

sort_order

optional string, valid values are asc or desc

max_groups

optional int, maximum number of groups returned

outside_org

optional boolean, controls whether to search outside your org

categories

optional string.

filter

optional string.

Returns:

A list of dictionaries. Each dictionary has the following keys.

Key

Value

access

string, values=private, org, public

created

int, ms since 1 Jan 1970

description

string

id

string, unique id for group

isInvitationOnly

boolean

isViewOnly

boolean

modified

int, ms since 1 Jan 1970

owner

string, user name of owner

phone

string

snippet

string, short summary of group

sortField

string, how shared items are sorted

sortOrder

string, asc or desc

tags

string list, user supplied tags for searching

thumbnail

string, name of file. Append to http://<community url>/groups/<group id>/info/

title

string, name of group as shown to users

search_users(q, sort_field='username', sort_order='asc', max_users=1000, outside_org=False, exclude_system=True, user_type=None, role=None)

Searches portal users.

This gives you a list of users and some basic information about those users. To get more detailed information (such as role), you may need to call get_user on each user.

Note

A few things that will be helpful to know.

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

  2. Most of the time when searching groups 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

q

required string, query string. See notes.

sort_field

optional string, valid values can be username or created

sort_order

optional string, valid values are asc or desc

max_users

optional int, maximum number of users returned

outside_org

optional boolean, controls whether to search outside your org

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. Ability to filter users by the assigned type of user account.

role

Optional String. Filters user by assigned role.

Returns:

A a list of dictionary objects with the following keys:

Key

Value

created

time (int), when user created

culture

string, two-letter language code

description

string, user supplied description

fullName

string, name of the user

modified

time (int), when user last modified

region

string, may be None

tags

string list, of user tags

thumbnail

string, name of file

username

string, name of the user

share_item(item_id, owner, folder=None, everyone=False, org=False, groups='', allow_members_to_edit=False)

Shares an item with the specified list of groups

Parameter

Description

item_id

Required string, unique identifier for the item

owner

Required string, owner of the item currently

folder

Optional string, folder containing the item. Defaults to the root folder.

everyone

Optional boolean, share with everyone

org

Optional boolean, share with the organization

groups

Optional string, Comma-separated list of group IDs with which the item will be shared.

allow_members_to_edit

Optional boolean to allow item to be shared with groups that allow shared update

Returns:

Dictionary with key “notSharedWith” containing array of groups with which the item could not be shared.

share_item_as_group_admin(item_id, groups='', allow_members_to_edit=False)

Shares public item with the specified list of groups belonging to caller

Returns:

dict with key “notSharedWith” containing array of groups with which the item could not be shared.

signup(username, password, fullname, email)

Signs up users to an instance of Portal for ArcGIS.

Note

This method only applies to Portal and not ArcGIS Online. This method can be called anonymously, but keep in mind that self-signup can also be disabled in a Portal. It also only creates built-in accounts, it does not work with enterprise accounts coming from ActiveDirectory or your LDAP.

There is another method called createUser that requires administrator access that can always be used against 10.2.1 portals or later that can create users whether they are builtin or enterprise accounts.

Parameter

Description

username

required string, must be unique in the Portal, >4 characters

password

required string, must be >= 8 characters.

fullname

required string, name of the user

email

required string, must be an email address

Returns:

a boolean indicating success

unshare_item(item_id, owner, folder=None, groups='')

Stops sharing the item with the specified list of groups

Parameter

Description

item_id

Required string, unique identifier for the item

owner

Required string, owner of the item currently

folder

Optional string, folder containing the item. Defaults to the root folder.

groups

Optional string, comma-separated list of group IDs with which the item will be unshared.

Returns:

dict with key “notUnsharedFrom” containing array of groups from which the item could not be unshared.

unshare_item_as_group_admin(item_id, groups='')

Stops sharing public item with the specified list of groups belonging to caller

Parameter

Description

item_id

required string, unique identifier for the item

groups

optional string, comma-separated list of group IDs with which the item will be unshared.

Returns:

dict with key “notUnsharedFrom” containing array of groups from which the item could not be unshared.

update_group(group_id, title=None, tags=None, description=None, snippet=None, access=None, is_invitation_only=None, sort_field=None, sort_order=None, is_view_only=None, thumbnail=None, max_file_size=None, users_update_items=None, clear_empty_fields=False, display_settings=None, is_open_data=False, leaving_disallowed=False, hidden_members=False, membership_access=None, autojoin=False)

Updates a group.

Note

Only provide the values for the arguments you wish to update.

Returns:

a boolean indicating success

update_item(itemid, item_properties=None, data=None, thumbnail=None, metadata=None, owner=None, folder=None, large_thumbnail=None)

Updates an item in a Portal.

Note

That content can be a file (such as a layer package, 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.

Only pass in arguments for properties you want to update. All other properties will be left as they are. If you want to update description, then only provide the description argument in item_properties.

Parameter

Description

item_properties

Optional dictionary, see below for the keys and values

data

Optional string, either a path or URL to the data

thumbnail

Optional string, either a path or URL to an image

metadata

Optional string, either a path or URL to metadata.

owner

Optional string, defaults to logged in user.

folder

Optional string, content folder where placing item

large_thumbnail

Optional string, either a path or URL to an image

Key

Value

type

Optional string, indicates type of item. See URL 1 below for valid values.

typeKeywords

Optional string list. Lists all sub-types. See URL 1 for valid values.

description

Optional string. Description of the item.

title

Optional string. Name of the item.

url

Optional string. URL to item that are based on URLs.

tags

Optional string of comma-separated values. Used for searches on items.

snippet

Optional string. Provides a very short summary of the what the item is.

extent

Optional string with 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: private, shared, org, or public.

commentsEnabled

Optional boolean. Default is true. Controls whether comments are allowed.

culture

Optional string. Language and country information.

URL 1: http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000ms000000

Returns:

a boolean, that indicates success.

update_user(username, access=None, preferred_view=None, description=None, tags=None, thumbnail=None, fullname=None, email=None, culture=None, region=None, user_type=None)

Updates a user’s properties.

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 description, then only provide the description argument.

Parameter

Description

username

Required string, name of the user to be updated.

access

Optional string, values: private, org, public

preferred_view

Optional string, values: Web, GIS, null

description

Optional string, a description of the user.

tags

Optional string, comma-separated tags for searching

thumbnail

Optional string, path or url to a file. can be PNG, GIF,

JPEG, max size 1 MB

fullname

Optional string, name of the user, only for built-in users

email

Optional string, email address, only for built-in users

culture

Optional string, two-letter language code, fr for example

region

Optional string, two-letter country code, FR for example

Returns:

a boolean indicating success

update_user_role(username, role)

Updates a user’s role.

Note

There are three types of roles in Portal - user, publisher, and administrator. A user can share items, create maps, create groups, etc. A publisher can do everything a user can do and create hosted services. An administrator can do everything that is possible in Portal.

Parameter

Description

username

required string, the name of the user whose role will change

role

required string, one of these values org_user, org_publisher, org_admin

Returns:

a boolean, that indicates success

url = None
usage(startTime, endTime, period, vars, etype, stype, groupby, appId=None)
user_folders(owner)
user_items(owner, folder, max_results=100)

KubeServiceDirectory

class arcgis.gis.kubernetes._server.KubeServiceDirectory(url, gis)

Bases: _BaseKube

A representation of the Kubernetes Hosting Service Directory.

This is a private method and should not be created by a user.

find(service_name, folder=None)

finds a service based on it’s name in a given folder

property folders

returns a list of server folders

get(name, folder=None)

returns a single service in a folder

list(folder=None)

returns a list of services at the given folder

publish_sd(sd_file, folder=None, service_config=None)

Publishes a service definition file to ArcGIS Server.

Parameter

Description

sd_file

Required string. The service definition file to be uploaded and published.

folder

Optional string. The folder in which to publish the service definition file to. If this folder is not present, it will be created. The default is None in which case the service definition will be published to the System folder.

service_config

Optional Dict[str, Any]. A set of configuration overwrites that overrides the service definitions defaults.

Returns:

A boolean indicating success (True) or failure (False).

report(as_html=True, folder=None)

Generates a table of Services in the given folder, as a Pandas dataframe.

WebAdaptorManager

class arcgis.gis.kubernetes.WebAdaptorManager(url, gis)

Bases: _BaseKube

Provides access to the web adaptor resources defined on the ArcGIS Enterprise.

property configuration

This resource is a collection of configuration properties that apply to the ArcGIS Enterprise on Kubernetes Web Adaptor configured with your deployment. The only supported property is sharedKey, which represents credentials that are shared with the web adaptor. The web adaptor will use these credentials to communicate with your deployment.

unregister_adaptor(adaptor_id)

This operation unregisters an ArcGIS Enterprise on Kubernetes Web Adaptor from your deployment. Once a web adaptor has been unregistered, the web adaptor will no longer be trusted and its credentials will not be accepted. This operation is typically used when you want to register a new ArcGIS Enterprise on Kubernetes Web Adaptor or when the previous one needs to be updated.

Parameter

Description

adaptor_id

Required string. The web adaptor to unregister.

web_adaptor(adaptor_id)

This resource returns the properties of an individual web adaptor, such as the HTTP and HTTPS ports.

Parameter

Description

adaptor_id

Required string. The specific web adaptor to get.

ArchitectureManager

class arcgis.gis.kubernetes.ArchitectureManager(url, gis)

Bases: _BaseKube

Provides access to the architecture resources defined on the ArcGIS Enterprise.

property development

The development architecture profile is designed for use in nonproduction environments, including those for testing and evaluation, and requires the least amount of hardware and resources. This profile prioritizes replicated pods for publishing tools and the private ingress controller, setting replicas for both pods at 2. All other pod replicas are set as 1.

Returns:

Dict[str, Any]

property enhanced

The enhanced-availability architecture profile is designed for use in business or mission-critical production environments. This profile is designed for the highest level of availability, as it includes increased and expanded redundancy across critical pods. As a high-availability profile, enhanced-availability provides continued use and availability in the event of a failure. However, of the available profiles, the hardware requirements are the highest.

Returns:

Dict[str, Any]

property standard

The standard-availability architecture profile is designed for use in production environments and those wanting to minimize unplanned downtime with redundancy across many pods. As a high-availability pod, standard-availability provides continued use and availability in the even of a failure, and requires less hardware than enhanced-availability.

Returns:

Dict[str, Any]

AGOLUsageReports

class arcgis.gis.admin.AGOLUsageReports(url, gis=None, initialize=True, **kwargs)

Bases: BasePortalAdmin

Simple Usage Reports from ArcGIS Online

Note

Usage reports can contain users outside your organization.

applications(start_time=None, time_frame='week')

Creates a usage report for all registered application logins for a given ArcGIS Online organization.

Note

Output can contain users outside your organization that used organization applications

Parameter

Description

start_time

optional datetime, the time to step back from. If None, the current time is used.

time_frame

optional string, is the timeframe report to create. Allowed values: today, week, 14days, 30days, 60days, 90days, 6months, year

Returns:

dictionary with the number of application logins grouped by application and username.

Results aggregated by:

  • hour if time_frame is today

  • day if time_frame is week, 7days, 14days, 30days, 60days or 90days

  • week if time_frame is 6months

  • month if time_frame is year

# Usage example:

>>> import datetime as dt
>>> from arcgis.gis import GIS

>>> gis = GIS(profile="my_organizational_profile)
>>> jan2_23 = dt.datetime(2023, 1, 2)

>>> usage_reporter = gis.admin.usage_reports

>>> usage_reporter.applications(start_time= jan2_23,
                                time_frame="week")

{'startTime': 1672099200000,
'endTime': 1672704000000,
'period': '1d',
'data': [{'etype': 'svcusg',
        'stype': 'applogin',
        'username': <username 1>,
        'userOrgId': 'JXwx ... Ok2o',
        'appId': 'arcgisnotebooks',
        'appOrgId': 'Ab3e ... q0o7i',
        'num': [['1672099200000', '0'],
                ...
                ['1672444800000', '4'],
                ['1672531200000', '3'],
                ['1672617600000', '0']]},
 ...
 ...
        {'etype': 'svcusg',
         'stype': 'applogin',
         'username': 'external username2',
         'userOrgId': 'JLxMbZo4ex3kOa2o',
         'appId': 'arcgisonline',
         'appOrgId': 'Ab3e ... q0o7i',
         'num': [['1672099200000', '0'],
                 ...
                 ['1672444800000', '62'],
                 ['1672531200000', '10'],
                 ['1672617600000', '0']]}]}
credit(start_time=None, time_frame='week', export=False)

Creates a Panda’s dataframe or CSV file reporting on credit consumption within an ArcGIS Online organization.

Parameter

Description

start_time

optional datetime, the time to step back from. If None, the current time is used.

time_frame

optional string, is the timeframe report to create. Allowed values: today, week (default), 14days, 30days, 60days, 90days, 6months, year

export

optional boolean, if True, a csv is generated from the request. If False, a Panda’s dataframe is returned. Default is False

Returns:

string path to csv file or Panda’s Dataframe (default) that records the total number of credits consumed per:

  • hour if time_frame is today

  • day if time_frame is week, 7days, 14days, 30days, 60days or 90days

  • week if time_frame is 6months

  • month if time_frame is year

# Usage example

>>> usage_reporter = gis.admin.usage_reports

>>> usage_reporter.credit(start_time= jan2_23,
                          time_frame= "week")

    date    credits
    ________________________________________
    0       2022-12-26 16:00:00     173.1696
    ...
    6       2023-01-01 16:00:00     177.6483
generate_report(focus='org', report_type='users', title=None, duration=None, start_time=None, notify=False, future=True)

Generates the reports of the overall usage of the organizations. Reports define organization usage metrics for either a weekly or monthly time frame.

Parameter

Description

focus

Optional String. The report type. Currently, only the organization (org) report type is supported.

report_type

Required String. The type of report to generate.

Values:
  • ‘content’

  • ‘users’

  • ‘activity’

  • ‘credits’

  • ‘serviceUsages’

  • ‘itemUsages’

title

deprecated Optional String. The output report item’s title.

duration

Optional String. Specifies the time duration for the reports. This parameter is required when report_type is set to credits, activity, serviceUsages, or itemUsages.

Note

The daily value is only available when report_type is set to activity. The yearly value is only available when report_type is set to itemUsages.

Values:
  • ‘daily’

  • ‘weekly’

  • ‘monthly’

  • ‘quarterly’

  • ‘yearly’

start_time

Optional datetime.datetime. The start time of the time duration. The time format is Unix time with millisecond precision. If duration = ‘weekly’, the start_time value must be a time on Sunday or Monday GMT. If duration = ‘monthly, the start_time value must be on the first day of the month.

notify

Optional Boolean. The Job will print a message upon task completion.

future

Optional Boolean. Returns an asynchronous Job when True, when False, returns an Item.

Returns:

Async Job Object or Item

users(start_time=None, time_frame='week')

Creates a credit usage report for resources of an ArcGIS Online organization with results aggregated by specific username and user’s organization id.

Note

Reports can contain users outside your organization.

Parameter

Description

start_time

optional datetime, the time to step back from. If None, the current time is used.

time_frame

optional string, is the timeframe report to create. Allowed values: today, week, 14days, 30days, 60days, 90days, 6months, year

Returns:

dictionary reporting the number of credits consumed by users through this organization.

Results are aggregated by:
  • hour if time_frame is today

  • day if time_frame is week, 7days, 14days, 30days, 60days or 90days

  • week if time_frame is 6months

  • month if time_frame is year

 # Usage Example:

 >>> from arcgis.gis import GIS
 >>> import datetime as dt

 >>> gis = GIS(profile="my_organizational_profile")
 >>> usage_reporter = gis.admin.usage_reports

 >>> jan2_23 = dt.datetime(2023, 1, 2)
 >>> user_usg = usage_reporter.users(start_time = jan2_23,
                                     time_frame = "week")

 >>> list(user_usg.keys())
 ['startTime', 'endTime', 'period', 'data']

 >>> type(user_usg["data"])
 list

 ### The data key's value will be a list of
 ### dictionaries. Each dictionary will have varying keys.
 ### If the dictonary has no userOrgId key, that indicates
 ### a public user account.

 >>> user_usg['data'][1]
 {'username': '<user_name1>',
  'credits': [['1672099200000', '0.0'],
              ['1672185600000', '0.0'],
              ...
              ['1672617600000', '2.0E-4']]}

>>> user_usg['data'][2]
{'username': '<user_name2>',
 'userOrgId': 'JXrNeAy8ce1q2b4l'
 'credits': [['1672099200000', '0.0'],
             ['1672185600000', '0.0'],
            ...
             ['1672617600000', '0.0']]}

Bundle

class arcgis.gis.admin.Bundle(url, properties=None, gis=None)

Bases: object

This represents a single instance of an application bundle

assign(users)

Assigns the current application bundle to a list of users

Parameter

Description

users

Required List. A list of user names or User objects to assign the current application bundle to.

Returns:

Boolean. True if successful else False

property properties

returns the application bundles properties

revoke(users)

Revokes the current application bundle to a list of users

Parameter

Description

users

Required List. A list of user names or User objects to remove the current application bundle to.

Returns:

Boolean. True if successful else False.

property users

returns a list of users assigned the application bundle

CategoryManager

class arcgis.gis.admin.CategoryManager(gis)

Bases: object

This class allows for the addition, removal and viewing of category schema.

add(items, category)

Adds a category to an existing set of items

Parameter

Description

items

Required Items. The content within a GIS that will be updated with a list of categories.

category

Required String. Assigns a category value to the items.

Returns:

Dictionary indicating ‘success’ or ‘error’

>>> item = [gis.content.get("<item id 1>"),
            gis.content.get("<item id 2>")]
>>> cs = gis.admin.category_schema
>>> print(cs.add(items=[item], category="/Categories/TEST3"))
[{'results': [{'itemId': '<item id 1>', 'success': True}]},
 {'results': [{'itemId': '<item id 2>', 'success': True}]}]
categorize_item(item, categories)

Assigns or removes a category to a single item.

Parameter

Description

item

Required Item or Item ID (string). The content within a GIS that will be updated with a list of categories.

categories

Required list. Assigns a list of string values to the item’s categories

Returns:

Boolean. True if successful else False

remove(items, category)

remove a category to an item or items

replace(items, old_category, new_catgory)

finds and replaces a category value with a new value one

reset(items)

deletes all the categories for a given set of items

property schema

Get/Set the catagory schema for a GIS.

When schema is used as a getter, then operation returns the GIS’ defined category schema is any.

When schema is used as a setter, the parameter:

Parameter

Description

value

optional list. The schema list. Syntax Example: [

{

“title”: “Themes”, “categories”: [

{

“title”: “Basemaps”, “categories”: [

{“title”: “Partner Basemap”}, {

“title”: “Esri Basemaps”, “categories”: [

{“title”: “Esri Redlands Basemap”}, {“title”: “Esri Highland Basemap”}

]

}

]

},

{

“title”: “Region”, “categories”: [

{“title”: “US”}, {“title”: “World”}

]

}]}]

ClassificationManager

class arcgis.gis.admin.ClassificationManager(url, gis)

Bases: object

This class provides properties for getting information about the classification schema and methods for managing it. This class is not meant to be initialized directly, but is accessed by using the classification property on the ArcGIS Enterprise admin object.

Note

ArcGIS Enterprise only.

>>> from arcgis.gis import GIS
>>> gis = GIS(profile="your_enterprise_admin_profile")

>>> classification_mgr = gis.admin.classification
>>> classification_mgr

Classification Manager @ <enterprise_url>/portal/sharing/rest/portals/self/classification
add(schema_file)

Adds a schema definition from a file to the current enterprise

Note

For detailed instructions on creating a classification schema, as well as example schemas, visit the ArcGIS/Classification GitHub repository.

Parameter

Description

schema_file

Required string. Pathway to a text file containing the JSON schema that defines the configuration options of the classification schema for the ArcGIS Enterprise organization.

Returns:

Boolean value indicating success or failure of the operation.

# Usage Example
>>> from arcgis.GIS import GIS
>>> gis = GIS(profile="your_enterprise_admin_profile")

>>> classify_mgr = gis.admin.classification
>>> classify_file_path = r"/path/on/system"

>>> classify_mgr.add(schema_file=classify_file_path)

True
delete()

Operation to remove the currently defined classification schema of the organization.

Returns:

Boolean value indicating the success or failure of the operation.

# Usage Example
>>> from arcgis.GIS import GIS
>>> gis = GIS(profile="your_enterprise_admin_profile")

>>> classify_mgr = gis.admin.classification
>>> classify_mgr.delete()

True
gis
property properties

Returns a Python dictionary with 2 keys whose values indicate the specific version of the classification schema and whether the organization has a scheme defined.

  • grammarVersion

  • hasClassificationSchema

# Example Usage:
>>> from arcgis.gis import GIS
>>> gis = GIS(profile="your_enterprise_admin_profile")

>>> classify_mgr = gis.admin.classification
>>> classify_mgr.properties

{'grammarVersion': '2.0', 'hasClassificationSchema': True}
property schema

Property that returns a Python dictionary representation of the defined classification schema of the organization.

Returns:

Dictionary representation of the classification schema.

Note

The value of each key returned will vary by organization. See the Esri classification repo for more detailed information regarding the classification schema.

session
url
validate_item_schema(classification=None, classification_schema=None)

Operation that would verify whether the classification that would be given to an Item is in the correct format.

Parameter

Description

classification

Optional dict. The classification payload for a given item.

classification_schema

Optional str. The classification payload represented as a file on the system.

validate_schema_file(schema_file)

Operation that determines whether the schema defined in a file adheres to the classification grammar included in the Portal for ArcGIS component of the ArcGIS Enterprise deployment.

Parameter

Description

schema_file

Required string. Path to a text file containing the JSON schema to validate.

Returns:

Boolean value indication success or failure of the operation.

CollaborationManager

class arcgis.gis.admin.CollaborationManager(gis, portal_id=None)

Bases: object

accept_invitation(first_name, last_name, email, invitation_file=None, invitation_JSON=None, webauth_username=None, webauth_password=None, webauth_cert_file=None, webauth_cert_password=None)

The accept_invitation operation allows a portal to accept a collaboration invitation. The invitation file received securely from the collaboration host portal must be provided. Once a guest accepts an invitation to a collaboration, it must link workspace(s) associated with the collaboration to local portal group(s). The guest must export a collaboration invitation response file and send it to the host. Once the host processes the response, content can be shared between the host and guest(s).

Parameter

Description

first_name

Required string. The first name of the contact person for the guest portal.

last_name

Required string. The last name of the contact person.

email

Required string. The email of the contact person.

invitation_file

Optional string. The invite file to upload to portal. Use either this parameter or invitation_JSON.

invitation_JSON

Optional string. The same contents as the invitation_file parameter but passed as a string. Use either this parameter or invitation_file.

webauth_username

Optional string. If the collaboration host requires web-tier authentication, optionally use this parameter to provide the host’s web-tier authentication user name.

webauth_password

Optional string. If the collaboration host requires web-tier authentication, optionally use this parameter to provide the host’s web-tier authentication password.

webauth_cert_file

Optional string. If the collaboration host requires web-tier authentication, optionally use this parameter to provide the host’s web-tier authentication certificate file.

webauth_cert_password

Optional string. If the collaboration host requires web-tier authentication, optionally use this parameter to provide the host’s web-tier authentication certificate password.

Returns:

Dictionary indicating ‘success’ or ‘error’

collaborate_with(guest_gis, collaboration_name, collaboration_description)

A high level method to quickly establish a collaboration between two GIS. This method uses defaults wherever applicable and internally calls the create, accept_invitation and invite_participant methods. This method will create a new group and a new workspace in both the host and guest GIS for this collaboration. Invitation and response files created during the collaborations will be downloaded to the current working directory.

Use the other methods if you need fine-grained control over how the collaboration is set up.

Parameter

Description

guest_gis

Required GIS. GIS object of the guest org or Enterprise.

collaboration_name

Required string. A generic name for the collaboration. This name is used with prefixes such as wksp_<your_collab_name>, grp_<your_collab_name> to create the collaboration workspace and groups.

collaboration_description

Optional string. A generic description for the collaboration.

Returns:

boolean

create(name, description, workspace_name, workspace_description, portal_group_id, host_contact_first_name, host_contact_last_name, host_contact_email_address, access_mode='sendAndReceive')

The create method creates a collaboration. The host of the collaboration is the portal where it is created. The initial workspace for the collaboration is also created. A portal group in the host portal is linked to the workspace. The access mode for the host portal is set. The contact information associated with the host can be specified; otherwise, the contact information for the administrator user performing the operation will be used.

Parameter

Description

name

Required string. Name of the collaboration

description

Required string. Description of the collaboration

workspace_name

Required string. The name of the initial workspace.

workspace_description

Required string. The description of the initial workspace.

portal_group_id

Required string. ID of group in the portal that will be linked with the workspace.

host_contact_first_name

Required string. The first name of the contact person for the collaboration host portal.

host_contact_last_name

Required string. The last name of the contact person for the collaboration host portal.

host_contact_email_address

Required string. The email address of the contact person for the collaboration host portal.

access_mode

Required string. The organization’s access mode to the workspace. Values: send | receive | sendAndReceive (default)

Returns:

the data item is registered successfully, None otherwise

list()

gets all collaborations for a portal

validate_invitation(first_name, last_name, email, invitation_file=None, invitation_JSON=None, webauth_username=None, webauth_password=None, webauth_cert_file=None, webauth_cert_password=None)

The validate_invitation method allows a portal to validate a collaboration invitation. The invitation file received securely from the collaboration host portal must be provided. Validation checks include checking that the invitation is for the intended recipient.

Parameter

Description

first_name

Required string. The first name of the contact person for the guest portal.

last_name

Required string. The last name of the contact person.

email

Required string. The email of the contact person.

invitation_file

Optional string. The invite file to upload to portal. Use either this parameter or invitation_JSON.

invitation_JSON

Optional string. The same contents as the invitation_file parameter but passed as a string. Use either this parameter or invitation_file.

webauth_username

Optional string. If the collaboration host requires web-tier authentication, optionally use this parameter to provide the host’s web-tier authentication user name.

webauth_password

Optional string. If the collaboration host requires web-tier authentication, optionally use this parameter to provide the host’s web-tier authentication password.

webauth_cert_file

Optional string. If the collaboration host requires web-tier authentication, optionally use this parameter to provide the host’s web-tier authentication certificate file.

webauth_cert_password

Optional string. If the collaboration host requires web-tier authentication, optionally use this parameter to provide the host’s web-tier authentication certificate password.

Returns:

Dictionary indicating ‘success’ or ‘error’

Collaboration

class arcgis.gis.admin.Collaboration(collab_manager, collab_id, portal_id=None)

Bases: dict

The collaboration resource returns information about the collaboration with a specified ID.

add_group_to_workspace(portal_group, workspace)
This operation adds a group to a workspace that participates in a portal-to-portal collaboration. Content shared

to the portal group is shared to other participants in the collaboration.

Parameter

Description

portal_group

Required Group of string. Group ID or object to add to the workspace.

Returns:

Dictionary indicating ‘success’ or ‘error’

add_workspace(name, description, config, portal_group_id)

The add_workspace resource adds a new workspace to a portal-to-portal collaboration. Only collaboration hosts can create new workspaces.

Parameter

Description

name

Required string. The name of the workspace.

description

Required string. Brief description of the workspace.

portal_group_id

Required string. The ID of the portal group linked with the workspace.

Returns:

Dictionary indicating ‘success’ or ‘error’

delete()

The delete operation deletes a portal-to-portal collaboration from the host portal. This stops any sharing set up from the collaboration. The collaboration will be removed on guest portals on the next refresh of their content based on the collaboration sharing schedule. Guests cannot delete collaborations, but they can discontinue participation in a collaboration via the removeParticipation endpoint.

delete_schedule(workspace_id)

Removes the scheduling job for synchronized items in a collaboration workspace.

Parameter

Description

workspace_id

Required string. Workspace ID to remove from the link.

Returns:

Boolean. True if successful else False.

export_invitation(out_folder)

The exportInvitationResponse operation exports a collaboration invitation response file from a collaboration guest portal. The exported response file must be sent via email or through other communication channels that are established in your organization to the inviting portal’s administrator. The inviting portal’s administrator will then import your response file to complete the establishment of trust between your portals. It is important that the contents of this response file are not intercepted and tampered with by any unknown entity.

Parameter

Description

out_folder

Required string. Save location of the file.

Returns:

Dictionary indicating ‘success’ or ‘error’

get_invitation(invitation_id)

The get_invitation operation returns the information about an invitation to participate in a portal-to-portal collaboration for a particular invitation with the specified ID.

get_participant(portal_id)

The participant operation provides information about the collaboration participant with a specified ID.

get_workspace(workspace_id)

The workspace resource provides information about the collaboration workspace with a specified ID.

import_invitation_response(response_file, webauth_username=None, webauth_password=None, webauth_cert_file=None, webauth_cert_password=None)

The importInvitationResponse operation imports an invitation response file from a portal collaboration guest. The operation is performed on the portal that serves as the collaboration host. Once an invitation response is imported, trust between the host and the guest is established. Sharing of content between participants can proceed from this point.

Parameter

Description

response_file

Required string. File path to the response file.

webauth_username

Optional string. If the collaboration host requires web-tier authentication, optionally use this parameter to provide the host’s web-tier authentication user name.

webauth_password

Optional string. If the collaboration host requires web-tier authentication, optionally use this parameter to provide the host’s web-tier authentication password.

webauth_cert_file

Optional string. If the collaboration host requires web-tier authentication, optionally use this parameter to provide the host’s web-tier authentication certificate file.

webauth_cert_password

Optional string. If the collaboration host requires web-tier authentication, optionally use this parameter to provide the host’s web-tier authentication certificate password.

Returns:

Dictionary indicating ‘success’ or ‘error’

invalidate(invitation_id)

The invalidate operation invalidates a previously generated portal-to-portal collaboration invitation. If a guest accepts this invitation and sends an invitation response for it, the response will not import successfully on the collaboration host.

property invitations

The invitations operation returns the invitation information for all the invitations generated by a portal-to-portal collaboration host.

invite_participant(config_json, expiration=24, guest_portal_url=None, guest_gis=None, save_path=None)

As a collaboration host, once you have set up a new collaboration, you are ready to invite other portals as participants in your collaboration. The inviteParticipant operation allows you to invite other portals to your collaboration by creating an invitation file. You need to send this invitation file to the administrator of the portal you are inviting to your collaboration. This can be done via email or through other communication channels that are established in your organization. It is important that the contents of this invitation file are not intercepted and tampered with by any unknown entity. The invitation file is in the format collaboration-<guestHostDomain>.invite. The administrator of the participant will accept the invitation by importing the invitation file into their portal. Their acceptance is returned to you as another file that you must import into your portal using the import_invitation_response operation. This will establish trust between your portal and that of your participant.

Parameter

Description

config_json

Required dict. A dict containing a map of access modes for the participant in each of the collaboration workspaces. Defined as: send | receive | sendAndReceive

Example:

config_json = [

{“workspace_id” : “send”}, {“workspace_id2” : “receive”}, {“workspace_id3” : “sendAndReceive”}

]

expiration

Optional integer. The time in UTC when the invitation to collaborate should expire.

guest_portal_url

Optional string. The URL of the participating org or Enterprise that you want to invite to the collaboration.

guest_gis

Optional GIS. GIS object to the guest collaboration site.

save_path

Optional string. Path to download the invitation file to.

Returns:

Contents of a file that contains the invitation information

participants()

The participants resource provides information about all of the participants in a portal-to-portal collaboration.

pause_schedule(workspace_id)

Suspends the scheduling job for synchronized items in a collaboration workspace.

Parameter

Description

workspace_id

Required string. Workspace ID to remove from the link.

Returns:

Boolean. True if successful else False

refresh(invitation_id)

The refresh operation refreshes a previously generated portal-to-portal collaboration invitation. The new invitation file is provided via a multipart POST response. The expiration for the invitation is extended an additional 72 hours from the current time.

Parameter

Description

invitation_id

Required string. ID of the invitation to refresh

Returns:

Dictionary indicating ‘success’ or ‘error’

remove_participant(portal_id)

The remove operation allows a collaboration host to remove a participant from a portal-to-portal collaboration.

Parameter

Description

portal_id

Required string. ID of the portal to remove.

Returns:

Dictionary indicating ‘success’ or ‘error’

remove_participation()

The removeParticipation operation removes collaboration participation by a guest from a collaboration, allowing a guest to exit a collaboration. This immediately disables further replication of data to and from the portal and the other collaboration participants.

The remove_portal_group_link operation removes the link between a collaboration workspace and a portal group. Replication of content discontinues when the link is removed.

Parameter

Description

workspace_id

Required string. Workspace ID to remove from the link.

Returns:

Dictionary indicating ‘success’ or ‘error’

remove_workspace(workspace_id)

The delete operation deletes a collaboration workspace. This immediately disables further replication of data to and from the portal and the collaboration participants.

Parameter

Description

workspace_id

Optional string. UID of the workspace to remove from the collaboration.

Returns:

Dictionary indicating ‘success’ or ‘error’

resume_schedule(workspace_id)

Resumes a paused scheduled synchronization.

Parameter

Description

workspace_id

Required string. Workspace ID to remove from the link.

Returns:

Boolean. True if successful else False.

schedule(workspace_id)

Collaboration guests can use the schedule resource to return a job schedule for synchronized items in a collaboration workspace. The response is a single JSON object that represents a job schedule.

Parameter

Description

workspace_id

Required string. Workspace ID to remove from the link.

Returns:

A dictionary of the job schedule

sync(workspace_id, run_async=False)

The sync endpoint is provided to allow execution of a data sync on a particular workspace. The operation is allowed on the participant that is designated to initiate sync operations as determined during trust establishment between the collaboration host and a guest participant. Typically, the guest participant is designated to initiate sync operations. Note that if a scheduled sync operation is already in progress a new sync is not started unless the current sync operation is finished.

When running sync in synchronous mode, the client will be blocked until the operation is completed. Invoking sync in synchronous mode is good for quickly syncing an item (that is not large) if the client does not want to wait for the next scheduled sync.

Asynchronous mode allows a client to get response immediately so it does not have to wait and is not blocked from performing other tasks.

Parameter

Description

workspace_id

Required string. Workspace ID to remove from the link.

run_async

Optional Boolean. When true, the job will run asynchronously.

Returns:

Dictionary indicating ‘success’ or ‘error’

sync_details(workspace_id, sync_id)

Provides a detailed description of status for a selected sync ID.

Parameter

Description

workspace_id

Required string. Workspace ID to examine sync jobs.

sync_id

Required String. When a sync is performed, an ID is generated to track the status of the synchronization of the collaboration.

Returns:

Dictionary indicating ‘success’ or ‘error’

sync_status(workspace_id)

Provides a status summary of each scheduled sync for items in a collaboration workspace.

Parameter

Description

workspace_id

Required string. Workspace ID to examine sync jobs.

Returns:

List[Dict]

update_access_modes(portal_id, workspace_access_json)

The update_access_modes operation updates the access mode for a specific participant in a portal-to-portal collaboration.

Parameter

Description

portal_id

Required string. UID of the Portal

workspace_access_json

Required dict/string. JSON describing the participant’s access mode.

Returns:

Dictionary indicating ‘success’ or ‘error’

update_collaboration(name=None, description=None, config=None)

The updateInfo operation updates certain properties of a collaboration, primarily its name, description, and configuration properties. The updates are propagated to guests when the next scheduled refresh of content occurs.

Parameter

Description

name

Optional string. Name of the collaboration

description

Optional string. The description of the collaboration

config

Optional dict. The configuration properties of the collaboration

Returns:

Dictionary indicating ‘success’ or ‘error’

update_item_delete_policy(participant_id, delete_contributed_items=False, delete_received_items=False)

The participants resource provides information about all of the participants in a portal-to-portal collaboration.

Parameter

Description

participant_id

Required String. The participant unique id to update.

delete_contributed_items

Optional Boolean. When a participant leaves or deletes a collaboration, this property determines whether contributed items will be deleted or maintained.

delete_received_items

Optional Boolean. When a participant leaves or deletes a collaboration, this property determines whether received items will be deleted or maintained.

Returns:

Dictionary indicating ‘success’ or ‘error’

The update_portal_group_link operation updates the group linked with a workspace for a participant in a portal-to-portal collaboration. Content shared to the portal group is shared to other participants in the collaboration.

Parameter

Description

workspace_id

Required string. UID of the workspace

portal_id

Required string. UID of the Portal

enable_realtime_sync

Optional boolean. Determines whether the content shared with the group is shared to other collaboration participants in real time, updating whenever changes are made, or whether the content is shared based on a schedule set by the collaboration host.

copy_feature_service_data

Optional boolean. Boolean value used when Feature Service data is shared in a group that is linked to a distributed collaboration workspace. When set to “true” Feature Service data will be copied to collaboration participants.

copy_by_ref_on_fail

Optional boolean. If the copy feature service data fails, and set to True, the enterprise will reference the data instead of copying it. This is supported on 10.9+.

enable_bidirectional_sync

Optional boolean. When set to true, edits to shared feature services can be allowed two-way to eligible participants. This is supported on 10.9+.

Returns:

Dictionary indicating ‘success’ or ‘error’

update_schedule(workspace_id, start_time, interval=24, repeat_count=-1)

Collaboration guests can use the schedule resource to return a job schedule for synchronized items in a collaboration workspace. The response is a single JSON object that represents a job schedule.

Parameter

Description

workspace_id

Required string. Workspace ID to remove from the link.

start_time

Required Integer. A job’s scheduled start time. The startTime is in Unix time in milliseconds. The default is the current time of the request call.

interval

Optional Integer. A positive integer that represents time (in hours) between each job trigger. The default interval is 24 hours.

repeat_count

Optional Integer. A positive integer or -1 which represents how many times to keep re-triggering this job after which it will be automatically deleted. The default is -1 which means repeat indefinitely.

Returns:

Boolean. True if successful else False.

update_workspace(workspace_id, name=None, description=None, config=None, max_item_size=None, max_replication_size=None, copy_by_ref_on_fail=False)

The updateInfo operation updates certain collaboration workspace properties.

Parameter

Description

workspace_id

Required string. UID of the workspace

name

Optional string. The name of the workspace

description

Optional string. A brief set of texts that explains the workspace

config

Optional dict. The configuration details of the new workspace. Removed at 10.6.

max_item_size

Optional Integer. The maximum item size in MBs.

max_replication_size

Optional Integer. The maximum replication item size in MBs.

copy_by_ref_on_fail

Optional Boolean. Determines whether a failed attempt to copy should revert to sharing by reference. For example, in cases where the imposed size limit has been exceeded.

Returns:

Dictionary indicating ‘success’ or ‘error’

validate_invitation_response(response_file)

Prior to importing a collaboration invitation response, the invitation response file can be validated by using the validate_invitation_response operation to check for the existence of the collaboration and validity of the invitation response file.

Parameter

Description

response_file

Required string. Path to the collaboration response file.

Returns:

Dictionary indicating ‘success’ or ‘error’

property workspaces

The workspaces resource lists all the workspaces in a given collaboration. A workspace is a virtual space in the collaboration to which each participating portal is either sending or receiving content. Workspaces can only be created by the collaboration owner.

CreditManager

class arcgis.gis.admin.CreditManager(gis)

Bases: object

Manages an ArcGIS Online organization’s credits for users and sites

Example Usage

>>> from arcgis.gis import GIS

>>> gis = GIS(profile='your_online_admin_account')
>>> cm = gis.admin.credits
>>> cm

<arcgis.gis.admin._creditmanagement.CreditManager object at 0x...>
allocate(username, credits=None)

Allows organization administrators to allocate credits for organizational users in ArcGIS Online

Parameter

Description

username

Required string.The name of the user to assign credits to.

credits

Optional float. The number of credits to assign to a user. If None is provided, it sets user to unlimited credits.

Returns:

Boolean. True if successful else False

# Usage Example:
>>> from arcgis.gis import GIS
>>> gis = GIS(profile="your_online_admin_profile")

>>> credit_mgr = gis.admin.credits
>>> credit_mgr.allocate("gis_editor", 250)
credit_usage(start_time=None, end_time=None, time_frame='week')

returns the total credit consumption for a given time period.

arguements

description

start_time

datetime.datetime object. This is the date to start at.

end_time

datetime.datetime object. This is the stop time to look for credit consumption. It needs to be at least 1 day previous than then start_time.

time_frame

Optional string. The time frame to create the report for.

Allowed values:

  • today

  • week (default)

  • 7days

  • 14days

  • 30days

  • 60days

  • 90days

  • 6months

  • year

Note

If end_time is provided, this parameter is ignored.

returns: dictionary

# Usage Example:
>>> import datetime as dt
>>> from arcgis.gis import GIS

>>> gis = GIS(profile="your_online_admin_profile")

>>> credit_mgr = gis.admin.credits

>>> start_date = dt.datetime(2024, 1, 4, 9)
>>> end_date = dt.datetime(2024, 1, 2, 9)

>>> usage_report_dict = credit_mgr.credit_usage(start_time=start_date,
                                                end_time=end_date)
>>> usage_report_dict

{'intnotebks': 11.9,
 'schdnotebks': 2.225,
 'geocode': 167.67,
 'tiles': 0.588,
 ...
 'spanalysis': 368.69302}
property credits

returns the current number of credits on the GIS

deallocate(username)

Allows organization administrators to set credit limit to unlimited for organizational users in ArcGIS Online

Parameter

Description

username

Required string.The name of the user to set to unlimited credits.

Returns:

Boolean. True if successful else False

property default_limit

Gets/Sets the default credit allocation for ArcGIS Online

disable()

disables credit allocation on ArcGIS Online

enable()

enables credit allocation on ArcGIS Online

property is_enabled
Returns:

A boolean that shows whether the organization has credit budgeting enabled.

License

class arcgis.gis.admin.License(gis, info)

Bases: object

Represents a single entitlement for a given organization.

Parameter

Description

gis

Required GIS, the gis connection object

info

Required dictionary, the information provided by the organization’s site containing the provision and listing information.

Returns:

License object

all()

returns a list of all usernames and their entitlements for this license

assign(username, entitlements, suppress_email=True, overwrite=True)

grants a user an entitlement.

Parameter

Description

username

Required string, the name of the user you wish to assign an entitlement to.

entitlements

Required list of strings or strings, of entitlements values.

suppress_email

Optional boolean, if True, the org will not notify a user that their entitlements has changed (default) If False, the org will send an email notifying a user that their entitlements have changed.

overwrite

Optional boolean, if True, existing entitlements for the user are dropped

Returns:

Boolean. True if successful else False.

check(user)

Checks if the entitlement is assigned or not.

Parameter

Description

user

Required string, the name of the user you want to examine the entitlements for.

Returns:

list

property offline_report

Return a DataFrame that shows the usernames and whether they have taken a license offline

Returns:

pd.DataFrame

plot()

returns a simple bar chart of assigned and remaining entitlements

property properties
property report

returns a Panda’s Dataframe of the licensing count.

revoke(username, entitlements, suppress_email=True)

removes a specific license from a given entitlement

Parameter

Description

username

Required string, the name of the user you wish to assign an entitlement to.

entitlments

Required list of strings or string, a list of entitlements values, if * is given, all entitlements will be revoked

suppress_email

Optional boolean, if True, the org will not notify a user that their entitlements has changed (default) If False, the org will send an email notifying a user that their entitlements have changed.

Returns:

boolean

user_entitlement(username)

Checks if a user has the entitlement assigned to them

Parameter

Description

username

Required string, the name of the user you want to examine the entitlements for.

Returns:

dictionary

LicenseManager

class arcgis.gis.admin.LicenseManager(url, gis=None, initialize=True, **kwargs)

Bases: BasePortalAdmin

Provides tools to work and manage licenses in ArcGIS Online and ArcGIS Enterprise (Portal)

Parameter

Description

url

required string, the web address of the site to manage licenses. example: https://<org url>/<wa>/sharing/rest/portals/self/purchases

gis

required GIS, the gis connection object

Returns:

LicenseManager Object

all()

Returns all Licenses registered with an organization

Returns:

List of License objects

property bundles

Returns a list of Application Bundles for an Organization

Returns:

List of Bundle objects

get(name)

Retrieves a license by it’s name (title)

Parameter

Description

name

required string, name of the entitlement to locate on the organization. example: name=”arcgis pro”

Returns:

List of License objects

property offline_pro

Administrators can get/set the disconnect settings for the ArcGIS Pro licensing. A value of True means that a user can check out a license from the enterprise inorder to use it in a disconnected setting. By setting offline_pro to False, the enterprise users cannot check out licenses to work in a disconnected setting for ArcGIS Pro.

Parameter

Description

value

Required bool. Value: True | False

Returns:

Boolean

provisions(user, all_available=False, included_expired=True, return_client_ids=False)

Allows administrators to manage a user’s list of provsional Add-On Licenses.

LivingAtlas

class arcgis.gis.admin.LivingAtlas(url, gis)

Living Atlas of the World content is a collection of authoritative, ready-to-use, global geographic content available from ArcGIS Online. The content includes valuable maps, data layers, tools, services and apps for geographic analysis. When you make Living Atlas content available to your portal members, you’re providing them with ready-made content that they can use alone or in combination with their own content to create maps, scenes, and apps and perform analysis in the portal Map Viewer or Insights for ArcGIS.

Note:

Your portal must have access to the Internet to use Living Atlas content from ArcGIS Online

Types of content available All the Living Atlas content you access from Portal for ArcGIS was created by Esri. If your portal can connect to the Internet, the following three levels of Living Atlas content are available to you from ArcGIS Online:

Content Type

Description

Default

Content that does not require you to sign in to an ArcGIS Online account. Available by default in ArcGIS Enterprise.

Subscriber

Subscriber content is the collection of ready-to-use map layers, analytic tools, and services published by Esri that requires an ArcGIS Online organizational subscription account to access. This includes layers from Esri such as Landsat 8 imagery, NAIP imagery, landscape analysis layers, and historical maps. Subscriber content is provided as part of your organizational subscription and does not consume any credits.

Premium

Premium content is a type of subscriber content that requires an ArcGIS Online organizational subscription account to access and consumes credits. Access and credit information is listed in the description details for each item. Premium content provides portal members with access to ready-to-use content such as demographic and lifestyle maps as well as tools for geocoding, geoenrichment, network analysis, elevation analysis, and spatial analysis.

See Configure Living Atlas content: Types of Content Available for complete details.

Portal administrators do not need to create this class directly in most circumstances. Instead, first access the PortalAdminManager using the admin property of the GIS. Then use the living_atlas property to return a LivingAtlas object.

ent_living_atlas = gis.admin.living_atlas

To create an instance directly:

Parameter

Description

url

required string, the web address of the site to manage licenses.

gis

required GIS object.

ent_living_atlas = LivingAtlas(url="https://portal_url/web_adaptor/portaladmin/system/content/livingatlas"
                               gis=gis)
disable_premium_atlas()

Disables the Premium Living Atlas Content for a local portal.

>>> living_atlas = gis.admin.living_atlas

>>> living_atlas.disable_premium_atlas()

    True

>>> living_atlas.status(liv_atl_group)

    {'publicContentEnabled': True,
     'subscriberContentEnabled': True,
     'premiumContentEnabled': False,
     'publicContentShared': True,
     'subscriberContentShared': True,
     'premiumContentShared': False,
     'subscriberContentUsername': 'demos_deldev',
     'subscriberUserValid': 'Valid',
     'premiumContentUsername': None,
     'premiumUserValid': 'UnKnown',
     'upgraded': True}
disable_public_access()

Disables the Public Living Atlas content.

Returns:

Boolean. True means disabled, False means failure to disable.

disable_subscriber_atlas()

Disables the Subscriber level Living Atlas Content for a local portal.

enable_premium_atlas(username, password)

Enables the Premium Living Atlas Content for a local portal.

Premium content is a type of subscriber content that requires an ArcGIS Online organizational subscription account to access and consumes credits. Access and credit information is listed in the description details for each item. Premium content provides portal members with access to ready-to-use content such as demographic and lifestyle maps as well as tools for geocoding, geoenrichment, network analysis, elevation analysis, and spatial analysis.

Parameter

Description

username

required string, username for ArcGIS Online

password

required string, login password for ArcGIS Online account

Note:

This will cost you credits.

>>> ent_living_atlas = gis.admin.living_atlas

>>> liv_atl_groups = ent_living_atlas.groups
>>> liv_atl_groups

    [<Group title:"Living Atlas" owner:esri_livingatlas>,
     <Group title:"Living Atlas Analysis Layers" owner:esri_livingatlas>]

>>> liv_atl_group = liv_atl_groups[0]

>>> living_atlas.status(liv_atl_group)

     {'publicContentEnabled': True,
      'subscriberContentEnabled': True,
      'premiumContentEnabled': False,
      'publicContentShared': True,
      'subscriberContentShared': True,
      'premiumContentShared': False,
      'subscriberContentUsername': 'demos_deldev',
      'subscriberUserValid': 'Valid',
      'premiumContentUsername': None,
      'premiumUserValid': 'UnKnown',
      'upgraded': True}

>>> living_atlas.enable_premium_atlas("org_admin",
                                      "org_admin_password")

       True

>>> living_atlas.status(liv_atl_group)

     {'publicContentEnabled': True,
      'subscriberContentEnabled': True,
      'premiumContentEnabled': True,
      'publicContentShared': True,
      'subscriberContentShared': True,
      'premiumContentShared': True,
      'subscriberContentUsername': 'demos_deldev',
      'subscriberUserValid': 'Valid',
      'premiumContentUsername': 'arcgispyapibot',
      'premiumUserValid': 'InValid',
      'upgraded': True}
enable_public_access()

Enables the Public Living Atlas content.

Living Atlas of the World content is a collection of authoritative, ready-to-use, global geographic content available from ArcGIS Online. The content includes valuable maps, data layers, tools, services and apps for geographic analysis.

Returns:

Boolean. True if enabled. False if failed to enable.

enable_subscriber_atlas(username, password)

Enables the Subscriber level Living Atlas Content for an ArcGIS Enterprise portal.

Subscriber content is the collection of ready-to-use map layers, analytic tools, and services published by Esri that requires an ArcGIS Online organizational subscription account to access. This includes layers from Esri such as Landsat 8 imagery, NAIP imagery, landscape analysis layers, and historical maps. Subscriber content is provided as part of your organizational subscription and does not consume any credits. Layers included in the Living Atlas subscriber content are suitable for use with analysis tools.

Parameter

Description

username

required string, username for ArcGIS Online

password

required string, login password for the specific ArcGIS Online account

Note:

Use of these layers will not incur a credit cost for your organization.

property groups

returns a list of all living atlas groups

status(group)

Returns information about the sharing status of the Living Atlas with the group.

Parameter

Description

group

required string or Group object

>>> ent_living_atlas = gis.admin.living_atlas

>>> liv_atl_groups = ent_living_atlas.groups
>>> liv_atl_groups

    [<Group title:"Living Atlas" owner:esri_livingatlas>,
     <Group title:"Living Atlas Analysis Layers" owner:esri_livingatlas>]

>>> liv_atl_group = liv_atl_groups[0]

>>> living_atlas.status(liv_atl_group)

     {'publicContentEnabled': True,
      'subscriberContentEnabled': True,
      'premiumContentEnabled': False,
      'publicContentShared': True,
      'subscriberContentShared': True,
      'premiumContentShared': False,
      'subscriberContentUsername': 'demos_deldev',
      'subscriberUserValid': 'Valid',
      'premiumContentUsername': None,
      'premiumUserValid': 'UnKnown',
      'upgraded': True}
property update_manager

returns the status of the living atlas page

update_premium_account(username, password)

Updates the Username/Password for the Living Atlas Premium User. The account must be an ArcGIS Online account.

Parameter

Description

username

Required string. The user who will be used for to access the subscriber Living Atlas content.

password

Required string. The credentials for the user above.

Returns:

Boolean. True if successful else False.

update_subscriber_account(username, password)

Updates the Username/Password for the Living Atlas Subscriber User. The account must be an ArcGIS Online account.

Parameter

Description

username

Required string. The user who will be used for to access the subscriber Living Atlas content.

password

Required string. The credentials for the user above.

Returns:

Boolean. True if successful else False.

upgrade()

Upgrades the Living Atlas Group to the latest version of the Living Atlas data. See Living Atlas content life cycles and updates for details.

Returns:

Boolean

validate_credentials(username, password, online_url=None)

Ensures the arguments contain valid credentials to access an active ArcGIS Online Organization.

Parameter

Description

username

required string, username for ArcGIS Online

password

required string, login password for ArcGIS Online account

online_url

optional string, Url to ArcGIS Online site. default is https://www.arcgis.com

Returns:

Boolean. True if successful else False.

LivingAtlasManager

class arcgis.gis.admin.LivingAtlasManager(url, session)

Provides a collection of tools to update living atlas on an existing enterprise configuration.

check()

Provides a way for users to see if new living atlas content is available for update

property package_directory

returns the information about the package directory

property properties

returns the living atlas manager’s properties

session = None
update(package_id, start_time=None)

Updates the living atlas to a given package

Parameter

Description

package_id

Required str. The package ID to update with. This can be obtained from check method.

start_time

Optional datetime.datetime. The date/time to run the update.

url = None

LivingAtlasJob

class arcgis.gis.admin.LivingAtlasJob(url, session)

The Living Atlas Update Job

property properties

returns the job information

result()

waits for the process to complete and returns the final messages

status()

returns the state of a given job

IdentityProviderManager

class arcgis.gis.admin.IdentityProviderManager(gis=None)

Bases: object

Manages and Updates the SAML identity provider configuration for a given GIS.

property configuration

Gets, updates, or Adds a SAML provider

Arguement

Value

value

required dictionary. This property sets, updates or deletes an IDP configuration for a given GIS.

To configure an IDP, provide the key/value Example:

idp.configuration = {‘name’ : ‘Enterprise IDP’, ‘idpMetadataFile’ : ‘metadata.xml’}

Once a site has been configured to use IDP, the configuration can be updated by passing in the key/value pair dictionary. Example:

idp.configuration = {‘name’ : ‘Acme IDP Login’}

To erase an IDP configuration, set the value to None Example:

idp.configuration = None

Everytime the IDP configuration is updated, the changes can be seen by calling the ‘configuration’ property and the new results will be returned as a dictionary.

Key:Value Dictionary for Argument value

Key

Value

bindingPostUrl

Optional string. If the idpMetadataFile isn’t specified when an administrator, this parameter is required. It is federated identity provider post url.

bindingUrl

Optional string. If the idpMetadataFile isn’t specified when an administrator, this parameter is required. It is federated identity provider url that we have to redirect the user to login to.

certificate

Optional string. the X509Certificate that needs to be used to validate the SamlResponse from the identity provider.

encryptionCertificate

Optional string. the X509Certificate that needs to be used to validate the SamlResponse from the identity provider.

encryptionSupported

Optional bool. Tells is the SAML provider supports encryption.

entityId

Optional string. Name of the entity ID.

groups

Optional list. List of group ids that users will be put in on when they signup to join the GIS.

id

Optional string. unique identifier of the IDP provider.

idpMetadataFile

Optional string. In the case the URL is not accessible, then the same IDP Metadata file can be uploaded.

level

Optional integer. Either value 1 or 2. The default level a user will be created as. The default is 2.

logoutUrl

Optional string. The logout SAML url.

name

Optional string. It is the name of the organization’s federated identity provider. This is also the name we show up in the Signin page.

roleId

Optional string. Default role new users will be.

signUpMode

Optional string. This is how new users are added to the GIS. There are two modes: Invitation, Automatic Invitation user needs to get an invitation and then signin through federated identity provider. With Automatic all users that signin through the federated identity provider will be added as a user. The privilege/role is set to ‘user’ Default is Invitation.

supportSignedRequest

Optional boolean. Determines if signed requests are supported from the provider.

supportsLogoutRequest

Optional boolean. Determines if logout requests are accepted.

updateProfileAtSignin

Optional boolean. If True, users have to update the profile.

useSHA256

Optional boolean. If set to true, SHA256 encryption will be used.

userCreditAssignment

Optional integer. Assigns a set number of credits to new users. The default is -1 (infinite).

property properties

returns the properties of the IDP configuration

PasswordPolicy

class arcgis.gis.admin.PasswordPolicy(url, gis=None, **kwargs)

Bases: BasePortalAdmin

Manages a GIS Security Policy. Administrators can view, update or reset the site’s security policy.

property lockout_policy

gets/sets the current security policy

property policy

gets/sets the current security policy

reset()

resets the security policy to the default install settings

PartneredCollabManager

class arcgis.gis.admin.PartneredCollabManager(url, gis)

Bases: object

A class for managing partnered collaborations, which are utilized to seamlessly share content with other ArcGIS Online organizations. When two or more organizations create a partnered collaboration, they enter a partnership that allows their members to work closely with each other and each other’s content using groups. For further details see Understanding collaborations. For detailed workflow example, please read The Power of Partnered Collaboration.

A user must have administrator privileges to access this object. Instances are not meant to be created directly, but rather returned using the partnered_colloboration property of an ArcGIS Online Administrator object.

# Usage Example:
>>> from arcgis.gis import GIS
>>> gis = GIS(profile="your_online_admin_profile")

>>> agol_mgr = gis.admin
>>> partnered_collab_mgr = agol_mgr.partnered_colloboration
>>> partnered_collab_mgr

<arcgis.gis.admin._partnercollab.PartneredCollabManager object at <memory address>>
collaborations(include_hub=False)

Returns a Python generator that can retrieve all the partnered collaborations for the current organization.

Parameter

Description

include_hub

Optional Boolean. Indicates whether collaborations implemented through ArcGIS Hub should be included in the generator returned by this method. Default value is False.

# Usage Example:
>>> from arcgis.gis import GIS
>>> gis = GIS(profile="your_online_admin_profile")

>>> partner_collab_mgr = gis.admin.partnered_collaboration
>>> partner_collab_gen = partner_collab_mgr.collaborations()

>>> partner_collab_obj = next(partner_collab_gen)
>>> partner_collab_obj

<arcgis.gis.admin._partnercollab.PartneredCollaboration object at 0x...>
property coordinators

returns a Python generator object that can be used to get the org users assigned as coordinators for partner collaborations. This property also serves as the way to set additional coordinators by assigning a list of User objects.

Note

In order to serve as coordinators, users must be either an Administrator in the org or assigned the Facilitator role. In addition, users must have their profile access set to Organization or Everyone. See Manage collaboration coordinators for details.

#Usage example to set coordinators

>>> from arcgis.gis import GIS
>>> gis = GIS(profile="your_online_admin_profile")

>>> partner_clb_mgr = gis.admin.partnered_collaboration

>>> new_coordinators = [usr for usr in gis.users.search("*")
                        if usr.role == "org_admin"][:3]
>>> partner_clb_mgr.coordinators = new_coordinators

>>> for clb_coordinator in partner_clb_mgr.coordinators:
        print(f"{clb_coordinator.username:25}{type(clb_coordinator)}")

Collab_Coordinator1      <class 'arcgis.gis.User'>
Org_Admin_Overall        <class 'arcgis.gis.User'>
create(message, org_url=None, org_id=None, search_users=False)

Creates a partnered collaboration on the ArcGIS Online site.

Parameter

Description

message

Required String. The message to send to the organization about

org_url

Required String. The url of the organization to partner with.

org_id

Optional String. The ID of the organization to partner with.

search_users

Optional boolean. Allows partnered organization members to search for users within your organization.

Returns:

bool

property limits

Returns the Organization’s limits of creating collaborations

property properties

Returns various attributes about partnered collaborations of the current organzations.

Note

ArcGIS Hub is implemented with a similar mechanism to Partnered Collaborations. Properties about the relationship with ArcGIS Hub is returned in this dictionary as well.

# Usage Example: Organization that initiated a Partner Collaboration
#                and uses Hub Basic

>>> from arcgis.gis import GIS
>>> gis = GIS(profile="your_online_admin_profile")

>>> collab_mgr = gis.admin.partnered_collaboration
>>> collab_mgr.properties

{'total': 2,
 'start': 1,
 'num': 10,
 'nextStart': -1,
 'trustedOrgs': [{'from': {'orgId': 'JQx...',
                          'usersAccess': True,
                          'established': 1566327495000,
                          'hub': True,
                          'state': 'active'},
                 'to': {'orgId': 'aee...',
                        'usersAccess': True,
                        'established': 1566327495000,
                        'name': 'Hub Community',
                        'hub': True,
                        'state': 'active'}},
                {'from': {'orgId': 'JQx...',
                          'usersAccess': False,
                          'established': 1705623169000,
                          'hub': False,
                          'state': 'active'},
                 'to': {'orgId': 'KRW...',
                        'usersAccess': False,
                        'established': -1,
                        'name': 'Organization for Demo',
                        'hub': False,
                        'state': 'active'}}]}
Returns:

dict

property session

returns the current EsriSession

property url

returns the URL of the endpoint

PartneredCollaboration

class arcgis.gis.admin.PartneredCollaboration(url, gis)

Bases: object

Represents a single partnered collaboration for the organization.

accept(user_access)

Accepts the invitation and establishes a partnered collaboration.

Parameter

Description

user_access

Required Boolean. Indicates whether the users within the partnered organization can search for users within the accepting organization.

delete(message=None)

This operation ends the partnered collaboration

Parameter

Description

message

Optional String. Text to appear in the email notification to the collaboration partner administrators and coordinators when ending the collaboration.

property groups

Returns a generator for accessing the groups who have members in either of the organizations in a partnered collaboration.

property is_accepted

Checks whether a partnered collaboration has been accepted.

property is_active

Checks whether the collaboration is active between both collaborating organizations.

property properties

Returns a dictionary indicating various attributes of the collaboration from the perspective of the organization.

#Usage Example
>>> from arcgis.gis import GIS
>>> gis = GIS(profile="your_online_admin_profile")

>>> partner_collab_mgr = gis.admin.partnered_collaboration

>>> partner_collab = next(partner_collab_mgr.collaboration(include_hub=False))
>>> partner_collab.properties

{'from': {'orgId': 'JXM4...',
          'usersAccess': True,
          'established': 1706041472000,
          'hub': False,
          'state': 'active'},
 'to': {'orgId': 'SPK1...',
        'usersAccess': True,
        'established': 1706218200000,
        'name': 'My Account',
        'hub': False,
        'state': 'active'}}
property search_users

Property used to get or set the ability for collaboration members to search for users with public or organization access profiles within collaborating organizations.

# Usage Example:
>>> from arcgis.gis import GIS
>>> gis = GIS(profile="your_online_admin_profile")

>>> partner_collab = next(gis.admin.partnered_collaboration.collaborations())
>>> parnter_collab.search_users = True
property session

Returns an EsriSession object.

property suspend

Gets/sets the state of the collaboration. To suspend collaboration, set the property to True

Returns:

Boolean. False means the collaboration is not suspended. True means the partnership is suspended.

# Usage Example: Suspend the collaboration
>>> from arcgis.gis import GIS
>>> gis = GIS(profile="your_online_admin_profile")

>>> partner_collab_mgr = gis.admin.partnered_collaboration
>>> partner_collab = next(partner_collab_mgr.collaborations())

# Get current suspension status
>>> partner_collab.suspend
False

# Suspend the collaboration
>>> partner_collab.suspend = True
property url

PortalResourceManager

class arcgis.gis.admin.PortalResourceManager(gis)

Bases: object

Helper class to manage a GIS’ resources

Parameter

Description

gis

required GIS, connection to ArcGIS Online or ArcGIS Enterprise

add(key=None, path=None, text=None, **kwargs)

The add resource operation allows the administrator to add a file resource, for example, the organization’s logo or custom banner. The resource can be used by any member of the organization. File resources use storage space from your quota and are scanned for viruses.

Parameter

Description

key

optional string, look up key for file

path

optional string, file path to the local resource to upload

text

optional string, text value to add to the site’s resources

access

optional string, sets the access level for the resource. The default is ‘public’. Values: public, org, orgprivate

Returns:

boolean

delete(key)

The Remove Resource operation allows the administrator to remove a file resource.

Parameter

Description

key

optional string, look up key for file to delete

Returns:

boolean

get(resource_name, download_path=None)

Download or get a portal resource item

Parameter

Description

resource_name

optional string, key/name of data

download_path

optional string, save folder location

Returns:

path to data or raw data if not file.

list(start=1, num=100)

returns a list of resources uploaded to portal. The items can be images, files and other content used to stylize and modify a portal’s appearance.

Parameter

Description

start

optional int, start location of the search. The default is a value of 1

num

optional int, the number of search results to return at one time. The value ranges between 1-100 (max). Default: 100 and -1 means all resources

Returns:

boolean

UX

class arcgis.gis.admin.UX(gis)

Bases: object

Helper class for modifying common org settings. This class is not created by users directly. An instance of the class, called ‘ux’, is available as a property of the GIS object. Users call methods on this ‘ux’ object to set informational banner, background, logo, name etc. There are also other helper classes to call from this. By calling the ‘org_map_editor’ or ‘homepage_editor’ more methods can be found to change org settings specific to those categories.

property admin_contacts

An array of chosen administrators listed as points of contact whose email addresses will be listed as points of contact in the automatic email notifications sent to org members when they request password resets, help with their user names, modifications to their accounts, or any issues related to the allocation of credits to their accounts.

clone(*, targets=None, workspace_folder=None, package_save_folder=None, package_name=None)

Copies the UX settings from the source WebGIS site to the destination WebGIS site or to a .uxpk offline file. When directly connected to two WebGIS’, this method performs the clone operation immediately. When cloning in an offline situation, a .uxpk is created and stored on the user’s local hard drive.

Parameter

Description

targets

list[GIS | None]. The sites to clone to. If None is given, then a local file is returned.

workspace_folder

Optional String. The workspace where the temporary files are processed.

package_save_folder

Optional String. The output folder where the offline package is saved.

package_name

Optional String. The saved package name minus the extension.

Returns:

list[concurrent.futures.Future]

Get and set the contact link for the site.

property description

Get/Set the site’s description.

Parameter

Description

description

Required string. Descriptive text of the site. If None, the value is reset to default.

Returns:

dictionary

property description_visibility

Get/Set the site’s description visibility

Parameter

Description

visiblity

Required boolean. If True, the desciptive text will show on the home page. If False, the descriptive text will not be displayed

Returns:

boolean or error

property featured_content

Gets/Sets the featured content group information.

If you set the featured content, reinstantiate to update the gis properties and see the updated list of featured_content.

Parameter

Description

content

Required list or dictionary, defines the group(s) of the feature content area on an organizational site. A value of None will reset the value back to no featured groups.

To add a new group to the list you must pass in the list of current featured content and include the new group in the list. “id” key must be in the dictionary, extra keys are ok.

It is also acceptable to pass a list of Group class instances.

Example: [{“id”: <group_id>}, {“id”: <group_id>}, etc.]

Returns:

dictionary

property gallery_group

The gallery highlights your organization’s content. Choose a group whose content will be shown in the gallery. To change the group, assign either an instance of Group or the group id. Setting to None will revert to default.

Returns:

An instance of Group if a group is set, else the default or None

Get your organization’s logo/thumbnail. You can use the set_logo() method to set an image as your logo.

Parameter

Description

download_path

required string. Folder path to download the logo file.

Returns:

Path to downloaded logo file. If None, then logo is not set and nothing was downloaded.

property help_source

Toggle if the help source is turned on (True) or off (False). It provides the base URL for your organization’s help documentation.

property homepage_settings

Get an instance of the HomePageSettings class to make edits to the organization’s homepage such as the background, title, logo, etc.

property item_settings

Get an instance of the ItemSettings class to make edits to the org’s default map settings such as comments, metadata, etc.

load_offline_configuration(package)

Loads the UX configuration file into the current active portal.

property map_settings

Get an instance of the MapSettings class to make edits to the org’s default map settings such as extent, basemap, etc.

property name

Get/Set the site’s name.

Parameter

Description

name

required string. Name of the site.

Returns:

string of the name of the site

navigation_bar(gallery=None, map=None, scene=None, groups=None, search=None)

Set the visibility of the content in the navigation bar. To get the current navigation bar settings do not pass in any values for the parameters.

Note

The Home link is always visible to everyone. The Content link is always visible to members. Member roles determine Organization link visibility.

Parameter

Description

gallery

Optional string. Values: “all” | “members” | “noOne”

map

Optional string. Values: “all” | “members” | “mapCreators”

scene

Optional string. Values: “all” | “members” | “sceneCreators”

groups

Optional string. Values: “all” | “members”

search

Optional string. Values: “all” | “members”

Returns:

Dictionary of the navigation bar and it’s settings.

property security_settings

Get an instance of the SecuritySettings class to make edits to the organization’s default map settings such as the informational banner, password policy, etc.

Configure your home page by setting the organization’s logo image. For best results the logo file should be 65 x 65 pixels in dimension.

For more information, refer to http://server.arcgis.com/en/portal/latest/administer/windows/configure-general.htm

Parameter

Description

logo_file

Optional string. Specify path to image file. If None, existing thumbnail is removed.

show_logo

Optional bool. Specify whether the logo is visible on the homepage or not.

Returns:

True | False

set_org_language(language, format=None)

Choose the default language for members of your organization. This choice affects the user interface as well as the way time, date, and numerical values appear. Individual members can customize this choice on their settings page.

Parameter

Description

language

Required string. To see all available languages, use the languages property in the GIS class.

format

Optional string. Determine the culture format to be used depending on the language. To see the culture formats available, use the languages property in the GIS class and look at the ‘cultureFormats’ key for each language.

Returns:

True | False

shared_theme(header=None, button=None, body=None, logo=None)

Use the shared theme to apply your organization’s brand colors and logo to information products created from ArcGIS Configurable Apps templates, Web AppBuilder, and Enterprise Sites. To see the current settings, call the method with no parameters passed in.

Parameter

Description

header

Optional dict. Composed of two keys: “background” and “text” that determine the shared theme color for each of these keys. Color can be passed in a hexadecimal string.

ex: header = {“background” : “#0d7bba”, “text” : “#000000”}

button

Optional dict. Composed of two keys: “background” and “text” that determine the shared theme color for each of these keys.

body

Optional dict. Composed of three keys: “background”, “text” and “link” that determine the shared theme color for each of these keys.

logo

Optional str. The file path or link to the image that will be uploaded as the shared theme logo. To remove the logo and not replace it then pass in: “”

Returns:

Dictionary of the shared theme that is set on the org.

property summary

Allows the get/setting of a brief summary to describe your organization on the sign in page associated with its custom apps and sites. This summary has a maximum of 310 characters.

Parameter

Description

text

Required string. The brief description of the organization.

Returns:

string

property utility_services_settings

Get an instance of the UtilityServices class to make edits to the org’s utility services such as print, routing, etc.

HomePageSettings

class arcgis.gis.admin.HomePageSettings(gis)

Bases: object

Helper class called from the UX class property: ‘homepage_settings’. Make edits to background, title, logo, etc.

get_background(download_path=None)

Get your organization’s home page background image. You can use the set_background() method to set an image as the home page background image.

For more information, refer to http://server.arcgis.com/en/portal/latest/administer/windows/configure-home.htm

Parameter

Description

download_path

Required string. Folder path to download the background file. If the background image is a stock image then an instance of the StockImage class will be returned and the download_path will be ignored. If you know the background is a stock image then don’t provide a download path.

Returns:

Path to downloaded background file. If the cover image is a stock image then the stock image’s name from the StockImage class will be returned.

get_base_color()

Gets the base color of the home page.

get_contact_email()

Get the email and whether it is shown from the footer of the homepage.

Get the footer of the homepage

Get your organization’s logo/thumbnail. You can use the set_logo() method to set an image as your logo.

Parameter

Description

download_path

required string. Folder path to download the logo file.

Returns:

Path to downloaded logo file. If None, then logo is not set and nothing was downloaded.

get_title()

Get the title displayed on the homepage if show title is set to True.

Returns:

Dict or None if using old homepage

get_typography()

Get the footer of the homepage

set_background(background_file=None, is_built_in=True, stock_image=None, layout=None, opacity=None)

Configure your home page by setting the organization’s background image. You can choose no image, a built-in image or upload your own. If you upload your own image, the image is positioned at the top and center of the page. The image repeats horizontally if it is smaller than the browser or device window. For best results, if you want a single, nonrepeating background image, the image should be 1,920 pixels wide (or smaller if your users are on smaller screens). The website does not resize the image. You can upload a file up to 1 MB in size.

For more information, refer to http://server.arcgis.com/en/portal/latest/administer/windows/configure-home.htm

Parameter

Description

background_file

Optional string. If using a custom background, specify path to image file. To remove an existing background, specify None for this argument and False for is_built_in argument.

is_built_in

Optional bool, default=True. The built-in background is set by default. If uploading a custom image, this parameter is ignored.

stock_image

Optional instance of StockImage class or string that represents a stock image key.

layout

Optional string. The layout height of the cover image. The values are: “Full-height”, “Two-thirds-height”, or “Half-height”.

opacity

Optional int that represent the opacity of the header. The value is anything from 0 to 1 included.

Returns:

True | False

set_base_color(color)

Set the base color with a string color name.

set_contact_email(email=None, show_email=None)

Set the email shown in the footer of the homepage and whether it is visible.

Set the text and the visibility of the text in the footer

Configure your home page by setting the organization’s logo image. For best results the logo file should be 65 x 65 pixels in dimension.

For more information, refer to http://server.arcgis.com/en/portal/latest/administer/windows/configure-general.htm

Parameter

Description

logo_file

Optional string. Specify path to image file. If None, existing thumbnail is removed.

show_logo

Optional bool. Specify whether the logo is visible on the homepage or not.

alignment

Optional string. Values can either be “center” or “left”. This will set the alignment for the title and logo on the header.

position

Optional string. Set the title and logo position on the homepage. Values: “middle” | “above” | “below” | “top3rd” | “bottom3rd”

Returns:

True | False

set_title(title=None, show_title=None, color=None, alignment=None, position=None)

Set the homepage title and it’s visibility

Parameter

Description

title

Optional string. The title to show on the homepage.

show_title

Optional boolean. Determine if title is shown (True) or hidden (False).

color

Optional string. Specifies the font color for the for the title. This property recognizes common color names (such as red or blue) and hexadecimal color values.

alignment

Optional string. Values can either be “center” or “left”. This will set the alignment for the title and logo on the header.

position

Optional string. Set the title and logo position on the homepage. Values: “middle” | “above” | “below” | “top3rd” | “bottom3rd”

Returns:

True | False

set_typography(font_family, custom=False)

Parameter

Description

font_family

Optional list. The combination of fonts to use for typography of the homepage. The first string represents the title font and the second string represents the body font. If a custom typography will be set, specify custom = True parameter

Values: [“Avenir Next”, “Avenir Next”] [“Avenir Next”, “Noto Serif”] [“Noto Serif”, “Avenir Next”] [“Noto Serif”, “Noto Serif”]

custom

Optional bool. If True, a custom list of typography was passed in as the value for the font_family parameter.

ItemSettings

class arcgis.gis.admin.ItemSettings(gis)

Bases: object

Helper class that can be called off of UX class using the ‘item_settings’ property. Edit org item settings such as the enabling/disabling comments, metadata info, etc.

property enable_comments

Get/Set item commenting and comments.

Parameter

Description

enable

Optional boolean. If True, the comments for the site are turned on. False will disable comments (default)

Returns:

True if enabled, False if disabled

property enable_metadata_edit

Get/Set item metadata editable ability.

Parameter

Description

enable

Optional boolean. If True, the editing of metadata on items is turned on (default). False will disable metadata editing on items.

property metadata_format

Get/Set the metadata format used

Values: ‘arcgis’ | ‘fgdc’ | ‘inspire’ | ‘iso19139’ | ‘iso19139-3.2’ | ‘iso19115’

MapSettings

class arcgis.gis.admin.MapSettings(gis)

Bases: object

Helper class that can be called off of UX class using the ‘map_settings’ property. Edit org map settings such as the default extent, default basemap, etc.

property analysis_layer_group

Select the group whose layers will be shown in the Analysis Layer gallery for the analysis tools. It is best practice to share feature items that contain only a single layer with this group. If your feature layer item contains multiple layers, save any of the layers as an item and share it with the group.

Returns:

If set, an instance of Group else the default or None

Select the group whose web maps will be shown in the basemap gallery. To change the group, assign either an instance of Group or the group id. Setting to None will revert to default.

Returns:

An instance of Group if a group is set, else the default or None

bing_map(bing_key=None, share_public=None)

Provide a Microsoft-supplied Bing Maps key to use Bing Maps in your portal’s web maps.

Bing Map Key: https://www.bingmapsportal.com/

Parameter

Description

bing_key

Optional str. The bing key to pass in. To remove pass in “”.

share_public

Optional bool. If True, allows this Bing Maps key to be used in maps shared publicly by organization members. This requires the access of the portal to be set as public.

Returns:

Dictionary containing the bing key and whether is is publicly shared

property config_apps_group

ArcGIS Configurable Apps contain various settings users can configure to create web apps. Map-based apps display one or more maps. Choose which group contains the apps you want to use in the configurable apps gallery.

Assign either an instance of Group class, a group id, or None to reset to default.

Returns:

An instance of group if a group is set, else the default or None

property default_basemap

Get/Set the site’s default basemap.

The Default Basemap opens when users click New Map. Set the group in the Basemap Gallery above and choose the map to open. It will open at the default extent you set.

Parameter

Description

basemap

Required string. The new default basemap to set. If None, the default value will be set.

Returns:

dictionary

property default_extent

Get/Set the site’s default extent

Parameter

Description

extent

Required dictionary. The default extent defines where a webmap will open. If a value of None is given, the default extent will be provided. Example Extent (default): {“type”:”extent”,”xmin”:-17999999.999994524,”ymin”:-11999999.999991827, “xmax”:17999999.999994524,”ymax”:15999999.999982955, “spatialReference”:{“wkid”:102100}}

Returns:

dictionary

property default_mapviewer

Get/Set whether the org’s default Map Viewer is MapViewerClassic or the modern Map Viewer.

Values: “modern” | “classic”

property units

Get/Set the default map units. Either ‘english’ or ‘metric’.

Update the basemap gallery group by getting rid of deprecated maps and adding any non-deprecated default basemaps. Returns the updated group.

property use_3D_basemaps

Include Esri default 3D basemaps. The 3D basemaps can be used as a reference in a web scene.

This is only applicable to to ArcGIS Online

property use_vector_basemap

If true, the organization uses the Esri vector basemaps in supported ArcGIS apps and basemapGalleryGroupQuery will not be editable and will be set to the default query.

property vector_basemap

Get/Set the default vector basemap

Parameter

Description

basemap

required dictionary. The new default vector basemap to set for a given site.

Returns:

The current default vector basemap

web_styles(group=None, two_dimensional_map=False, three_dimensional_map=False)

Web styles are collections of symbols stored in an item. Apps can use web styles to symbolize point features with 2D or 3D symbols. Select a group to be used in symbol galleries.

Parameter

Description

group

Optional str or Group. either an instance of Group class, a group id, or None to reset to default.

two_dimensional_map

Optional bool. If True, the group will be assigned to 2D Web Style.

three_dimensional_map

Optional bool. If True, the group will be assigned to 3D Web Style.

Returns:

dict indicating the group(s) set for the 2D and 3D styles

SecuritySettings

class arcgis.gis.admin.SecuritySettings(gis)

Bases: object

Helper class that can be called off of UX class using the ‘security_settings’ property. Edit org item settings such as the informational banner, password policy, etc.

property allowed_origins

Get/Set the list of allowed origins.

Allowed Origins limit the web application domains that can connect via Cross-Origin Resource Sharing (CORS) to the ArcGIS REST API.

Can set a list of up to 100 web application domains to restrict CORS access to the REST API.

property allowed_redirect_uris

Configure a list of portals with which you want to share secure content. This will allow members of your organization to use their enterprise logins to access the secure content when viewing it from these portals.

Set a list of allowed redirect URIs which represent portal instances that you share secure content with. This will allow your organization users to be able to use enterprise logins to access the secured content through web applications hosted on these portals.

property anonymous_access

Allow anonymous access to your Portal (True), or make private (False)

delete_email_settings()

This operation deletes all previously configured email settings for your organization. Once deleted, email notifications about password policy changes and license expirations will no longer be received by members listed under your Administrative Contacts. As well, users will no longer be able to use their email to retrieve forgotten passwords.

enable_arcgis_online_login(enable)

Allow users to sign in with their ArcGIS login.

property enable_https

Allow access to the portal through HTTPS only (True).

property enable_update_user_profile

Allow members to edit biographical information and who can see their profile.

get_anonymous_access_notice()

Get the provided notice of terms to be displayed to all users who access your organization. Users can proceed only if they accept the terms of the notice. They will not be prompted again for the remainder of the browser session. If you set both types of access notices, an organization member will see two notices.

Returns:

The dict representation of the notice or if none set then None.

get_email_settings()

This resource returns the email settings that have been configured for your organization. These settings can be used to send out email notifications from ArcGIS Enterprise portal about password policy updates and user type, add-on, or organization capability license expirations.

Returns:

Dictionary of email settings, if None set then empty dict is returned.

get_idp(idp=None)

List organization identity federation information configured using a single identity provider such as Active Directory Federation Services (ADFS) 2.0 and later, Okta, NetIQ Access Manager 3.2 and later, OpenAM 10.1.0 and later, Shibboleth 3.2 and later, etc.

ArcGIS Online Only.

Parameter

Description

idp

The idp to get. If none provided, all available are returned.

Returns:

Json Dictionary response

get_informational_banner()

Get the informational banner dictionary from the org’s settings. If none set, return None

get_multifactor_authentication()

See if multifactor authentication is set and who are the admins that are set as points of contact.

Returns:

dict

get_org_access_notice()

Get the provided notice of terms to be displayed to organization members after they have signed in. Members can proceed only if they accept the terms of the notice. They will not be prompted again till the next time they sign in.

Returns:

The dict representation of the notice or if none set then None.

get_password_policy()

Get the password policy currently set for your org. Returns a dictionary indicating the rules currently set as the policy.

register_idp(name, metadata_file=None, metadata_url=None, binding_url=None, post_binding_url=None, logout_url=None, entity_id=None, signup_mode='Invitation', encryption_supported=False, support_signed_request=False, use_SHA256=False, support_logout_request=False, update_profile_at_signin=False, update_groups_at_signin=False)

Allows organization administrators to configure a new enterprise login. Configuring enterprise login allows members of your organization to sign in to your organization using the same logins they use to access your enterprise information systems without creating additional logins. ArcGIS Online and ArcGIS Enterprise are compliant with SAML 2.0 and integrate with IDPs that support SAML 2 web single sign-on for securely exchanging authentication and authorization data between your organization and ArcGIS Online or ArcGIS Enterprise as a service provider (SP). An organization can be set up using either a single IDP or a federation, but not both.

Parameter

Description

name

Required string. The identity provider name.

metadata_file

Optional string. Metadata file that contains information about the IDP. One can also specify the settings using metadata_url or binding_url and post_binding_url parameters alternatively.

metadata_url

Optional string. Metadata URL that returns information about information about the IDP.

binding_url

Optional string. The HTTP redirect binding IDP’s URL that your organization uses to allow a member to sign in.

post_binding_url

Optional string. The HTTP POST binding IDP’s URL that your organization uses to allow a member to sign in.

logout_url

Optional string. IDP URL used to sign out a signed-in user (automatically set if the property is specified in the IDP metadata file).

entity_id

Optional string. Entity ID used to identify the organization in IDP.

signup_mode

Optional string. Specifies whether enterprise members join the organization automatically or through an invitation.

Values: ‘Automatic’ | ‘Invitation’

encryption_supported

Optional bool. If True, it indicates to the identity provider that encrypted SAML assertion responses are supported. The default is False.

support_signed_request

Optional bool. If True, the organization signs the SAML authentication request sent to the IDP. The default is False.

use_SHA256

Optional bool. If True, the organization signs the request using the SHA-256 hash function. This is used when support_signed_request is True. The default is False.

support_logout_request

Optional bool. If True, signing out of the organization propagates logout of the IDP. The default is False.

update_profile_at_signin

Optional bool. If True, automatically syncs user account information (that is, full name and email address) stored in your organization with the information received from the IDP. The default is False.

update_groups_at_signin

Optional bool. If True, enables SAML-based group membership that allows organization members to link specified SAML-based enterprise groups to your organization’s groups during group creation. The default is False.

Returns:

Dictionary json response indicating success and IDP Id

reset_password_policy()

Reset the password policy to base settings.

set_anonymous_access_notice(title=None, text=None, button_type=None, enabled=False)

Provide a notice of terms to be displayed to all users who access your organization. Users can proceed only if they accept the terms of the notice. They will not be prompted again for the remainder of the browser session. If you set both types of access notices, an organization member will see two notices.

Parameter

Description

title

Optional string. The title to set the for the notice. If None then notice will be disabled.

text

Optional string. The text body to set for the notice. If None then notice will be disabled.

button_type

Optional string. The button types the users will see for the notice. Default is an accept and decline button.

Values: “acceptAndDecline” | “okOnly”

Returns:

True | False

set_approved_apps(block_unapproved=False)

Control which apps members are allowed to access without a ‘Request for Permissions’ prompt. Approved web apps can optionally be made available to organization members in the App Launcher.

Note

Only available in ArcGIS Online

Parameter

Description

block_unapproved

Optional bool. Determine whether members can only sign in to external apps that are approved. Default is False.

set_blocked_apps(block_beta_apps=False, apps=None)

Control which apps are blocked for all members in your organization in order to comply with regulations, standards, and best practices.

Note

Only available in ArcGIS Online

Parameter

Description

block_beta_apps

Optional bool. Block Esri apps while they are in beta. Default is False.

Returns:

Json dictionary response indicating success or failure.

set_email_settings(smtp_host, smtp_port, from_address, from_address_label, encryption_method='SSL', auth_required=False, username=None, password=None)

This operation allows you to configure email settings for your organization. These settings will be used to send out email notifications from ArcGIS Enterprise portal regarding password policy updates and license expirations.

Note

Not for ArcGIS Online.

Parameter

Description

smtp_host

Requried string. The IP address, or the fully qualified domain name (FDQN), of the SMTP Server.

Example: smtpServer=smtp.myorg.org

smtp_port

Required integer. The port the SMTP Server will communicate over. Some of the most common communication ports are 25, 465, and 587.

from_address

Required string. The email address that will be used to send emails from the ArcGIS Enterprise portal. It is recommended that the user associated with this email address is listed under the Administrative Contacts for your organization.

from_address_label

Required string. The label, or person, associated with the from_email_address. This information will be displayed as the sender in the From line for all email notifications.

encryption_method

Optional string. The encryption method for email messages sent from ArcGIS Enterprise portal.

Values: ‘SSL’ | ‘TLS’ | ‘NONE’

auth_required

Optional bool. Specifies if authentication is required (True) to connect with SMTP server specified above. At 10.8.1, only basic authentication (username and password) is supported. The default is False.

username

Optional string. If auth_required is True, this specifies the username of a user who is authorized to access the SMTP server. This field will be unable to be defined if auth_required is False.

password

Optional string. If auth_required is True, this specifies the password associated the authorized user specified above. This field will be unable to be defined if auth_required is False.

Returns:

Dictionary indicating success or failure.

set_informational_banner(text=None, bg_color=None, font_color=None, enabled=None)

The informational banner that is shown at the top of your organization’s page.

Parameter

Description

text

Optional string. The text that the informational banner will display. To set an empty text use: “”

bg_color

Optional string. Specifies the background color for the informational banner. This property recognizes common color names (such as red or blue) and hexadecimal color values. While you are able to choose any color for this property, it is recommended that you choose a color that contrasts appropriately with the font_color, as a poor contrast will cause a warning to appear in the Security settings page of yourEnterprise portal alerting you to the insufficient contrast.

font_color

Optional string. Specifies the font color for the for the informational banner. This property recognizes common color names (such as red or blue) and hexadecimal color values. While you are able to choose any color for this property, it is recommended that you choose a color that contrasts appropriately with the bg_color, as a poor contrast will cause a warning to appear in the Security settings page of your Enterprise portal alerting you to the insufficient contrast.

enabled

Optional bool. Determine whether the informational banner is enabled (True) or disabled (False).

Returns:

True if succeeded

set_multifactor_authentication(admins=None, enabled=False)

Multifactor authentication provides all members with ArcGIS accounts in your organization with an extra level of security by requesting an additional verification code at the time of login.

Parameter

Description

admins

Optional list of strings. Designate at least two administrators who will receive email requests to troubleshoot members’ multifactor authentication issues. Provide a list of at least two admin usernames.

enabled

Optional bool. Allow members to choose whether to set up multifactor authentication for their individual accounts. Default is False.

Returns:

True | False

set_org_access_notice(title=None, text=None, button_type=None)

Provide a notice of terms to be displayed to organization members after they have signed in. Members can proceed only if they accept the terms of the notice. They will not be prompted again till the next time they sign in.

Parameter

Description

title

Optional string. The title to set the for the notice. If None then notice will be disabled.

text

Optional string. The text body to set for the notice. If None then notice will be disabled.

button_type

Optional string. The button types the users will see for the notice. Default is an accept and decline button.

Values: “acceptAndDecline” | “okOnly”

Returns:

True | False

set_social_media_login(social_login, social_networks=None, social_network_order=None)

Customize the organization’s sign in page so that members can sign in using any of the methods below. The order they appear here will determine the order that they appear in the sign in page.

Parameter

Description

social_login

Required bool. Allow members to sign up and sign in to your organization using their login from the following social networks: Facebook, Google, Github, Apple

social_networks

Optional list of strings. The social networks allowed to use as sign in options for the org.

Options: Facebook, Google, Github, Apple

social_network_order

Optional list of strings. The order in which the social network login options will appear on the login page.

If none is set then current settings are used.

property share_public

Members can share content publicly.

property show_social_media

Show social media links on item and group pages.

property signin_settings

Get the signin settings for the org.

Returns:

Dictionary response of the settings and their values

test_email_settings(mail_to)

This operation can be used once the email settings have been configured using the set_email_settings operation to send a test email via the SMTP server to ensure that the organization’s email settings have been properly configured. If successful, an email will be sent out to the specified email address (mail_to).

Parameter

Description

mail_to

Requried string. The email the test message will be sent to.

Returns:

Dictionary result stating success and number of seconds to wait before rechecking.

property trusted_servers

Configure the list of trusted servers you wish your organization to send credentials to when working with services secured with web-tier authentication.

Set a list of trusted servers that clients can send credentials to when making Cross-Origin Resource Sharing (CORS) requests to access web-tier secured services.

unregister_idp(idp)

The unregister IDP operation (POST only) allows organization administrator to remove the enterprise login set up with a single identity provider.

Parameter

Description

idp

The idp id to unregister.

Returns:

Json dictionary response indicating success.

update_password_policy(min_length=None, include_uppercase=None, include_lowercase=None, include_letter=None, include_number=None, include_special_char=None, expires_in=None, history_number=None)

Set the password policy for members in your organization that have ArcGIS accounts. Note that member passwords may not match their username. Weak passwords will be rejected. You may set the following rules for these passwords by turning them on (True) or off (False) and specifying a number where requested.

Parameter

Description

min_length

Optional int. Password must contain at least the following number of characters. Cannot set this under 8 characters.

include_uppercase

Optional bool. Must contain at least one upper case letter (A-Z).

include_lowercase

Optional bool. Must contain at least one lower case letter (a-z).

include_letter

Optional bool. Must contain at least one letter (A-Z, a-z).

include_number

Optional bool. Must contain at least one number (0-9).

include_special_char

Optional bool. Must contain at least one special (non-alphanumeric) character

expires_in

Optional int. Password expires after the specified number of days. Value between 1 and 1095 days. If value of 0 is passed in then it will disable this parameter.

history_number

Optional int. Users cannot reuse the specified number of last passwords. Password history may have a value between 1 and 24 passwords. If value of 0 is passed in then it will disable this parameter.

EmailManager

class arcgis.gis.admin.EmailManager(url, gis=None, **kwargs)

Bases: BasePortalAdmin

delete()

Deletes the current email configuration

Returns:

Boolean. True if successful else False.

test(email)

Sends a test email to a provided email account to ensure the configuration is correct.

Parameter

Description

email

Required String. The test email to send to.

Returns:

Boolean. True if successful else False.

update(server, from_email, require_auth, email_label=None, port=25, encryption='SSL', username=None, password=None)

Configures the Email Server for Portal

Parameter

Description

server

Required String. The email address

from_email

Required String. The email address the email originates from.

require_auth

Required Boolean. If True, the smtp requires authentication and the username and password must be provided. If False, no authentication is needed for the smtp server.

email_label

Optional String. The email label.

port

Optional Integer. The port number for the smtp server.

encryption

Optional String. The encryption method used for the email server. The allowed values are: SSL, TLS, or NONE.

username

Optional String. The username to use to login to the smtp server.

Password

Optional String. The password to use to login to the smtp server.

Returns:

Boolean. True if successful else False.

Federation

class arcgis.gis.admin.Federation(url, gis)

Bases: BasePortalAdmin

This resource returns information about the ArcGIS Servers registered with Portal for ArcGIS.

federate(url, admin_url, username, password)

This operation enables ArcGIS Servers to be federated with Portal for ArcGIS.

Parameter

Description

url:

Required string. The URL of the GIS server used by external users when accessing the ArcGIS Server site. If the site includes the Web Adaptor, the URL includes the Web Adaptor address, for example, https://webadaptor.domain.com/arcgis. If you’ve added ArcGIS Server to your organization’s reverse proxy server, the URL is the reverse proxy server address (for example, https://reverseproxy.domain.com/myorg). Note that the federation operation will perform a validation check to determine if the provided URL is accessible from the server site. If the resulting validation check fails, a warning will be generated in the Portal for ArcGIS logs. However, federation will not fail if the URL is not validated, as the URL may not be accessible from the server site, such as is the case when the server site is behind a firewall.

admin_url

Required string. The URL used for accessing ArcGIS Server when performing administrative operations on the internal network, for example, https://gisserver.domain.com:6443/arcgis.

username

Required string. The username of the primary site administrator account

password

Required string. password of the username above.

Returns:

Dictionary indicating ‘success’ or ‘error’

property servers

This resource returns detailed information about the ArcGIS Servers registered with Portal for ArcGIS, such as the ID of the server, name of the server, ArcGIS Web Adaptor URL, administration URL, and if the server is set as a hosting server.

unfederate(server_id)

This operation unfederates an ArcGIS Server from Portal for ArcGIS.

Parameter

Description

server_id

Required string. The unique ID of the server

Returns:

Boolean. True if successful else False.

update(server_id, role, function=None)

This operation allows you to set an ArcGIS Server federated with Portal for ArcGIS as the hosting server or to enforce fine-grained access control to a federated server. You can also remove hosting server status from an ArcGIS Server. You can also remove hosting server status from an ArcGIS Server. To set a hosting server, an enterprise geodatabase must be registered as a managed database with the ArcGIS Server.

Parameter

Description

server_id

Required string. The unique ID of the server

role

Required string. Whether the server is a hosting server for the portal, a federated server, or a server with restricted access to publishing. The allowed values are: FEDERATED_SERVER, FEDERATED_SERVER_WITH_RESTRICTED_PUBLISHING, or HOSTING_SERVER.

function

Optional string. This is the purpose of the ArcGIS Server. Values are: GeoAnalytics, RasterAnalytics, ImageHosting, NotebookServer, MissionServer, WorkflowManager, or None

Returns:

Dictionary indicating ‘success’ or ‘error’

validate(server_id)

This operation provides status information about a specific ArcGIS Server federated with Portal for ArcGIS.

Parameter

Description

server_id

Required string. The unique ID of the server

Returns:

Dictionary

validate_all()

This operation returns information on the status of ArcGIS Servers registered with Portal for ArcGIS.

Indexer

class arcgis.gis.admin.Indexer(url, gis=None, **kwargs)

Bases: BasePortalAdmin

This resource contains connection information to the default indexing service.

reconfigure()

This operation recreates the index service metadata, schema, and data in the event it becomes corrupted.

Returns:

Boolean

reindex(mode, includes=None)

The operation allows you to generate or update the indexes for content, such as users, groups, and items stored in the database store.

Parameter

Description

mode

Required String. The mode in which the indexer should run. Values: USER_MODE, GROUP_MODE, SEARCH_MODE, or FULL_MODE

includes

Optional String. A comma separated list of elements to include in the index. This is useful if you want to only index certain items or user accounts.

Returns:

Boolean

property status

status allows you to view the status of the indexing service. You can view the number of users, groups, and search items in both the database (store) and the index. If the database and index do not match, indexing is either in progress or there is a problem with the index. It is recommended that you reindex to correct any issues. If indexing is in progress, you can monitor the status by refreshing the page.

Returns:

dict

Logs

class arcgis.gis.admin.Logs(url, gis)

Bases: BasePortalAdmin

Logs are records written by various components of the portal. You can query the logs, clean the logs, and edit log settings.

Parameter

Description

gis

required GIS, portal connection object

url

required string, web address of the log resource

clean()

Deletes all the log files on the machine hosting Portal for ArcGIS. This operation allows you to free up disk space. The logs cannot be recovered after executing this operation.

USAGE: Clean logs from your Portal Admin API

from arcgis.gis import GIS
gis = GIS("https://yourportal.com/portal", "portaladmin", "password")
logs = gis.admin.logs
resp = logs.clean()
print(resp)

# Output
True
Returns:

Boolean True or False depicting success

query(start_time, end_time=None, level='WARNING', query_filter='*', page_size=1000)

The query operation allows you to aggregate, filter, and page through logs written by the portal.

Parameter

Description

start_time

required datetime/float. The most recent time to query.

Local date corresponding to the POSIX timestamp, such as is returned by time.time(). This may raise OverflowError, if the timestamp is out of the range of values supported by the platform. It’s common for this to be restricted to years from 1970 through 2038. Time can be specified as a portal timestamp (format in “%Y-%m-%dT%H:%M:%S”) or in seconds since UNIX epoch. For :Examples: Datetime Object: datetime.datetime.now() Timestamp: “2015-08-01T15:17:20,123” Seconds: 1312237040.123/time.time() Default: datetime.datetime.now()

end_time

optional datetime/float, The oldest time to include in the result set. You can use this to limit the query to the last number of minutes, hours, days, months, and years as needed.

Local date corresponding to the POSIX timestamp, such as is returned by time.time(). This may raise OverflowError, if the timestamp is out of the range of values supported by the platform. It’s common for this to be restricted to years from 1970 through 2038.

Datetime Object: datetime.datetime.now() Timestamp: “2015-08-01T15:17:20,123” Seconds: 1312237040.123/time.time() Default: datetime.datetime.now()

level

optional string, Can be one of [OFF, SEVERE, WARNING, INFO, FINE, VERBOSE, DEBUG]. Returns only records with a log level at or more severe than the level specified. Default: WARNING

query_filter

optional dict, Filtering is allowed by any combination of codes, users, and source components. The filter accepts a comma delimited list of filter definitions. If any definition is omitted, it defaults to all (“*”). :Example:

{“codes”:[204000-205999,212015,219114], “users”:[“admin”,”jcho”], “source”: [“PORTAL ADMIN”]}

The source of logged events are generated from the sharing, administrative, and portal components of the software. For example:

  • Events related to publishing and users are categorized under SHARING.

  • Events related to security and indexing are categorized under PORTAL ADMIN.

  • Events related to installing the software are categorized under PORTAL.

page_size

optional integer, the number of log records to return. The default is 1000

Returns:

dictionary of messages

property settings

Get/Set the current log settings for the portal.

Parameter

Description

value

required dictionary, the dictionary of the log settings

USAGE: Print out the Log Settings

from arcgis.gis import GIS
gis = GIS("https://yourportal.com/portal", "portaladmin", "password")
logs = gis.admin.logs
logsettings = logs.settings
for key, value in dict(logsettings).items():
    print("{} : {}".format(key, value))

# Output
logDir : C:\arcgisportal\logs
logLevel : INFO
maxErrorReportsCount : 10
maxLogFileAge : 90
usageMeteringEnabled : False
Returns:

Dictionary of key/value pairs of log settings

Machines

class arcgis.gis.admin.Machines(url, gis, portaladmin, **kwargs)

Bases: BasePortalAdmin

This resource lists all the portal machines in a site. Each portal machine has a status that indicates whether the machine is ready to accept requests.

get(name)

allows for retrieval of a single instance of Machine by it’s registered name.

list()

provides a list of all registered machines with the local GIS

Security

class arcgis.gis.admin.Security(url, gis=None, **kwargs)

This resource is an umbrella for a collection of system-wide resources for your portal. This resource provides access to the ArcGIS Web Adaptor configuration, portal directories, database management server, indexing capabilities, license information, and the properties of your portal.

property config

This operation can be used to update the portal’s security settings such as whether or not enterprise accounts are automatically registered as members of your ArcGIS organization the first time they accesses the portal. The security configuration is stored as a collection of properties in a JSON object. The following properties are supported:

  • enableAutomaticAccountCreation

  • disableServicesDirectory

  • defaultRoleForUser (introduced at ArcGIS 10.4)

The automatic account creation flag (enableAutomaticAccountCreation) determines the behavior for unregistered enterprise accounts the first time they access the portal. When the value for this property is set to false, first time users are not automatically registered as members of your ArcGIS organization, and have the same access privileges as other nonmembers. For these accounts to sign in, an administrator must register the enterprise accounts using the Create User operation. The default value for the enableAutomaticAccountCreation property is false. When this value is set to true, portal will add enterprise accounts automatically as members of your ArcGIS organization. The disableServicesDirectory property controls whether the HTML pages of the services directory should be accessible to the users. The default value for this property is false, meaning the services directory HTML pages are accessible to everyone. Use the defaultRoleForUser property to set which role the portal automatically assigns to new member accounts. By default, new accounts are assigned to account_user. Other possible values are account_publisher or the ID of one of the custom roles defined in the ArcGIS organization. To obtain the ID of a custom role,

  • Log in to the portal sharing directory.

  • Go to Portals > Self > Roles.

  • Copy the custom role ID you want to use.

The allowedProxyHosts property restricts what hosts the portal can access directly. This restriction applies to several scenarios, including when the portal accesses resources from a server that does not support Cross Origin Resource Sharing (CORS) or when saving credentials used to access a secure service. By default, this property is not defined and no restrictions are applied. Define the allowedProxyHosts with a comma-separated list of hostnames to restrict the hosts the portal can access directly. Use the format (.*).domain.com to allow access to all machines within a specified domain.

Example Value
{

“disableServicesDirectory”:false, “enableAutomaticAccountCreation”:true, “defaultRoleForUser”: 12aBC3D4EF5ghIJ

}

property enterpriseusers

provides access into managing enterprise users

Returns:

EnterpriseUsers object

property groups

provides access to managing Enterprise Groups with Portal

Returns:

EnterpriseGroups object

property oauth

The OAuth resource contains a set of operations that update the OAuth2-specific properties of registered applications in Portal for ArcGIS.

Returns:

OAuth object

property test_identity_store

This operation can be used to test the connection to a user or group store.

Parameter

Description

user_config

Optional dict. The user store configuration

group_config

Optional dict. The group store configuration

Returns:

Dictionary indicating ‘success’ or ‘error’

property tokens

This resource represents the token configuration within your portal. Use the set on token_config operation to change the configuration properties of the token service.

Parameter

Description

value

Required string. A shared key value

Returns:

Dictionary

update_identity_store(user_config=None, group_config=None)

You can use this operation to change the identity provider and group store configuration in your portal. When Portal for ArcGIS is first installed, it supports token-based authentication and built-in groups using the built-in identity store for accounts. To configure your portal to connect to your enterprise authentication mechanism and group store, it must be configured to use an enterprise identity store such as Windows Active Directory or LDAP.

See: https://developers.arcgis.com/rest/enterprise-administration/portal/update-identity-store.htm

Parameter

Description

user_config

Optional dict. The user store configuration

group_config

Optional dict. The group store configuration

Returns:

Dictionary indicating ‘success’ or ‘error’

OAuth

class arcgis.gis.admin.OAuth(url, gis=None, **kwargs)

The OAuth resource contains a set of operations that update the OAuth2-specific properties of registered applications in Portal for ArcGIS.

property app_info

Every application registered with Portal for ArcGIS has a unique client ID and a list of redirect URIs that are used for OAuth. This operation returns these OAuth-specific properties of an application. You can use this information to update the redirect URIs by using the Update App Info operation.

update(current_id, new_id)

When new applications are registered with Portal for ArcGIS, a new client ID is generated for the application. This allows the application to access content from the portal. The new client ID does not work if the application developer has programmed against a specific ID. This operation can, therefore, be used to change the client ID to another value as specified by the application developer.

Parameter

Description

current_id

Required string. The current client ID of an existing application.

new_id

Required string. The new client ID to assign to the application.

Returns:

Boolean. True if successful else False

SSLCertificate

class arcgis.gis.admin.SSLCertificate(url, gis=None, **kwargs)

represents a single registered certificate

delete()

This operation deletes an SSL certificate from the key store. Once a certificate is deleted, it cannot be retrieved or used to enable SSL.

export(out_path=None)

This operation downloads an SSL certificate. The file returned by the server is an X.509 certificate. The downloaded certificate can be imported into a client that is making HTTP requests.

Parameter

Description

out_path

Required string. Save location of the certificate

Returns:

string

generate_csr()

This operation generates a certificate signing request (CSR) for a self-signed certificate. A CSR is required by a CA to create a digitally signed version of your certificate.

Returns:

string

import_signed_certificate(file_path)

imports a certificate authority (CA) signed SSL certificate into the key store.

Parameter

Description

file_path

Required string. The location of the certificate

Returns:

Dictionary indicating ‘success’ or ‘error’

SSLCertificates

class arcgis.gis.admin.SSLCertificates(url, gis=None, **kwargs)

Manages the Portal’s SSL Certificates

generate(alias, common_name, organization, key_algorithm='RSA', validity=90, key_size=2048, signature_algorithm='SHA256withRSA', unit='', city='', state='', country_code='', alt_name='')

Use this operation to create a self-signed certificate or as a starting point for getting a production-ready CA-signed certificate. The portal will generate a certificate for you and store it in its keystore.

Parameter

Description

alias

Required string. The name of the certificate. This is a required parameter.

common_name

Required string. The common name used to identify the server for which the certificate is to be generated. This is a required parameter.

organization

Required string. The name of the organization. This is a required parameter.

key_algorithm

Optional string. The algorithm used to generate the key pairs. The default is RSA.

validity

Optional integer. The expiration time for the certificate in days. The default is 90.

key_size

Optional integer. The size of the key. The default is 2048.

signature_algorithm

Optional string. The algorithm used to sign the self-signed certificates. The default is derived from the key_algorithm parameter.

unit

Optional string. The department within which this server resides.

city

Optional string. The name of the city

state

Optional string. The name of the state

country_code

Optional string. The two letter abbrevation of the country

alt_name

Optional string. The common name used to identify the server for which the certificate is to be generated. This is a required parameter.

Returns:

boolean

get(alias_name)

gets a single SSLCertificate object by the alias name

Parameter

Description

alias_name

Required string. The common name of the certificate.

Returns:

class:

~arcgis.gis.admin.SSLCertificate object

USAGE: Print out information about a specific SSL Certificate by alias name

from arcgis.gis import GIS
gis = GIS("https://yourportal.com/portal", "portaladmin", "password")
# Get the SSL Certificate class
sslmgr = gis.admin.security.ssl
# Get a specific certificate alias and print information
ssl = sslmgr.get('portal')
for prop in ssl.properties:
    print(prop, ssl.properties[prop])]))

# Output
aliasName portal
issuer CN=YOURPORTAL.COM, OU=Self Signed Certificate
subject CN=YOURPORTAL.COM, OU=Self Signed Certificate
subjectAlternativeNames []
validFrom Fri Sep 15 07:46:45 EDT 2017
validUntil Sun Jul 24 07:46:45 EDT 2050
keyAlgorithm RSA
keySize 2048
serialNumber 503b23c6
version 3
signatureAlgorithm SHA256withRSA
keyUsage []
md5Fingerprint 76d695d72e46b30ea90013676d559faa
sha1Fingerprint 6f36513757c28ad43c2df5e4c7cee581ad18dd1e
sha256Fingerprint a051aab19d1ed8ceee7322572b3b1b2abd1ed680d0a1d81d0da84cf0e1a1b6cb
import_certificate(certificate, alias, norestart=False)

This operation imports a certificate authority’s (CA) root and intermediate certificates into the keystore. To create a production quality CA-signed certificate, you need to add the CA certificates into the keystore that enables the SSL mechanism to trust the CA (and the certificates it has signed). While most of the popular CA certificates are already available in the keystore, you can use this operation if you have a custom CA or specific intermediate certificates.

Parameter

Description

certificate

Required string. The file location of the certificate file

alias

Required string. The name of the certificate

norestart

Optional boolean. Determines if the portal should be prevented from restarting after importing the certificate. By default this is false and the portal will restart. Added in 10.6.

Returns:

boolean

USAGE: Import a trusted CA or Intermediate SSL Certificate into Portal Admin API

from arcgis.gis import GIS
gis = GIS("https://yourportal.com/portal", "portaladmin", "password")
# Get the SSL Certificate class
sslmgr = gis.admin.security.ssl
# Load a trust CA certificate and restart Portal
resp = sslmgr.import_certificate(r'c:\temp\myTrustedCA.crt', 'myroot', norestart=False)
print(resp)

# Output
True
import_server_certificate(alias, password, certificate)

This operation imports an existing server certificate, stored in the PKCS #12 format, into the keystore. If the certificate is a CA signed certificate, you must first import the CA Root or Intermediate certificate using the Import Root or Intermediate Certificate operation.

Parameter

Description

alias

Required string. The name of the certificate

password

Required string. The password for the certificate

certificate

Required string. The file location of the certificate file

Returns:

Dictionary indicating ‘success’ or ‘error’

list(force=False)

List of SSL Certificates as represented in the Portal Admin API

Parameter

Description

force

Optional Boolean. If True, the certificate list will be refreshed, else, if a set of values is in memory, it will use those values. This is used when you want to ensure you have the most up to date list of certificates.

Returns:

List of :class: arcgis.gis.admin.SSLCertificate objects

USAGE: Print out information about each SSL Certificate

from arcgis.gis import GIS
gis = GIS("https://yourportal.com/portal", "portaladmin", "password")
# Get the SSL Certificate class
sslmgr = gis.admin.security.ssl
# Get a list of SSL Certificates
sslcerts = sslmgr.list()
# For each certificate, print its alias and issuer
for sslcert in sslcerts:
    print("{} : {}".format(dict(sslcert)['aliasName'], dict(sslcert)['issuer']))

# Output
portal : CN=YOURPORTAL.COM, OU=Self Signed Certificate
yourorgroot : CN=YourOrg Enterprise Root, DC=empty, DC=local
samlcert : CN=YOURPORTAL.COM, OU=Self Signed Certificate
ca_signed : CN=YourOrg Enterprise Root, DC=empty, DC=local
update(alias, protocols, cipher_suites, HSTS=False)

Use this operation to configure the web server certificate, SSL protocols, and cipher suites used by the portal.

Parameter

Description

alias

Required string. The name of the certificate. This is a required parameter. The certificate must be already present in the portal.

protocols

Required string. The SSL protocols the portal will use. Valid options are TLSv1, TLSv1.1, and TLSv1.2; values must be comma separated. By default, these options are all enabled.

cipher_suites

Required string. The cipher suites the portal will use. Valid options are:

  • TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256

  • TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

  • TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA

  • TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA

  • TLS_RSA_WITH_AES_128_GCM_SHA256

  • TLS_RSA_WITH_AES_128_CBC_SHA256

  • TLS_RSA_WITH_AES_128_CBC_SHA

  • TLS_RSA_WITH_3DES_EDE_CBC_SHA

By default, all of the above options are enabled. Values must be comma separated.

HSTS

Optional Boolean. A Boolean value that indicates whether HTTP Strict Transport Security (HSTS) is being used by the portal.

Returns:

Dictionary indicating ‘success’ or ‘error’

EnterpriseUsers

class arcgis.gis.admin.EnterpriseUsers(url, gis=None, **kwargs)

The users resource is an umbrella for operations to manage members within Portal for ArcGIS. The resource returns the total number of members in the system.

create(username, password, first_name, last_name, email, role='org_user', level=2, provider='arcgis', idp_username=None, description=None, user_license=None)

This operation is used to pre-create built-in or enterprise accounts within the portal. The provider parameter is used to indicate the type of user account.

Parameter

Description

username

Required string. The name of the user account

password

Required string. The password of the user account

first_name

Required string. The first name for the account

last_name

Required string. The last name for the account

email

Required string. The email for the account

role

Optional string. The role for the user account. The default value is org_user. Values org_admin | org_publisher | org_user | org_editor (Data Editor) | viewer

level

Optional integer. The account level to assign the user. Values 1 or 2

provider

Optional string. The provider for the account. The default value is arcgis. Values arcgis | 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.

description

Optional string. A user description

user_license

Optional string. The user type for the account. (10.7+)

Values before Enterprise 11.4: creator, editor, advanced (GIS Advanced),

basic (GIS Basic), standard (GIS Standard), viewer, fieldworker

Values for Enterprise 11.4+: creator, contributor, fieldworker, viewer,

professionalplus, professional

Returns:

boolean

get(username)

This operation returns the description, full name, and email address for a single user in the enterprise identity (user) store configured with the portal. The username parameter is used to specify the enterprise username. If the user does not exist, an error is returned.

Parameter

Description

username

Required string. Username of the enterprise account. For Windows Active Directory users, this can be either domainusername or just username. For LDAP users, the format is always username.

Returns:

Dictionary indicating ‘success’ or ‘error’

refresh_users(users)

This operation iterates over every enterprise group configured in the portal and determines if the input user accounts belong to any of the configured enterprise groups. If there is any change in membership, the database and the indexes are updated for each user account. While portal automatically refreshes the memberships during a user login and during a periodic refresh (configured through the Update Identity Store operation), this operation allows an administrator to force a refresh.

Parameter

Description

users

Required string. A comma seperated list of users.

Returns:

Dictionary indicating ‘success’ or ‘error’

search(query='', max_count=255)

This operation searches users in the configured enterprise user store. You can narrow down the search using the filter parameter.

Parameter

Description

query

Optional string. Where clause into parse down results

max_count

Optional integer. The maximum number of records to return

Returns:

Dictionary of the search

update(username, idp_username)

This operation allows an administrator to update the idp_username for an enterprise user in the portal. This is used when migrating from accounts used with web-tier authentication to SAML authentication.

Parameter

Description

username

Required string. Username of the enterprise account. For Windows Active Directory users, this can be either domainusername or just username. For LDAP users, the format is always username.

idp_username

Required string. The username used by the SAML identity provider

Returns:

Dictionary indicating ‘success’ or ‘error’

EnterpriseGroups

class arcgis.gis.admin.EnterpriseGroups(url, gis=None, **kwargs)

The groups resource is an umbrella for operations to manage enterprise groups within the portal. The resource returns the total number of groups in the system.

get_group_users(name, query='', max_count=255)

This operation returns the users that are currently assigned to the enterprise group within the enterprise user/group store. You can use the filter parameter to narrow down the user search.

Parameter

Description

name

Optional string. The name of the enterprise group

query

Optional string. Where clause into parse down results

max_count

Optional integer. The maximum number of records to return

Returns:

Dictionary of group users

get_user_groups(username, query='', max_count=255)

This operation lists the groups assigned to a user account in the configured enterprise group store.

Parameter

Description

username

Optional string. The name of the user account

query

Optional string. Where clause into parse down results

max_count

Optional integer. The maximum number of records to return

Returns:

Dictionary of user groups

refresh_groups(groups)

This operation iterates over every enterprise account configured in the portal and determines if the user account is a part of the input enterprise group. If there are any change in memberships, the database and the indexes are updated for each group. While portal automatically refreshes the memberships during a user login and during a periodic refresh configured through the Update Identity Store operation, this operation allows an administrator to force a refresh.

Parameter

Description

groups

Required string. The comma seperated list of group names to be refreshed

Returns:

Dictionary indicating ‘success’ or ‘error’

search(query='', max_count=255)

This operation searches groups in the configured enterprise group store. You can narrow down the search using the filter parameter.

Parameter

Description

query

Optional string. Where clause into parse down results

max_count

Optional integer. The maximum number of records to return

Returns:

Dictionary indicating ‘success’ or ‘error’

Site

class arcgis.gis.admin.Site(url, portaladmin, **kwargs)

Bases: BasePortalAdmin

Site is the root resources used after a local GIS is installed. Here administrators can create, export, import, and join sites.

static create(con, url, username, password, full_name, email, content_store, description='', question_idx=None, question_ans=None, license_file=None, user_license=None)

The create site operation initializes and configures Portal for ArcGIS for use. It must be the first operation invoked after installation. Creating a new site involves:

  • Creating the initial administrator account

  • Creating a new database administrator account (which is same as the initial administrator account)

  • Creating token shared keys

  • Registering directories

This operation is time consuming, as the database is initialized and populated with default templates and content. If the database directory is not empty, this operation attempts to migrate the database to the current version while keeping its data intact. At the end of this operation, the web server that hosts the API is restarted.

Parameter

Description

con

Required Connection. The connection object.

url

Required string. The portal administration url Ex: https://mysite.com/<web adaptor>/portaladmin

username

Required string. The initial admin account name

password

Required string. The password for initial admin account

full_name

Required string. The full name of the admin account

email

Required string. The account email address

content_store

Required string. JSON string including the path to the location of the site’s content.

description

Optional string. The optional description for the account

question_idx

Optional integer. The index of the secret question to retrieve a forgotten password

question_ans

Optional string. The answer to the secret question

license_file

Optional string. The portal license file. Starting at 10.7, you will obtain your portal license file - which contains information regarding your user types, apps, and app bundles-from My Esri. For more information, see Obtain a portal license file.

user_license

The user type for the initial administrator account. The values listed below are the user types that are compatible with the Administrator role.

Values: creatorUT, GISProfessionalBasicUT,

GISProfessionalStdUT, GISProfessionalAdvUT

Returns:

Dictionary indicating ‘success’ or ‘error’

export_site(location)

This operation exports the portal site configuration to a location you specify. The exported file includes the following information:

Content directory - the content directory contains the data

associated with every item in the portal

Database dump file - a plain-text file that contains the SQL

commands required to reconstruct the portal database

Configuration store connection file - a JSON file that contains

the database connection information

Parameter

Description

location

Required string. The path to the folder accessible to the portal where the exported site configuration will be written.

Returns:

Dictionary indicating ‘success’ or ‘error’

USAGE: Export Portal Site to a location the Portal server has access to.  ** This can be a
       lengthy operation.

from arcgis.gis import GIS
gis = GIS("https://yourportal.com/portal", "portaladmin", "password")
sitemgr = gis.admin.site
response = sitemgr.export_site(r'c:\temp')
print(response)

# Output
{'status': 'success', 'location': 'C:\Temp\June-9-2018-5-22-29-PM-EDT-FULL.portalsite'}
import_site(location)

The importSite operation lets you restore your site from a backup site configuration file that you created using the exportSite operation. It imports the site configuration file into the currently running portal site. The importSite operation will replace all site configurations with information included in the backup site configuration file. See the export_site operation documentation for details on what the backup file includes. The importSite operation also updates the portal content index.

Parameter

Description

location

Required string. A file path to an exported configuration.

Returns:

Boolean. True if successful else False.

join(admin_url, username, password)

The joinSite operation connects a portal machine to an existing site. You must provide an account with administrative privileges to the site for the operation to be successful. When an attempt is made to join a site, the site validates the administrative credentials, then returns connection information about its configuration store back to the portal machine. The portal machine then uses the connection information to work with the configuration store. If this is the first portal machine in your site, use the Create Site operation instead. The join operation:

  • Registers a machine to an existing site (active machine)

  • Creates a snapshot of the database of the active machine

  • Updates the token shared key

  • Updates Web Adaptor configurations

Sets up replication to keep the database of both machines in sync The operation is time-consuming as the database is configured on the machine and all configurations are applied from the active machine. After the operation is complete, the web server that hosts the API will be restarted.

Parameter

Description

admin_url

Required string. The admin URL of the existing portal site to which a machine will be joined

username

Required string. The username for the initial administrator account of the existing portal site.

password

Required string. The password for the initial administrator account of the existing portal site.

Returns:

Dictionary indicating ‘success’ or ‘error’

System

class arcgis.gis.admin.System(url, gis=None, **kwargs)

This resource is an umbrella for a collection of system-wide resources for your portal. This resource provides access to the ArcGIS Web Adaptor configuration, portal directories, database management server, indexing capabilities, license information, and the properties of your portal.

property content_discovery

This resource allows an administrator to enable or disable external content discovery from the portal website. Because some Esri-provided content requires external access to the internet, an administrator may choose to disable the content to prevent requests to ArcGIS Online resources. When disabling the content, a select group of items will be disabled:

  • All basemaps owned by “esri_[lang]”

  • All content owned by “esri_nav”

  • All content owned by “esri”

This resource will not disable ArcGIS Online utility services or Living Atlas content. For steps to disable these items, refer to the Portal Administrator guide.

When external content is disabled, System Languages are also disabled.

Parameter

Description

value

required Boolean. If true, external content is enabled, else it is disabled.

Returns:

boolean

property database

The database resource represents the database management system (DBMS) that contains all of the portal’s configuration and relationship rules. This resource also returns the name and version of the database server currently running in the portal. You can use the properety to update database accounts

property directories

The directories resource is a collection of directories that are used by the portal to store and manage content. Beginning at 10.2.1, Portal for ArcGIS supports five types of directories:

  • Content directory-The content directory contains the data associated with every item in the portal.

  • Database directory-The built-in security store and sharing rules are stored in a Database server that places files in the database directory.

  • Temporary directory - The temporary directory is used as a scratch workspace for all the portal’s runtime components.

  • Index directory-The index directory contains all the indexes associated with the content in the portal. The indexes are used for quick retrieval of information and for querying purposes.

  • Logs directory-Errors and warnings are written to text files in the log file directory. Each day, if new errors or warnings are encountered, a new log file is created.

If you would like to change the path for a directory, you can use the Edit Directory operation.

property email

Provides access to the email configuration setting on enterprise.

Returns:

EmailManager

property incremental_backup

Gets/Sets the Incremental Backup for the Enterprise Configuration

Returns:

dict

property index_status

The status resource allows you to view the status of the indexing service. You can view the number of users, groups, and search items in both the database (store) and the index. If the database and index do not match, indexing is either in progress or there is a problem with the index. It is recommended that you reindex to correct any issues. If indexing is in progress, you can monitor the status by refreshing the page.

Returns:

dict

USAGE: Prints out current Index Status

from arcgis.gis import GIS
gis = GIS("https://yourportal.com/portal", "portaladmin", "password")
sysmgr = gis.admin.system
idx_status = sysmgr.index_status
import json
print(json.dumps(idx_status, indent=2))

# Output
{
  "indexes": [
    {
      "name": "users",
      "databaseCount": 51,
      "indexCount": 51
    },
    {
      "name": "groups",
      "databaseCount": 325,
      "indexCount": 325
    },
    {
      "name": "search",
      "databaseCount": 8761,
      "indexCount": 8761
    }
  ]
}
property indexer

Allows user to manage the site’s indexer

Returns:

Indexer

property languages

This resource gets/sets which languages will appear in portal content search results. Use the Update languages operation to modify which language’content will be available.

property licenses

Portal for ArcGIS requires a valid license to function correctly. This resource returns the current status of the license. Starting at 10.2.1, Portal for ArcGIS enforces the license by checking the number of registered members and comparing it with the maximum number of members authorized by the license. Contact Esri Customer Service if you have questions about license levels or expiration properties.

property limits

The limits resource provides limits associated with the organization, such as user and organizational limits or scheduled tasks. See ArcGIS Enterprise Portal limits for detailed description of each limit.

Returns:

dict[str,Any] A Python dictionary with a ScheduledTask key whose value is a list of dictionaries with specific limit names and their values.

# Usage example:
>>> from arcgis.gis import GIS
>>> gis = GIS(profile="your_enterprise_admin_profile")

>>> ent_system = gis.admin.system
>>> ent_system.limits

{'ScheduleTask': [{'limitName': 'UpdateInsightsUserLimit', 'numLimit': 20},
                  {'limitName': 'UpdateInsightsOrgLimit', 'numLimit': 50},
                  .
                  .
                  .
                  {'limitName': 'TaskRunHistoryCount', 'numLimit': 30}]}
property properties

Gets/Sets the system properties that have been modified to control the portal’s environment.

The list of available properties are:
  • privatePortalURL-Informs the portal that it has a front end load-balancer/proxy reachable at the URL. This property is typically used to set up a highly available portal configuration

  • portalLocalhostName-Informs the portal back-end to advertise the value of this property as the local portal machine. This is typically used during federation and when the portal machine has one or more public host names.

  • httpProxyHost-Specifies the HTTP hostname of the proxy server

  • httpProxyPort-Specifies the HTTP port number of the proxy server

  • httpProxyUser-Specifies the HTTP proxy server username.

  • httpProxyPassword-Specifies the HTTP proxy server password.

  • isHttpProxyPasswordEncrypted-Set this property to false when you are configuring the HTTP proxy server password in plain text. After configuration, the password will be encrypted and this property will be set to true

  • httpsProxyHost-Specifies the HTTPS hostname of the proxy server

  • httpsProxyPort-Specifies the HTTPS port number of the proxy server

  • httpsProxyUser-Specifies the HTTPS proxy server username

  • httpsProxyPassword-Specifies the HTTPS proxy server password

  • isHttpsProxyPasswordEncrypted-Set this property to false when you are configuring the HTTPS proxy server password in plain text. After configuration, the password will be encrypted and this property will be set to true.

  • nonProxyHosts-If you want to federate ArcGIS Server and the site does not require use of the forward proxy, list the server machine or site in the nonProxyHosts property. Machine and domain items are separated using a pipe (|).

  • WebContextURL-If you are using a reverse proxy, set this property to reverse proxy URL.

  • ldapCertificateValidation Introduced at 10.7. When set to true, any encrypted LDAP communication (LDAPS) made from the portal to the user or group identity store will enforce certificate validation. The default value is false.

reindex(mode='FULL', includes=None)

This operation allows you to generate or update the indexes for content; such as users, groups, and items stored in the database (store). During the process of upgrading an earlier version of Portal for ArcGIS, you are required to update the indexes by running this operation. You can check the status of your indexes using the status resource.

Parameter

Description

mode

Optional string. The mode in which the indexer should run. Values USER_MODE | GROUP_MODE | SEARCH_MODE | FULL

includes

Optional string. An optional comma separated list of elements to include in the index. This is useful if you want to only index certain items or user accounts.

Returns:

Boolean. True if successful else False.

set_limits(properties, *, category='ScheduleTask')

The set_limit() method updates one or more organizational limits in a specific category. Only limits that are included in this request will be updated.

Parameter

Description

properties

A Python list of one or more dictionaries with limitName and numLimit keys whose values are the specific limit category and the specific value to update.See Portal limits for comprehensive list of limit options to set.

category

Optional String. Category limits to be updated.

Note

As of the Enterprise 11.2 release, ScheduleTask is the only category implemented.

Returns:

Python dictionary with a status key indicating success or failure of the operation.

# Usage Example
>>> gis = GIS(profile="your_enterprise_admin_profile")

>>> ent_system = gis.admin.system
>>> ent_system.set_limits(properties=[{"limitName": "TaskRunHistoryCount",
                                       "numLimit": 45}],
                          category="ScheduleTask")

{'status': 'success'}
property web_adaptors

The Web Adaptors resource lists the ArcGIS Web Adaptor configured with your portal. You can configure the Web Adaptor by using its configuration web page or the command line utility provided with the installation.

Returns:

WebAdaptors object

Licenses (Deprecated 10.7+)

class arcgis.gis.admin.Licenses(url, gis=None, **kwargs)

Portal for ArcGIS requires a valid license to function correctly. This resource returns the current status of the license. As of 10.2.1, Portal for ArcGIS enforces the license by checking the number of registered members and comparing it with the maximum number of members authorized by the license. Contact Esri Customer Service if you have questions about license levels or expiration properties. Starting at 10.5, Portal for ArcGIS enforces two levels of membership for licensing to define sets of privileges for registered members and their assigned roles.

Deprecated at ArcGIS Enterprise 10.7

entitlements(app='arcgisprodesktop')

This operation returns the currently queued entitlements for a product, such as ArcGIS Pro or Navigator for ArcGIS, and applies them when their start dates become effective. It’s possible that all entitlements imported using the Import Entitlements operation are effective immediately and no entitlements are added to the queue. In this case, the operation returns an empty result.

Parameter

Description

app

Required string. The application lookup. Allowed values: appstudioweb,arcgisprodesktop,busanalystonline_2, drone2map,geoplanner,arcgisInsights,LRReporter, navigator, or RoadwayReporter

Returns:

dict

import_entitlements(file, application)

This operation allows you to import entitlements for ArcGIS Pro and additional products such as Navigator for ArcGIS into your licensing portal. Once the entitlements have been imported, you can assign licenses to users within your portal. The operation requires an entitlements file that has been exported out of your ArcGIS License Server Administrator or out of My Esri, depending on the product. A typical entitlements file will have multiple parts, each representing a set of entitlements that are effective at a specific date. The parts that are effective immediately will be configured to be the current entitlements. Other parts will be added to a queue. The portal framework will automatically apply the parts when they become effective. You can use the Get Entitlements operation to see the parts that are in the queue. Each time this operation is invoked, it overwrites all existing entitlements, even the ones that are in the queue.

Parameter

Description

file

Required string. The entitlement file to load into Enterprise.

application

Required string. The application identifier to be imported

Returns:

Dictionary indicating ‘success’ or ‘error’

release_license(username)

If a user checks out an ArcGIS Pro license for offline or disconnected use, this operation releases the license for the specified account. A license can only be used with a single device running ArcGIS Pro. To check in the license, a valid access token and refresh token is required. If the refresh token for the device is lost, damaged, corrupted, or formatted, the user will not be able to check in the license. This prevents the user from logging in to ArcGIS Pro from any other device. As an administrator, you can release the license. This frees the outstanding license and allows the user to check out a new license or use ArcGIS Pro in a connected environment.

remove_all(application)

This operation removes all entitlements from the portal for ArcGIS Pro or additional products such as Navigator for ArcGIS and revokes all entitlements assigned to users for the specified product. The portal is no longer a licensing portal for that product. License assignments are retained on disk. Therefore, if you decide to configure this portal as a licensing portal for the product again in the future, all licensing assignments will be available in the website.

remove_entitlement(app='arcgisprodesktop')

deletes an entitlement from a site

Parameter

Description

app

Required string. The application lookup. Allowed values: appstudioweb,arcgisprodesktop,busanalystonline_2, drone2map,geoplanner,arcgisInsights,LRReporter, navigator, or RoadwayReporter

Returns:

dict

update_license_manager(info)

ArcGIS License Server Administrator works with your portal and enforces licenses for ArcGIS Pro. This operation allows you to change the license server connection information for your portal. When you import entitlements into portal using the Import Entitlements operation, a license server is automatically configured for you. If your license server changes after the entitlements have been imported, you only need to change the license server connection information. You can register a backup license manager for high availability of your licensing portal. When configuring a backup license manager, you need to make sure that the backup license manager has been authorized with the same organizational entitlements. After configuring the backup license manager, Portal for ArcGIS is restarted automatically. When the restart completes, the portal is configured with the backup license server you specified.

Parameter

Description

info

Required string. The JSON representation of the license server connection information.

Returns:

Dictionary indicating ‘success’ or ‘error’

PortalLicense

class arcgis.gis.admin.PortalLicense(url, gis=None, **kwargs)

The Enterprise portal requires a valid license to function correctly. This resource returns information for user types that are licensed for your organization.

Starting at 10.7, the Enterprise portal enforces user type licensing. Members are assigned a user type which determines the privileges that an be granted to the member through a role. Each user type may include access to specific apps and app bundles.

The license information returned for the organization includes the total number of registered members that can be added, the current number of members in the organization and the Portal for ArcGIS version. For each user type, the license information includes the ID, the maximum number of registered members that can be assigned, the number of members currently assigned the license and the expiration, in epoch time. In addition, this resource provides access to the Validate License, Import License, Populate License, Update License Manager, and Release License operations.

import_license(file)

The import_license operation is used to import a new license file. The portal license file contains your Enterprise portal’s user type, app and app bundle licenses. By importing a portal license file, you will be applying the licenses in the file to your organization.

Caution:

Importing a new portal license file will overwrite your organization’s current user type, app, and app bundle licenses. Before importing, verify that the new license file has sufficient user type, app, and app bundle licenses.

Parameter

Description

file

Required String. The portal license file.

Returns:

Boolean. True if successful else False.

populate()

The populate operation applies the license information from the license file that is used to create or upgrade your portal. This operation is only necessary as you create or upgrade your portal through the Portal Admin API.

Returns:

Boolean. True if successful else False.

release_license(username)

If a user checks out an ArcGIS Pro license for offline or disconnected use, this operation releases the license for the specified account. A license can only be used with a single device running ArcGIS Pro. To check in the license, a valid access token and refresh token is required. If the refresh token for the device is lost, damaged, corrupted, or formatted, the user will not be able to check in the license. This prevents the user from logging in to ArcGIS Pro from any other device. As an administrator, you can release the license. This frees the outstanding license and allows the user to check out a new license or use ArcGIS Pro in a connected environment.

Parameter

Description

username

Required String. The user name of the account.

Returns:

Boolean. True if successful else False.

update(info)

ArcGIS License Server Administrator works with your portal and enforces licenses for ArcGIS Pro. This operation allows you to change the license server connection information for your portal.

You can register a backup license manager for high availability of your licensing portal. After configuring the backup license manager, Portal for ArcGIS is restarted automatically. When the restart completes, the portal is configured with the backup license server you specified. When configuring a backup license manager, you will need to ensure that the backup is authorized using the same license file as your portal.

Note:

Previously, premium apps were licensed individually through the portal. Starting at 10.7, there will no longer be separate licensing for apps; the portal’s user types, apps, and app bundles will be licensed using a single portal license file. Licensing ArcGIS Pro and Drone2Map requires licensing your Enterprise portal’s ArcGIS License Server Administrator (license manager). Previously, users were required to import a .lic file into the portal’s license manager. They would then generate a .json file through the license manager and import the file into portal. Now, users licensing ArcGIS Pro and Drone2Map import the same license file used to license their portal into their license manager. Users are no longer required to generate an additional license file in the license manager.

Parameter

Description

info

Required Dict. The JSON representation of the license server connection information.

Returns:

Boolean. True if successful else False.

# Example Usage
>>> gis.admin.system.licenses.update(info={ "hostname": "licensemanager.domain.com,backuplicensemanager.domain.com",
                                        "port": 27000
                                      })
True
validate(file, list_ut=False)

The validate operation is used to validate an input license file. Only valid license files can be imported into the Enterprise portal. If the provided file is valid, the operation will return user type, app bundle, and app information from the license file. If the file is invalid, the operation will fail and return an error message.

Parameter

Description

file

Required String. The portal license file.

list_ut

Optional Boolean. Returns a list of user types that are compatible with the Administrator role. This identifies the user type(s) that can be assigned to the Initial Administrator Account when creating a portal.

Returns:

Dictionary indicating ‘success’ or ‘error’

Directory

class arcgis.gis.admin.Directory(url, gis=None, **kwargs)

A directory is a file system-based folder that contains a specific type of content for the portal. The physicalPath property of a directory locates the actual path of the folder on the file system. Beginning at 10.2.1, Portal for ArcGIS supports local directories and network shares as valid locations. During the Portal for ArcGIS installation, the setup program asks you for the root portal directory (that will contain all the portal’s sub directories). However, you can change each registered directory through this API.

property properties

The properties operation on a directory can be used to change the physical path and description properties of the directory. This is useful when changing the location of a directory from a local path to a network share. However, the API does not copy your content and data from the old path to the new path. This has to be done independently by the system administrator.

WebAdaptor

class arcgis.gis.admin.WebAdaptor(url, gis=None, **kwargs)

The ArcGIS Web Adaptor is a web application that runs in a front-end web server. One of the Web Adaptor’s primary responsibilities is to forward HTTP requests from end users to Portal for ArcGIS. The Web Adaptor acts a reverse proxy, providing the end users with an entry point to the system, hiding the back-end servers, and providing some degree of immunity from back-end failures. The front-end web server can authenticate incoming requests against your enterprise identity stores and provide specific authentication schemes such as Integrated Windows Authentication (IWA), HTTP Basic, or Digest. Most importantly, a Web Adaptor provides your end users with a well defined entry point to your system without exposing the internal details of your portal. Portal for ArcGIS will trust requests being forwarded by the Web Adaptor and will not challenge the user for any credentials. However, the authorization of the request (by looking up roles and permissions) is still enforced by the portal’s sharing rules.

unregister()

You can use this operation to unregister the ArcGIS Web Adaptor from your portal. Once a Web Adaptor has been unregistered, your portal will no longer trust the Web Adaptor and will not accept any credentials from it. This operation is typically used when you want to register a new Web Adaptor or when your old Web Adaptor needs to be updated.

WebAdaptors

class arcgis.gis.admin.WebAdaptors(url, gis=None, **kwargs)

The Web Adaptors resource lists the ArcGIS Web Adaptor configured with your portal. You can configure the Web Adaptor by using its configuration web page or the command line utility provided with the installation.

property configuration

Gets/Sets the common properties and configuration of the ArcGIS Web Adaptor configured with the portal.

Parameter

Description

shared_key

Required string. This property represents credentials that are shared with the Web Adaptor. The Web Adaptor uses these credentials to communicate with the portal

list()

Returns all instances of WebAdaptors

USAGE: Get all Web Adaptors and list keys,values of first Web Adaptor object

from arcgis.gis import GIS
gis = GIS("https://yourportal.com/portal", "portaladmin", "password")

# Return a List of Web Adaptor objects
webadaptors = gis.admin.system.web_adaptors.list()

# Get the first Web Adaptor object and print out each of its values
for key, value in dict(webadaptors[0]).items():
    print("{} : {}".format(key, value))

# Output
machineName : yourportal.com
machineIP : 10.11.12.13
webAdaptorURL : https://yourwebserver.com/portal
id : ac17d7b9-adbd-4c45-ae13-77b0ad6f14e8
description :
httpPort : 80
httpsPort : 443
refreshServerListInterval : 1
reconnectServerOnFailureInterval : 1
Returns:

List of WebAdaptor objects. Typically, only 1 Web Adaptor will exist for a Portal

WebhookManager

class arcgis.gis.admin.WebhookManager(url, gis)

Creates and manages ArcGIS Enterprise webhooks. Webhooks allow you to be automatically notified when events associated with items, groups, and users occur. Once a webhook has been triggered, an HTTP request is made to a user-defined URL to provide information regarding the event.

create(name, url, events='ALL', number_of_failures=5, days_in_past=5, secret=None, properties=None)

Creates a WebHook to monitor REST endpoints and report activities

Parameter

Description

name

Required String. The name of the webhook.

url

Required String. This is the URL to which the webhook will deliver payloads to.

events

Otional List or String. The events accepts a list or all events can be monitored. This is done by passing “ALL” in as the events. If a list is provided, a specific endpoint can be monitored.

Item Trigger Events

Trigger event

URI example

All trigger events for all items

/items

Add item to the portal

/items/add

All trigger events for a specific item

/items/<itemID>

Delete a specific item

/items/<itemID>/delete

Update a specific item’s properties

/items/<itemID>/update

Move an item or changing ownership of the item

/items/<itemID>/move

Publish a specific item

/items/<itemID>/publish

Share a specific item

/items/<itemID>/share

Unshare a specific item

/items/<itemID>/unshare

Group Trigger Events

Trigger event

URI example

All trigger events for all groups

/groups

Add group

/groups/add

All trigger events for a specific group

/groups/<groupID>

Update a specific group

/groups/<groupID>/update

Delete a specific group

/groups/<groupID>/delete

Enable Delete Protection for a specific group

/groups/<groupID>/protect

Disable Delete Protection for a specific group

/groups/<groupID>/unprotect

Invite a user to a specific group

/groups/<groupID>/invite

Add a user to a specific group

/groups/<groupID>/addUsers

Remove a user from a specific group

/groups/<groupID>/removeUsers

Update a user’s role in a specific group

/groups/<groupID>/updateUsers

User Trigger Events

Trigger event

URI example

All trigger events for all users in the portal

/users

All trigger events associated with a specific user

/users/<username>

Delete a specific user

/users/<username>/delete

Update a specific user’s profile

/users/<username>/update

Disable a specific user’s account

/users/<username>/disable

Enable a specific user’s account

/users/<username>/enable

Example Syntax: [‘/users’, ‘/groups/abcd1234….’]

number_of_failures

Optional Integer. The number of failures to allow before the service

days_in_past

Option Integer. The number of days to report back on.

secret

Optional String. Add a Secret to your payload that can be used to authenticate the message on your receiver.

properties

Optional Dict. At 10.9.1+ users can provide additional configuration properties.

:returns a WebHook instance

# Example using Zapier as the payload URL

from arcgis.gis import GIS

gis = GIS(profile="your_profile", verify_cert=False)

wh_mgr = gis.admin.webhooks
wh = wh_mgr.create(name="Webhook_from_API",
                   url="https://hooks.zapier.com/hooks/catch/6694048/odqj9o3/",
                   events=["/items/981e98b949d9432ebf26433f40948cec/move",
                           "/items/981e98b949d9432ebf26433f40948cec/update"]

See Webhook Blog Post for a detailed explanation.

get(name)

finds a single instance of a webhook by name

list()

Returns a list of WebHook objects

property properties

returns the Webhook properties

property settings

There are several advanced parameters that can be used to configure the connection behavior of your webhook. These parameters will be applied to all of the configured webhooks in your Portal. Use the Update operation to modify any of the parameters.

** Dictionary Key/Values **

Parameter

Description

notificationAttempts

Required Integer. This will determine how many attempts will be made to deliver a payload.

otificationTimeOutInSeconds

Required Integer. The length of time (in seconds) that Portal will wait to receive a response. The max response is 60.

notificationElapsedTimeInSeconds

Required Integer. The amount of time between each payload delivery attempt. By default, this is set to 30 seconds and can be set to a maximum of 100 seconds and a minimum of one second.

returns: dict

Webhook

class arcgis.gis.admin.Webhook(url, gis)

a single webhook

activate()

Restarts a deactivated webhook. When activated, payloads will be delivered to the payload URL when the webhook is invoked.

deactivate()

Temporarily pause the webhook. This will stop the webhook from delivering payloads when it is invoked. The webhook will be automatically deactivated when the deactivation policy is met.

Returns:

boolean

delete()

Removes the current webhook from the system.

Returns:

Boolean

property notifications

The notifications` will display information pertaining to trigger events associated with the specific webhook. You can use this table to monitor your webhook and the details of any delivered payloads such as the time the webhook was triggered, the response received from the payload URL, and the delivered payload data.

Returns:

List

property properties
update(name=None, url=None, events=None, number_of_failures=None, days_in_past=None, secret=None, properties=None)

The Update Webhook operation allows administrators to update any of the parameters of their webhook.

Parameter

Description

name

Required String. The name of the webhook.

url

Required String. This is the URL to which the webhook will deliver payloads to.

events

Otional List or String. The events accepts a list of all events that can be monitored. This is done by passing “ALL” in as the events. If a list is provided, a specific endpoint can be monitored.

Item Trigger Events

Trigger event

URI example

All trigger events for all items

/items

Add item to the portal

/items/add

All trigger events for a specific item

/items/<itemID>

Delete a specific item

/items/<itemID>/delete

Update a specific item’s properties

/items/<itemID>/update

Move an item or changing ownership of the item

/items/<itemID>/move

Publish a specific item

/items/<itemID>/publish

Share a specific item

/items/<itemID>/share

Unshare a specific item

/items/<itemID>/unshare

Group Trigger Events

Trigger event

URI example

All trigger events for all groups

/groups

Add group

/groups/add

All trigger events for a specific group

/groups/<groupID>

Update a specific group

/groups/<groupID>/update

Delete a specific group

/groups/<groupID>/delete

Enable Delete Protection for a specific group

/groups/<groupID>/protect

Disable Delete Protection for a specific group

/groups/<groupID>/unprotect

Invite a user to a specific group

/groups/<groupID>/invite

Add a user to a specific group

/groups/<groupID>/addUsers

Remove a user from a specific group

/groups/<groupID>/removeUsers

Update a user’s role in a specific group

/groups/<groupID>/updateUsers

User Trigger Events

Trigger event

URI example

All trigger events for all users in the portal

/users

All trigger events associated with a specific user

/users/<username>

Delete a specific user

/users/<username>/delete

Update a specific user’s profile

/users/<username>/update

Disable a specific user’s account

/users/<username>/disable

Enable a specific user’s account

/users/<username>/enable

#Example Usage:

>>> events = ['/users', '/groups/abcd1234....']

number_of_failures

Optional Integer. The number of failures to allow before the webhook is deactivated.

days_in_past

Option Integer. The number of days to report back on.

secret

Optional String. Add a secret to your payload that can be used to authenticate the message on your receiver.

:returns Boolean

SocialProviders

class arcgis.gis.admin.SocialProviders(gis)

Enables/Disables the Social Providers Settings for a GIS

Parameter

Description

value

Required GIS. This is an administrator connection to a GIS site.

Returns:

SocialProviders object

property configuration

Gets/Sets for the Social Providers on the GIS

Parameter

Description

value

Optional dict or None. If the value is None, the social provider configuration is deleted. If the value is a dictionary, a social provider is setup on the site or updated.

Key:Value Dictionary Options for value Argument

Key

Value

signUpMode

optional string. Invitation or Automatic.

providers

required string. This is a list of strings seperated by a comma. The allowed values are: facebook and google

role

optional string. This is the default role setup when users login to a GIS.

level

optional integer. This is the default level set when a social provider user logins.

userCreditAssignment

optional integer. The default is -1, which means infinite credit usage. The

groups

optional string. A comma seperated list of group ids to assign new users to when they login to using a social provider.

user_type

optional string. A default user license type.

property properties

returns the social providers configurations

MetadataManager

class arcgis.gis.admin.MetadataManager(gis)

Provides Administrators an Easy value to enable, update and disable metadata settings on a Web GIS Site (Enterprise or ArcGIS Online)

disable()

This operation turns off metadata for items.

Returns:

boolean

enable(metadata_format='arcgis')

This operation turns on metadata for items and allows the administrator to set the default metadata scheme.

Parameter

Description

metadata_format

Required string. Sets the default metadata format. The allowed values are: inspire,iso19139-3.2,fgdc,iso19139,arcgis, or iso19115

Returns:

boolean

property is_enabled

returns boolean to show if metadata is enable on a GIS

update(metadata_format='arcgis')

This operation allows administrators to update the current metdata properties.

Parameter

Description

metadata_format

Required string. Sets the default metadata format. The allowed values are: inspire,iso19139-3.2,fgdc,iso19139,arcgis, or iso19115

Returns:

boolean

ExternalContentManager

class arcgis.gis.kubernetes.ExternalContentManager(url, gis)

Bases: _BaseKube

Provides management of the external content resources.

property external_content

The external_content resource returns whether access to external content has been enabled or disabled for an organization. If the resource returns true, an organization’s Esri content will contain external URLs that reference sites and resources hosted outside of the organization. If the resource returns false, Esri content containing external URLs will be removed from the organization. Any Esri content remaining after external content is disabled will not contain external URLs. If you are configuring ArcGIS Enterprise on Kubernetes in an environment in which no internet connection is available, or internet access is prohibited, access to external content should be disabled to avoid discovering content containing inaccessible URLs to external sites.

Returns:

dict[str,Any]

update(value)

The update operation enables and disables access to Esri-provided content containing external URLs that reference sites and resources hosted outside of the organization.

Returns:

dict[str,Any]

LanguageManager

class arcgis.gis.kubernetes.LanguageManager(url, gis)

Bases: _BaseKube

Provides management of the language resources. The languages resource provides a list of current languages for an organization.

property languages

This resource returns a list of all Esri supported languages and their associated language codes, as well as the current status of the language, either enabled (true) or disabled (false). After your organization has been configured, English (language code en) will be the only enabled language by default. Additional languages can be enabled using the Add operation. Once enabled, the Esri provided content for these languages will be searchable and accessible to users in your organization. Enabled languages can be disabled using the Remove operation, which will remove their Esri provided content from the organization. Note that at least one language must always be enabled for your organization.

Returns:

Dict[str, bool]

DataStores

class arcgis.gis.kubernetes.DataStores(url, gis, initialize=False)

Bases: _BaseKube

add(item, options=None, sync=None)

Registers a new data item with the data store.

Parameter

Description

item

Required string. The dictionary representing the data item. See http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000001s9000000

Returns:

The data item if registered successfully, None otherwise.

property config

Gets/Sets information on the data store’s configuration properties that affect the behavior of the data holdings of the server.

Parameter

Description

config

Required string. A JSON string containing the data store configuration.

Returns:

dict

property properties

returns the object properties

search(parent_path=None, ancestor_path=None, types=None, id=None, is_managed=None, json=False, **kwargs)

Use this operation to search through the various data items that are registered in the server’s data store.

Parameter

Description

parent_path

Optional string. The path of the parent under which to find items.

ancestor_path

Optional string. The path of the ancestor under which to find items.

types

Optional string. A filter for the type of the items (for example, fgdb or folder or egdb).

id

Optional string. A filter to search by the ID of the item.

is_managed

Optional Boolean. Specifies if the data store is system managed.

json

Optional Boolean. If True, the results will be returned as the raw JSON response. False, the response will be a list of DataStore objects. The default is False.

Returns:

A list of the items found matching the search criteria.

property stores

returns a list of all datastores in the enterprise

property url

gets/sets the service url

validate(item)

Validates that the path (for file shares) or connection string (for databases) for a specific data item is accessible to every server node in the site by checking against the JSON representing the data item, ensuring that the data item can be registered and used successfully within the server’s data store.

Validating a data item does not automatically register it for you. You need to explicitly register your data item by invoking the register operation.

Parameter

Description

item

Required string. The JSON representing the data item. See http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000001s9000000

DataStore

class arcgis.gis.kubernetes.DataStore(url, gis, parent, initialize=False)

Bases: _BaseKube

delete(force=True)

Removes the datastore from the Kubernetes Site

Returns:

Boolean

property status

This resource returns health information for a relational data store only.

Returns:

Dict

switch_role()

This operation promotes a standby relational data store to act as primary while also downgrading the existing primary to act as standby. This operation may take some time to complete.

Returns:

Boolean

Deployment

class arcgis.gis.kubernetes.Deployment(url, gis)

Bases: object

This represents a single deployment microservice.

edit(props)

edit allows you to edit the scaling (replicas) and resource allocation (resources) for a specific microservice within your deployment.

Parameter

Description

props

Required Dict[str, Any]. he microservice properties, represented as a dictionary.

Returns:

Boolean. True if successful else False.

property properties

Returns the properties of the Deployment

Returns:

Dict[str, Any]

refresh()

The refresh operation can be used to troubleshoot microservices and pods that may be unresponsive or not functioning as expected. Performing this operation will restart the corresponding pods and recreate the microservice.

Returns:

Boolean. True if successful else False.

status()

Returns the status of the current deployment.

Returns:

Dict[str, Any]

Job

class arcgis.gis.kubernetes.Job(url, gis=None, initialize=True, **kwargs)

Bases: _BaseKube

A Kubernetes asynchronous opertion

property properties

returns the object properties

JobManager

class arcgis.gis.kubernetes.JobManager(url, gis)

Bases: _BaseKube

Provides access to the jobs resources defined on the ArcGIS Enterprise.

job(job_id)

This resource returns the progress and status messages of an asynchronous job. Updated progress information can be acquired by periodically querying this operation.

Backup

class arcgis.gis.kubernetes.Backup(url, gis)

Bases: _BaseKube

delete()

Removes the backup from the system

Returns:

Boolean. True if successful else False.

restore(store_name, passcode)

Restores the organization to the state it was in when the backup was created. Once completed, any existing content and data will be replaced with what was contained in the backup.

Parameter

Description

store_name

Required String. The name of the store the backup was copied to.

passcode

Required String. The passcode used to encrypted the backup. This passcode must be the same as the one used when creating the backup.

Returns:

Boolean. True if successful else False.

validate()

This operation ensures that the backup store is able to access the object store and is ready for backup operations to be performed.

Returns:

Dict

BackupStoresManager

class arcgis.gis.kubernetes.BackupStoresManager(url, gis)

Bases: object

Manages the backup stores with the deployments

list()

Returns a list of all the backup stores objects

property properties

returns the endpoint properties

Returns:

dict[str, Any]

register(name, settings, default, future=False)

The register operation registers a backup store. The backup store is created and managed by the deployment.

Returns:

dict | concurrent.futures.Future

BackupStore

class arcgis.gis.kubernetes.BackupStore(url, gis)

Bases: _BaseKube

delete()

Unregisters a backup store from the deploayment

update(settings)

Update only supports setting the backup store as the default store for your deployment {“default”: true}.

Parameter

Description

settings

Required dict[str, Any]. A JSON object of backup store settings. At 10.9.1, the only supported setting is the default property. Setting the default property as true will mark the backup store as the default store for your deployment.

Returns:

bool

validate()

This operation ensures that the backup store is able to access the object store and is ready for backup operations to be performed.

RecoveryManager

class arcgis.gis.kubernetes.RecoveryManager(url, gis)

Bases: _BaseKube

Allows an administrator the ability to manage disaster recovery settings

backup(name, store_name, passcode, description=None)

Creates a backup that can be restored in the event of data loss, data corruption, or deployment failures. Backups are stored in a designated backup store.

Parameter

Description

name

Required String. The unique name of the backup.

store_name

Required String. The name of the backup store to save in.

passcode

Required String. A passcode that will be used to encrypt the content of the backup. When restoring a backup, this passcode must be passed in. The passcode must be at least eight characters in length.

description

Optional String. A description of the backup.

Returns:

Dict[str, Any]

property backup_status

This resource returns the status of a current, or previously executed, backup.

Returns:

Dict[str, Any]

property backups

Returns the backups that have been created of an organization.

Returns:

List[Backup]

property backupstores

Manages the backup stores registered with the deployment

Returns:

BackupStoresManager

register(name, credentials, root, storage_config, is_default=False)

This method registers a backup store.

Parameter

Description

name

Required String. The unique name of the backup store.

credentials

Required Dict[str, str]. The credentials of the configuration store.

root

Required String. The root directory of the store.

storage_config

Required Dictionary. A dictionary describing the storage configuration for the backup store.

is_default

Optional Bool. Determines if the store will be the default backup store. The default is False.

Returns:

BackupStore

property settings

Gets/Sets the currently configured disaster recovery settings.

Parameter

Description

value

Required Dict[str, Any]. Dictionary describing disaster recovery settings.

Returns:

Dict[str, Any]

property stores

Returns the backup stores that are registered with your deployment.

Returns:

List[BackupStore]

LicenseManager

class arcgis.gis.kubernetes.LicenseManager(url, gis)

Bases: _BaseKube

The license manager for the Kubernetes deployment.

load(license_file, overwrite)

load imports and applies an ArcGIS Server authorization file. By default, this operation will append authorizations from the imported license file to the current authorizations. Optionally, you can select the overwrite option to fully replace the current authorizations with those from the imported license file.

Parameter

Description

license_file

Required string. The ArcGIS Server authorization file (either in .epc or .prvc file format).

overwrite

Required bool. Specifies whether the authorizations in the imported license file will fully replace or be appended to the current authorizations. If true, the authorizations from the imported license file will replace the current authorizations. If false, the authorizations from the imported license file will be appended to the current authorizations.

Returns:

Boolean. True if successful else False.

LogManager

class arcgis.gis.kubernetes.LogManager(url, gis, initialize=False)

Bases: _BaseKube

Helper class for the management of Kubernetes logs by administrators.

Logs are the transaction records written by the various components of ArcGIS Server. You can query the logs, change various log settings, and check error messages for helping to determine the nature of an issue.

clean(start_time=None, end_time=None, level=None)

Deletes all the log files on all server machines in the site. This is an irreversible operation.

This operation forces the server to clean the logs, which has the effect of freeing up disk space. However, it is not required that you invoke this operation because the server periodically purges old logs.

Parameter

Description

start_time

Optional String. The date associated with a log, in timestamp format (yyyy-mm-ddThh:mm:ss). If specified, logs created after this time will be deleted. When the endTime parameter is also defined, only logs created between the date range will be deleted. When log_level is added to the request with a date range specified, only logs that match the selected level and were created within the defined date range will be deleted.

end_time

Optional String. The date associated with a log, in timestamp format (yyyy-mm-ddThh:mm:ss). If specified, logs created before this time will be deleted. When the startTime parameter is also defined, only logs created between the date range will be deleted. When log_level is added to the request with a date range specified, only logs that match the selected level and were created within the defined date range will be deleted.

level

Optional String. The level of logs that will be deleted. If no option is selected, all log messages will be deleted.

Values: SEVERE | WARNING | INFO | FINE | VERBOSE | DEBUG

Returns:

A boolean indicating success (True) or failure (False).

edit(level='WARNING')

Provides log editing capabilities for the entire site.

Parameter

Description

level

Optional string. The log level. Can be one of (in severity order): OFF, DEBUG, VERBOSE, FINE, INFO, WARNING, SEVERE. The default is WARNING.

Returns:

Boolean. True if successful else False.

export(query=None, start_time=None, end_time=None, level='WARNING', log_code=None, users=None, request_ids=None, service_types=None, source=None, stack_traces=False, out_folder=None)

The export operation exports organization logs based on either query or search parameters. Using the query filter parameters, you can aggregate and filter through logs for your deployment. Using the search parameters, you can search for specific log records. Once completed, a .zip file of the exported logs is uploaded to the uploads directory, which can be downloaded from the URL provided with the success response. If necessary, the export operation can be invoked multiple times to acquire additional logs.

Parameter

Description

query

Optional string. The search terms used to query your organization’s logs. This parameter supports keywords (for example, completed) and phrases (for example, completed successfully).

start_time

Optional datetime. The oldest time to query logs against, formatted as either a timestamp (yyyy-mm-ddThh:mm:ss) or milliseconds from epoch. The default is the beginning of all recorded logs.

end_time

Optional datetime. The most recent time to query against, formatted as either a timestamp (yyyy-mm-ddThh:mm:ss) or milliseconds from epoch. The default is the current date.

level

Optional string. Gets only the records with a log level at or more severe than the level declared here. Can be one of (in severity order): DEBUG, VERBOSE, FINE, INFO, WARNING, SEVERE. The default is WARNING.

log_code

Optional String. Specifies the log codes assigned to the logs. When specified, query will return logs associated with those codes.

users

Optional list[str]. The username(s) of a user within the organization that can be used to further filter log results.

example: >>> users = [“user1”, “user2”] >>> logs.export(users=users)

request_ids

Optional String. An ID assigned to a specific server event.

service_types

Optional String. The service type of a service within the organization that can be used to further filter query results.

Note: Currently, only MapServer, GPServer, and FeatureServer are the

only supported service types.

source

Optional String. The source of logged events.

stack_traces

Optional Boolean. If True the stack trace is returned.

out_folder

Optional string. The save folder location.

query(start_time=None, end_time=None, level='WARNING', log_code=None, users=None, request_ids=None, service_types=None, source=None, show_stack_traces=True, num=1000)

The query operation on the logs resource provides a way to aggregate, filter, and page through logs across the entire site.

Parameter

Description

start_time

Optional string. The oldest time to query logs against, formatted as either a timestamp (yyyy-mm-ddThh:mm:ss) or milliseconds from epoch. The default is the beginning of all recorded logs.

end_time

Optional string. The most recent time to query against, formatted as either a timestamp (yyyy-mm-ddThh:mm:ss) or milliseconds from epoch. The default is the current date.

level

Optional string. Gets only the records with a log level at or more severe than the level declared here. Can be one of (in severity order): DEBUG, VERBOSE, FINE, INFO, WARNING, SEVERE. The default is WARNING.

log_code

Optional String. Specifies the log codes assigned to the logs. When specified, query will return logs associated with those codes.

users

Optional String. The username of a user within the organization that can be used to further filter log results.

request_ids

Optional String. An ID assigned to a specific server event.

service_types

Optional String. The service type of a service within the organization that can be used to further filter query results.

Note: Currently, only MapServer, GPServer, and FeatureServer are the

only supported service types.

source

Optional String. The source of logged events.

show_stack_traces

Optional Boolean. If True the stack trace is returned.

num

Optional Int. The maximum number of log records to be returned by this query. The default messages per page is 1000. The limit for this parameter is 10000 records.

Returns:

A JSON of the log items that match the query. If export option is set to True, the output log file path is returned.

refresh_index()

Recreates the log indexes and can be used to troubleshoot issues related to accessing logs, such as if new logs are not being generated or if existing logs are unavailable.

Returns:

Boolean. True if successful else False.

search(query, sort_by='bestMatch', sort_order='desc', show_stack=False, return_count=False)

Allows after to search your organization’s logs for specific log records.

Parameter

Description

query

Required String. The search terms used to query your organization’s logs. This parameter supports keywords (for example, completed) and phrases (for example, completed successfully).

sort_by

Optional String. Specifies the way in which search results are sorted. Sorting by bestMatch returns the results that best match the query values. Sorting by time sorts the search results by the time information recorded in the log’s time stamp, the order of which is determined by the sort_order parameter.

Values: bestMatch or time

sort_order

Optional String. The sort order for the results, either descending or ascending. This parameter is ignored if sort_by is set to bestMatch.

Values: desc or asc

show_stack

Optional Boolean. Specifies whether stack traces are included in the search results. The default is false.

return_count

Optional Boolean. If true, only returns a count of the logs that would be returned by the search operation. If false, the response includes the search results in full. The default is false.

Returns:

If return_count==False, the messages as a list are returned, else an Integer

property settings

Gets the current log settings.

Mode

class arcgis.gis.kubernetes.Mode(url, gis=None, initialize=True, **kwargs)

Bases: _BaseKube

property read_only

Returns if the Kubernetes site is in read only mode.

Returns:

bool

update(read_only, description=None)

Updates the site’s mode to set it in read only

Parameter

Description

read_only

Required Boolean. If True, the organization will be in read only mode. False it is in write mode.

description

Optional String. Sets a custom message to be displayed whenever an attempt to modify or update content or site settings is made through the API. If no custom message is provided, a default response is used.

Returns:

Boolean. True if successful else False.

Overview

class arcgis.gis.kubernetes.Overview(url, gis)

Bases: _BaseKube

property config

Gets/sets a dictionary of resource types that correspond with the Overview class. It contains the update interval for each property.

Parameter

Description

resource

Required Dictionary. A dictionary object containing the id, type, and updateIntervalMin for an overview resource type, returned by the config resource. The accepted values for updateIntervalMin (0-60) can be modified to update the interval (in minutes) of which the resource type will have it’s information pulled and cached. If set to 0, information for the resource type will not be cached and will, instead, have it’s real-time information returned when the overview resource is called. The default values for each resource type are listed below:

  • criticalLogs: 0

  • systemServices: 1

  • utilityServices: 1

  • dataStores: 2

Returns:

Dict[str, Any]

get(resource=None)

The get returns the persisted cache or real-time information, such as health or status information, for the overview resource types, and is what is called when the Overview page of the Enterprise Manager is updated. Whether the information is cached or returned in real-time depends on the updateIntervalMin property returned by the config resource, which specifies the interval (in minutes) from which information for each resource type is pulled and cached.

Resource types that have an updateIntervalMin value of 0 will not have their information cached and, instead, will have real-time information returned when the resource is called. The update interval can me modified through the update operation.

Parameter

Description

resource

Optional String. Specifies the resource type (criticalLogs, dataStores, systemServices, utilityServices) that will have their information returned. Using all as the input value will return information for all resource types.

The default is None. When None, all resources will be returned.

Returns:

Dict[str, Any]

KubeEnterpriseGroups

class arcgis.gis.kubernetes.KubeEnterpriseGroups(url, gis)

Bases: object

This resource is an umbrella for operations that inventory your organization’s groups, such as retrieving a list of users within a specific group or listing which groups a specific user is assigned to. The groups resource returns the total number of enterprise groups in the system.

find_within_groups(name, query=None, max_count=1000)

This operation returns a list of users that are currently assigned to the enterprise group within the enterprise user and group stores.

Parameter

Description

name

Required String. The name of the group.

query

Optional String. Text to narrow down the user search.

max_count

Optional Integer. The maximum number of recrods that the client will accept.

get_user_groups(username, query=None, max_count=1000)

This operation searches groups in the configured role store. You can narrow down the search using the query parameter.

Parameter

Description

username

Required String. The username to examine.

query

Optional String. Text to narrow down the user search.

max_count

Optional Integer. The maximum number of recrods that the client will accept.

Returns:

dict

property properties

returns the properties for the Organization

Returns:

dict

refresh_membership(groups)

This operation iterates over every enterprise account configured in your organization and determines whether the user account is part of the input enterprise group. If there are any changes in membership, the database and indexes are updated for each group.

Parameter

Description

groups

Required List[str]. The name of the groups to refresh.

Returns:

bool

search(query='', max_count=1000)

Searches users in the configured enterprise user store.

Parameter

Description

query

Optional String. Text to narrow down the user search.

max_count

Optional Integer. The maximum number of recrods that the client will accept.

KubeEnterpriseUser

class arcgis.gis.kubernetes.KubeEnterpriseUser(url, gis)

Bases: object

The KubeEnterpriseUser resource houses operations used to manage members in your organization.

create_user(username, password, first_name, last_name, email, user_license, role='org_user', provider='arcgis', idp_username=None, description=None)

This operation is used to pre-create built-in or enterprise accounts within the portal. The provider parameter is used to indicate the type of user account.

Parameter

Description

username

Required string. The name of the user account

password

Required string. The password of the user account

first_name

Required string. The first name for the account

last_name

Required string. The last name for the account

email

Required string. The email for the account

user_license

Optional string. The user type for the account.

Values before Enterprise 11.4: creator, editor, advanced (GIS Advanced),

basic (GIS Basic), standard (GIS Standard), viewer, fieldworker

Values for Enterprise 11.4+: creator, contributor, fieldworker, viewer,

professionalplus, professional

role

Optional string. The role for the user account. The default value is org_user. Values org_admin | org_publisher | org_user | org_editor (Data Editor) | viewer

provider

Optional string. The provider for the account. The default value is arcgis. Values arcgis | 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.

description

Optional string. A user description

Returns:

boolean

get_enterprise_user(username)

gets the enterprise user

refresh_membership(users)

This operation iterates over every enterprise group configured in your organization and determines whether the input user accounts belong to any of the configured enterprise groups. If there is any change in membership, the database and the indexes are updated for each user account. While the portal automatically refreshes the memberships during a user login and during a periodic refresh (configured through the Update Identity Store operation), this operation allows an administrator to force a refresh.

Parameter

Description

users

Optional list[str]. The comma-separated list of usernames for whom the memberships need to be refreshed.

Returns:

dict

search(query='', max_count=1000)

Searches users in the configured enterprise user store.

Parameter

Description

query

Optional String. Text to narrow down the user search.

max_count

Optional Integer. The maximum number of recrods that the client will accept.

KubeOrganization

class arcgis.gis.kubernetes.KubeOrganization(url, gis, **kwargs)

Bases: object

A single organization within your deployment, allowing you to manage and update it’s licensing and security information, as well as manage it’s federated servers.

property federation

Returns manager to work with server federation.

Returns:

KubeOrgFederations

property license

The Licenses resource returns high-level licensing details.

Returns:

KubeOrgLicense

property org_property

This operation lists and sets properties specific to an organization that can be modified to control your deployment.

Returns:

dict

property properties

returns the object properties

property security
property url

gets/sets the service url

KubeOrganizations

class arcgis.gis.kubernetes.KubeOrganizations(url, gis, initialize=True)

Bases: object

Allows for the management of organizations within the ArcGIS Enterprise on Kubernetes deployment.

property orgs

Returns a list of registered organizations with the Kubernetes deployment

Returns:

tuple

property properties

returns the object properties

property url

gets/sets the service url

KubeOrgFederations

class arcgis.gis.kubernetes.KubeOrgFederations(url, gis)

Bases: object

Provides access to the federation of ArcGIS Server and the ability to federate them with the organization.

federate(url, admin_url, username, password)

This operation federates either a GIS Server or ArcGIS Image Server with an organization. The federate operation performs a validation check to determine whether the provided service and dministrative URLs are accessible. If the resulting validation check fails, a warning is returned. A SEVERE log type is also returned in the organization’s logs. After federation, administrators will be unable to set a server role for the federated server.

Once a server has been federated with an organization, services that exist on the ArcGIS Server site at the time of federation are automatically added to the portal as items. The administrator who performs this operation will be assigned as the imported service’s owner and, once the operation is complete, can reassign ownership to other members in the organization. Any subsequent items published to the federated server are automatically added as items on the portal and are owned by the user who publishes them.

Parameter

Description

url

Required string. The URL of the GIS or image server used by external users when accessing the server site. If you’ve added the server to your organization’s reverse proxy server, the URL is the reverse proxy server address.

admin_url

Required string. The URL used to access the server when performing administrative operations on the internal network. The URL must be able to be used by the organization to communicate with all servers in the site, even when one of them is unavailable.

username

Required string. The username of the primary administrator account for the server. If this account is disabled, you’ll need to reenable it.

password

Required string. The password of the primary administrator account for the server.

Returns:

bool

property properties

returns the properties for the Kubernetes License Organization

Returns:

dict

property servers

This resource returns detailed information about the ArcGIS Servers federated with ArcGIS on Kubernetes. Information such as the ID and name of the server, ArcGIS Web Adaptor URL, administration URL, and role of the server.

unfederate(server_id)

This operation unfederates a currently federated ArcGIS Server from your organization. Before performing this operation, the federated server should be taken out of read-only mode if it was already in that state. This operation is not applicable to the hosting server configured as part of the base deployment of ArcGIS Enterprise on Kubernetes.

Returns:

Bool

validate(server_id)

The validate operation performs validation checks against all federated GIS Server and ArcGIS Image Server types within your organization, including the hosting server that is built in with an ArcGIS Enterprise on Kubernetes deployment. On completion, this operation returns status and accessibility information for all organization servers. This response also includes any failure messages from failed validation checks.

Parameter

Description

server_id

Optional String. When present the validation will occur on that single server. If no server_id is given, then all servers are validated.

Returns:

dict

KubeOrgLicense

class arcgis.gis.kubernetes.KubeOrgLicense(url, gis)

Bases: object

The Licenses resource returns high-level licensing details, such as the total number of registered members that can be added, the current number of members in the organization, the Enterprise portal version, and license manager information. This API endpoint also provides access to various operations that allow you to manage your portal licenses for your organization.

export_gdb_license(out_folder=None)

The operation downloads a geodatabaseLicense.ecp file that represents the authorization file needed when enabling, creating, and updating an enterprise geodatabase in ArcGIS Pro for ArcGIS Enterprise on Kubernetes deployments. Accessing this operation automatically downloads the .ecp file; no parameters are required and no JSON Response is returned for this operation.

Parameter

Description

out_folder

Optional string. The folder where the license file will be saved.

Returns:

str

import_license(license_file)

Applies a new license file to a specific organization, which contains the portal’s user type and add-on licenses.

Parameter

Description

license_file

Required String. The kubernetes license file. For deployments using ArcGIS Enterprise on Kubernetes 10.9.1 or earlier, this file is an ArcGIS Enterprise portal license file. For deployments using ArcGIS Enterprise on Kubernetes 11.0 or later, this is an ArcGIS Enterprise on Kubernetes license file.

Returns:

Boolean

property properties

returns the properties for the Kubernetes License Organization

Returns:

dict

update_license_manager(config)

This operation allows you to change the license server connection information for your portal, as well as register a backup license manager for high availability. After changing the license manager properties, Portal for ArcGIS automatically restarts to register changes and set up connections with the backup license manager.

Parameter

Description

config

Required Dict. The JSON representation of the license server connection information.

Example: `{"hostname": "licensemanager.domain.com,backuplicensemanager.domain.com","port": 27000}`

Returns:

Boolean

validate(file, list_ut=False)

The validate operation is used to validate an input license file. Only valid license files can be imported into the Enterprise portal. If the provided file is valid, the operation will return user type, app bundle, and app information from the license file. If the file is invalid, the operation will fail and return an error message.

Parameter

Description

file

Required String. The kubernetes license file. For deployments using ArcGIS Enterprise on Kubernetes 10.9.1 or earlier, this file is an ArcGIS Enterprise portal license file. For deployments using ArcGIS Enterprise on Kubernetes 11.0 or later, this is an ArcGIS Enterprise on Kubernetes license file.

list_ut

Optional Boolean. Returns a list of user types that are compatible with the Administrator role. This identifies the user type(s) that can be assigned to the Initial Administrator Account when creating a portal.

Returns:

Dict

KubeOrgSecurity

class arcgis.gis.kubernetes.KubeOrgSecurity(url, gis)

Bases: object

Allows the for the management of the security of the settings.

property enterprise_groups

Allows users to manage and work with enterprise groups

property enterprise_user

Allows users to manage and work with enterprise users

property properties

returns the properties for the Organization

Returns:

dict

KubeSecurity

class arcgis.gis.kubernetes.KubeSecurity(url, gis)

Bases: object

Allows users to configure the Security settings on the kubernetes infrastructure

property certificates

Provides access to the certificate manager for the Kubernetes infrastructure

Returns:

A KubeSecurityCert object.

property configuration

Returns the currently active security configuration for an ArcGIS Enterprise for Kubernetes deployment

property ingress

Returns a manager to configure the ingress settings.

Returns:

A KubeSecurityIngress object.

property properties

returns the object properties

property saml

Returns a manager to work with the SAML settings for the organization

Returns:

KubeSecuritySAML

property url

gets/sets the service url

KubeSecurityCert

class arcgis.gis.kubernetes.KubeSecurityCert(url, gis)

Bases: object

The certificates resource provides access to child operations and resources that can be used to manage all the security certificates configured with an organization.

get_cert(cert_type, cert_id)

Obtains a single certificate for a given type and ID

Parameter

Description

cert_type

Required String. The type of certificate to search for. This can be ‘trust’ or ‘identity’.

cert_id

Required String. The unique identifier of the certificate.

Returns:

Dict

property identity_certs

Lists all the certificates currently configured with the organization

Returns:

List

load_identity_cert(pfx, password, name)

Imports an existing identity certificate in PKCS #12 (.pfx) format into the keystore. An imported certificate can be assigned to the Ingress controller by setting the certificate name property via the update operation.

Returns:

bool

load_trust_cert(cert, name)

This operation imports a trust certificate, in either PEM (.cer or .crt files) or a binary (.der) format. Once a trust certificate is imported, the corresponding pods that will use the certificate are automatically restarted.

Returns:

bool

property properties

returns the object properties

remove_identity_cert(cert_id)

Deletes an Identity Certificate by ID

Parameter

Description

cert_id

Required String. The unique identifier of the certificate.

remove_trust_cert(cert_id)

Deletes an Identity Certificate by ID

Parameter

Description

cert_id

Required String. The unique identifier of the certificate.

property trust_certs

Lists all the trust certificates configured with the organization :return: list

property url

gets/sets the service url

KubeSecurityConfig

class arcgis.gis.kubernetes.KubeSecurityConfig(url, gis)

Bases: object

Allows the user to manage the security configuration for an ArcGIS Enterprise for Kubernetes deployment.

property properties

returns the object properties

property settings

gets/sets the current secutiry settings for the deployment

test(user_store=None, role_store=None)

Users can test the connection to a user or role (group) store.

Parameter

Description

user_store

Optional dict. Specifies the user store properties. This parameter accepts as input all the properties as defined in the user_store and role_store section of the Kubernetes help documentation.

role_store

Optional dict. pecifies the role (group) store properties. This parameter accepts as input all the properties as defined in the user_store and role_store section of the Kubernetes help documentation.

Returns:

boolean

update_stores(user_store=None, role_store=None)

Users can modify the user or role (group) identity stores.

Parameter

Description

user_store

Optional dict. Specifies the user store properties. This parameter accepts as input all the properties as defined in the userStoreConfig and roleStoreConfig section of the Kubernetes help doctumentation.

role_store

Optional dict. pecifies the role (group) store properties. This parameter accepts as input all the properties as defined in the ArcGIS for Kubernetes help doctumentation.

Returns:

boolean

property url

gets/sets the service url

KubeSecurityIngress

class arcgis.gis.kubernetes.KubeSecurityIngress(url, gis)

Bases: object

The ingress resource returns the currently configured security information for the Ingress controller. You can update ingress security configuration properties using the update operation. The update operation must be used when adding an imported wildcard certificate for the Ingress controller.

property properties

returns the object properties

property settings

gets/sets the ingress configuration properties

Returns:

dict

property url

gets/sets the service url

KubeSecuritySAML

class arcgis.gis.kubernetes.KubeSecuritySAML(url, gis)

Bases: object

The saml resource returns information about the SAML configuration for an organization. If SAML is configured, the enabled property will return as true and identityCertificateName will show the name of the imported identity certificate.

property properties

returns the object properties

property settings

This get/sets the SAML certification information.

Returns:

dict

property url

gets/sets the service url

KubeService

class arcgis.gis.kubernetes.KubeService(url, gis)

Bases: object

A service exposes GIS resources like maps, rasters, locators, geodatabases, and so forth through REST and SOAP interfaces. The type of the service is often dictated by the type of resources being published. In addition to accessing the underlying resource, a GIS service can expose additional capabilities called extensions (or server object extensions). Extensions are packages of custom functionality that can perform business logic or expose the service through additional formats or protocols.

change_provider(provider)

This operation is used to update an individual service to use either a dedicated or shared instance type. When a qualified service is published, the service is automatically set to use shared instances.

When using this operation, services may populate other provider types as values for the provider parameter, such as ArcObjects and SDS. While these are valid provider types, this operation does not support changing the provider of such services to either ArcObjects11 or DMaps. Services with either ArcObjects or SDS as their provider will not be able to change their instance type.

Parameter

Description

provider

Required String. Specifies the service instance as either a shared (DMaps) or dedicated (ArcObjects11) instance type. These values are case-sensitive.

values: DMaps, ArcObjects11

Returns:

boolean

delete()

Removes the service from the hosting server

Returns:

bool

property jobs

The jobs resource provides access to operations that locate and monitor current asynchronous jobs being run by a geoprocessing service. From the jobs resource, you can query for jobs using filters such as the start and end time for the job, the job’s status, or the username of the user who submitted the job.

Returns:

JobManager

property properties

To edit a service, you need to submit the complete JSON representation of the service, which includes the updates to the service properties. Editing a service can cause the service to be restarted with updated properties.

The edit settings of a service contains the following four sections:

  • Service Description Properties - Common properties that are shared by all services. These properties typically identify a specific service.

  • Service Framework Properties - Properties targets towards the framework that hosts the GIS service. They define the life cycle and load balancing of the service.

  • Service Type Properties - Properties targeted towards the core service type as seen by the server administrator. Since these properties are associated with a server object, they vary across the service types.

  • Extension Properties - Represent the extensions that are enabled on the service.

Returns:

dict

restart()

Recycles the current service :return: Bool

property scaling

This resource returns the scaling and resource allocation for a specific GIS service microservice. When used to update the service, it updates the scaling (replicas min and max) and resource allocation (cpuMin, cpuMax, memoryMin, memoryMax).

Parameter

Description

value

Required Dict[str, Any]. The service scaling properties.

Returns:

Dict[str, Any]

start()

Starts the service

Returns:

bool

property status

This resource provides the configured and current status of a GIS service. The configured status represents the state of the resource as you have configured it to be. For example, starting a service would set its configured status to be STARTED. However, it is possible that the configured state may not match the actual state of the resource. The realTimeState property represents the actual state of a service.

stop()

Stops the service

Returns:

bool

GPJobManager

class arcgis.gis.kubernetes.GPJobManager(url, gis)

Bases: object

The jobs resource provides access to operations that locate and monitor current asynchronous jobs being run by a geoprocessing service. From the jobs resource, you can query for jobs using filters such as the start and end time for the job, the job’s status, or the username of the user who submitted the job.

get_job(job_id)

An individual job resource returns information about an asynchronous job, either currently running or completed, for a geoprocessing service.

property properties
query(status, start_time=None, end_time=None, username=None, number=10)

The query operation allows you to query jobs pertaining to a geoprocessing service.

Parameter

Description

status

Required List[String]. The current status of a job. The value set with this parameter will be used to filter the jobs by that set job status.

Values: esriJobNew, esriJobSubmitted, esriJobExecuting, esriJobSucceeded, esriJobFailed, esriJobCancelling, esriJobCancelled, esriJobWaiting

start_time

Optional datetime.datetime. The earliest time to query.

end_time

Optional datetime.datetime. The most recent time to query. If unspecified, the current time will be used. If you specify a value for this parameter, you must also specify a startTime value.

username

Optional String. The name of the user who submitted the job.

number

Optional Integer. The number of jobs to display in the response. The default value is 10.

Returns:

dict

ServicesManager

class arcgis.gis.kubernetes.ServicesManager(url, gis)

Bases: object

The ServicesManager acts as the root folder and container for all sub-folders and GIS services for your deployment. You can create a new sub-folder by using the Create Folder operation as well as a new GIS service by using the Create Service method.

can_create(service_type, *, folder=None, service=None, options=None)

Checks if a service can be generated. It is recommended that the user check if the service can be created before calling create_service.

Parameter

Description

service_type

Required String. The type of service to create.

folder

Optional String. The location to create the service in. If the folder if set on the ServicesManager, the folder parameter will override the save location. The folder must exist before calling this method.

service

Optional Dict. The service configuration in JSON format.

options

Optional Dict. Provides additional information about the service, such as whether it is a hosted service.

create_folder(folder)

Creates a folder on the hosting server

Parameter

Description

folder

Required string. Name of the folder.

Returns:

boolean

create_service(service_json=None, *, input_upload_id=None, folder=None, scaling_spec=None)

Creates a new GIS service in a folder (either the root or a sub-folder) by submitting a JSON representation of the service to this operation.

Parameter

Description

service_json

Required dict. The JSON representation of the service being created.

folder

Optional String. The location to create the service in. If the folder if set on the ServicesManager, the folder parameter will override the save location. The folder must exist before calling this method.

input_upload_id

Optional String. The upload ID for a service definition that contains information about service properties, capabilities, and the service type.

scaling_spec

Optional dict. The service scaling properties, represented as a JSON object. See: https://developers.arcgis.com/rest/enterprise-administration/enterprise/create-service.htm for more information.

Returns:

Bool

exists(*, service_name=None, folder=None, service_type=None)

This operation checks if a folder or service exists on the server.

Returns:

dict

property extensions

Returns a collection of all the custom server object extensions that have been uploaded and registered with the deployment. A .soe file is a container of one or more server object extensions.

Returns:

Dict

property folder

returns the current folder

property folders

returns a list of folder names

Returns:

List[str]

list(folder=None)

lists the services in the current folder

property properties

The proeprties of the manager.

Returns:

dict

property providers

returns the supported provider types for the GIS services in your organization.

refresh_auto_deployment(future=False)

This operation auto-deploys the System or Utility services if they failed to be deployed during site creation. This operation should only be performed if either the System or Utility service fails to be created with the site.

Returns:

Boolean

property services_properties

This resource is used to provide default settings for new services when they are published to the server. You can use the update operation to change the default settings. However, updating the default properties for services won’t change the properties of any pre-existing services in your organization. To update these services, you must edit the individual service’s properties.

Returns:

dict

property types

This resource provides metadata about all service types and extensions that can be enabled.

Returns:

Dict

Container

class arcgis.gis.kubernetes.Container(url, gis)

Bases: object

A single representation of a registered container.

edit(value)

Allows certain container registry properties to be updated after your organization has been configured.

Parameter

Description

value

Required dict. A dictionary of registry properties.

Returns:

bool

properties()

returns the properties of the endpoint

Indexer

class arcgis.gis.kubernetes.Indexer(url, gis=None, initialize=True, **kwargs)

Bases: _BaseKube

This resource contains connection information to the default indexing service.

reconfigure()

This operation recreates the index service metadata, schema, and data in the event it becomes corrupted.

Returns:

Boolean

reindex(mode, includes=None)

The operation allows you to generate or update the indexes for content, such as users, groups, and items stored in the database store.

Parameter

Description

mode

Required String. The mode in which the indexer should run. Values: USER_MODE, GROUP_MODE, SEARCH_MODE, or FULL_MODE

includes

Optional String. A comma separated list of elements to include in the index. This is useful if you want to only index certain items or user accounts.

Returns:

Boolean

property status

status allows you to view the status of the indexing service. You can view the number of users, groups, and search items in both the database (store) and the index. If the database and index do not match, indexing is either in progress or there is a problem with the index. It is recommended that you reindex to correct any issues. If indexing is in progress, you can monitor the status by refreshing the page.

Returns:

dict

Server

class arcgis.gis.kubernetes.Server(url, gis=None, initialize=True, **kwargs)

Bases: _BaseKube

Represents a single kubernetes service

start()

returns the status of the server

property status

returns the status of the server

stop()

returns the status of the server

update(server_json)

Updates the server JSON

Returns:

Boolean

ServerDefaults

class arcgis.gis.kubernetes.ServerDefaults(url, gis=None, initialize=True, **kwargs)

Bases: _BaseKube

Represents the server default values

property properties

returns the object properties

ServerManager

class arcgis.gis.kubernetes.ServerManager(url, gis=None, initialize=True, **kwargs)

Bases: _BaseKube

Manages the Registered Servers

property defaults

Returns the default properties for each server type.

Returns:

list of ServerDefault

property list

Allows for the modification of Servers

Returns:

List of Server objects

SystemManager

class arcgis.gis.kubernetes.SystemManager(url, gis, initialize=False)

Bases: object

The system resource is a collection of system-wide resources for a deployment, such as the configuration store and deployment-wide security.

property architecture_profiles

This resource returns the architecture profile that is set when an organization is configured and provides access to all three architecture profile resources: development, standard-availability, and enhanced-availability.

property containers

Returns the registered containers.

Returns:

list

property deployments

Manages the deployment settings for enterprise

property external_content
property indexer

Allows user to manage the site’s indexer

Returns:

Indexer

property language

The content resource provides access to the languages resource. The languages resource provides a list of current languages for an organization.

Returns:

LanguageManager

property licenses

The licenses resource lists the current license level of ArcGIS Server and all authorized extensions.

Returns:

List[Dict[str, Any]]

property living_atlas

provides functionality to manage living atlas content

property properties

Gets/Sets the system properties resource list system properties that have been modified to control the portal’s environment.

Parameter

Description

value

Required dict. A dictionary of registry properties.

Allowed Key/Value:

Parameter

Description

versionManifestURL

The URL to the version manifest used in the upgrade process. This property should not be modified.

containerStartUpTimeoutSeconds

The timeout (in seconds) for the start-up of containers during the upgrade process. The default value is 900.

allowGPAndExtensionPublishingToPublishers

Introduced at 11.0. When set as true, this property allows administrators and publishers to publish geoprocessing services and extensions. By default, only administrators can publish extensions and geoprocessing services.

Returns:

dict

property recovery

This resource allows an administrator the ability to manage disaster recovery settings.

Returns:

RecoveryManager

property servers

Returns a manager to work with ArcGIS Servers registerd with Kubernetes

property tasks

This resource returns a list of tasks (CleanGPJobs, BackupRetentionCleaner, CreateBackup) that exist within your deployment.

property upgrades

The upgrades resource provides access to child operations and resources that are used to manage the release and patch updates that can be applied to an ArcGIS Enterprise on Kubernetes deployment. During the upgrade process, this resource returns detailed, real-time messages regarding the status and progress of the upgrade. While an upgrade is in progress, child operations and resources for this resource will be inaccessible. Once completed, all child endpoints will be operational, and the JSON view of the resource will contain a log of the job messages and the completion status.

property url

gets/sets the service url

property web_adaptors

The webadaptors resource lists the ArcGIS Enterprise on Kubernetes Web Adaptor configured your deployment. The web adaptor can be configured using the config operation.

TaskManager

class arcgis.gis.kubernetes.TaskManager(url, gis)

Bases: _BaseKube

Provides access to the tasks resources defined on the ArcGIS Enterprise.

create_task(item, cron, task_type, occurences=10, start_date=None, end_date=None, title=None, parameters=None)

This operation creates scheduled tasks for your deployment that run automatically. Once the task has been created, it can be updated using the Update operation. In addition, scheduled tasks can be disabled, reenabled, and deleted through other operations in the ArcGIS Enterprise Administrator API.

Parameter

Description

item

Required Item. The item to schedule a task on.

cron

Required String. The CRON statement. This should be in the from of:

<minute> <hour> <day of month> <month> <day of week>

Example to run a task weekly, use: 0 0 * * 0

task_type

Required String. The type of task, either executing a notebook or updating an Insights workbook, that will be executed against the specified item. For notebook server tasks use: ExecuteNotebook, for Insights notebook use: UpdateInsightsWorkbook. Use ExecuteSceneCook to cook scene tiles. Use ExecuteWorkflowManager to run workflow manager tasks. For data pipelines, use RunDataPipeline.

occurences

Optional Integer. The total number of instance that can run at a single time.

start_date

Optional Datetime. The begin date for the task to run.

start_date

Optional Datetime. The end date for the task to run.

title

Optional String. The title of the scheduled task.

parameters

Optional Dict. Optional collection of Key/Values that will be given to the task. The dictionary will be added to the task run request. This parameter is required for ExecuteSceneCook tasks.

Example

``` {

“service_url”: <scene service URL>, “num_of_caching_service_instances”: 2, //2 instances are required “layer”: “{<list of scene layers to cook>}”, //The default is all layers “update_mode”: “PARTIAL_UPDATE_NODES”

Returns:

Task

delete_run(task_id, run_id)

The delete operation removes a specified run for a scheduled task. Deleting a run also deletes corresponding resource files associated with the run.

Parameter

Description

task_id

Required string. The task to delete the run on.

run_id

Required string. The run to delete.

delete_task(task_id)

This operation deletes a task. Once the task is deleted, all associated runs and resources are deleted as well.

Parameter

Description

task_id

Required string. The task to delete

diable_task(task_id)

This operation disables a specific task and suspends any upcoming runs scheduled for the task.

Parameter

Description

task_id

Required string. The task to disable

edit_run(task_id, run_id, status, results)

This operation updates an existing run for a scheduled task.

Parameter

Description

task_id

Required string. The task to edit the run on.

run_id

Required string. The run to edit.

status

Required string. Set the status of the run.

Values: “scheduled” | “executing” | “succeeded” | “skipped” | “failed”
“submitfailed”

results

Required string. A result string for this run.

edit_task(task_id, item, cron, task_type, occurences=10, start_date=None, end_date=None, title=None, parameters=None)

This operation allows you to edit and update the properties of a preexisting task (CleanGPJobs, BackupRetentionCleaner at 10.9.1, and CreateBackup at 10.9.1). Updates that have been made to a task will go into effect during its next scheduled execution.

Parameter

Description

task_id

Required String. The task to edit.

item

Required Item. The item to schedule a task on.

cron

Required String. The CRON statement. This should be in the from of:

<minute> <hour> <day of month> <month> <day of week>

Example to run a task weekly, use: 0 0 * * 0

task_type

Required String. The type of task, either executing a notebook or updating an Insights workbook, that will be executed against the specified item. For notebook server tasks use: ExecuteNotebook, for Insights notebook use: UpdateInsightsWorkbook. Use ExecuteSceneCook to cook scene tiles. Use ExecuteWorkflowManager to run workflow manager tasks.

occurences

Optional Integer. The total number of instance that can run at a single time.

start_date

Optional Datetime. The begin date for the task to run.

start_date

Optional Datetime. The end date for the task to run.

title

Optional String. The title of the scheduled task.

parameters

Optional Dict. Optional collection of Key/Values that will be given to the task. The dictionary will be added to the task run request. This parameter is required for ExecuteSceneCook tasks.

Example

``` {

“service_url”: <scene service URL>, “num_of_caching_service_instances”: 2, //2 instances are required “layer”: “{<list of scene layers to cook>}”, //The default is all layers “update_mode”: “PARTIAL_UPDATE_NODES”

enable_task(task_id)

This operation enables a previously disabled task, setting its taskState to active.

Parameter

Description

task_id

Required string. The task to enable

run(task_id, run_id)

This resource returns information on a specific run for a task.

Parameter

Description

task_id

Required string. The task to get the run from.

run_id

Required string. The run to get.

runs(task_id)

This resource returns a list of all runs that have been completed for a specific task.

Parameter

Description

task_id

Required string.

task(task_id)

This operation returns information on a specific task, such as the task’s title, parameters, and schedule.

Parameter

Description

task_id

Required String. The specific task to get.

UpgradeManager

class arcgis.gis.kubernetes.UpgradeManager(url, gis)

Bases: _BaseKube

available()

This operation returns the version manifest, a cumulative list of release and patch versions that have been made available to an ArcGIS Enterprise organization.

Returns:

Dict[str, List]

property history

Returns the transaction history for all upgrade and rollback jobs.

Returns:

Dict[str, Any]

import_manifest(manifest)

The importManifest operation allows organization administrators to import the version manifest into a disconnected environment that can be used to discover available updates and releases and upgrade an ArcGIS Enterprise on Kubernetes deployment. The version manifest must be downloaded from My Esri, which requires an initial internet connection.

Parameter

Description

manifest

Required String. The file containing the version manifest (.dat file), used to discover available updates or releases for an ArcGIS Enterprise on Kubernetes deployment.

Returns:

dict

property installed_updates

Returns a cumulative list of patches and releases that are installed in the deployment

Returns:

List[Dict[str, Any]]

rollback(version, settings=None)

This operation uninstalls a patch, removing the updates and fixes that had been applied to specific containers, and restoring the deployment to a previous, user-specified version of the software. The rollback operation cannot be performed for release-based updates.

Parameter

Description

version

Required Dict[str, str]. The version of the deployment the operation will rollback towards. This value can be retrieved from the rollback_options.

settings

Optional Dict[str, str]. A configuration for patch settings. This is only available at 10.9.1+.

Returns:

Dict[str, Any]

property rollback_options

Returns a list of possible rollback options for the site, depending on the patch that is installed. The ID for the specific rollback version is passed as input for the rollback operation.

Returns:

List[Dict[str, Any]]

upgrade_settings(upgrade_id)

The getUpgradeSettings operation returns the required upgrade settings, and their expected formats, needed for a specific release, applicable to ArcGIS Enterprise on Kubernetes versions 11.0 and later. These settings must be passed through as values for the upgradeSettings parameter to successfully upgrade an ArcGIS Enterprise on Kubernetes deployment. Some upgrade settings may require their value property to be modified before being submitted as part of the upgrade operation. For example, when upgrading an ArcGIS Enterprise on Kubernetes deployment from version 10.9.1 to 11.0, you will need to modify the value property for the licenseUpload JSON object.

upgrades(version_manifest, settings, manifest_file=None)

The upgrade operation upgrades, through either a patch or a release, an ArcGIS Enterprise on Kubernetes deployment to the current version.

Before performing an upgrade, the unique ID associated with the patch or release must be retrieved from the version manifest using the available operation. The version manifest is a JSON array of version objects that contain update-specific information, including a JSON array of container objects that specify affected containers and include their name, checksum, and image values.

Once the ID has been retrieved, you must also retrieve the required upgrade settings that will be passed through as part of the upgrade operation. Some settings will require user input before they can be used during an upgrade. For more information about current upgrade settings, see the Upgrade settings section below.

Once the upgrade job request has been submitted, the deployment will either install a new patch on the base version or upgrade the entire deployment to the latest release. While the job is running, the upgrades resource will return detailed, real-time job messages and status information. The upgrades resource’s child operations and resources will remain inaccessible for the duration of the upgrade.

Parameter

Description

version_manifest

Optional Dict[str, str]. The unique ID associated with a patch or release. You can get the version manifest ID for a patch or release from the JSON view of the available operation.

settings

Optional Dict[str, str]. A JSON object containing details for release upgrade settings. These settings, retrieved from the getUpgradeSettings operation, must be included in the request for the upgrade to be successful. Currently, the object supports the following three upgrade settings: updateToLatestPatch, licenseUpload, and volumesConfig. These settings are applicable to ArcGIS Enterprise on Kubernetes versions 11.0 and later.

manifest_file

Optional String. The file containing the version manifest.

Returns:

Dict[str, Any]

property version

Returns the current version for a deployment. When an patch or release is installed, this resource will update to reflect the information included in the update’s version object as well as the job messages recorded during the upgrade process.

Uploads

class arcgis.gis.kubernetes.Uploads(url, gis, initialize=False)

Bases: _BaseKube

This resource is a collection of all the items that have been uploaded to the kubernetes site.

There are two ways to upload items. You can upload complete items using the Upload Item operation. If a particular item is made up of many chunks (parts), you need to first register the item and subsequently upload the individual parts using the Upload Part operation. Item uploads are filtered by a whitelist of filename extensions. This is the default list: soe, sd, sde, odc, csv, txt, zshp, kmz. The default list can be overridden by setting the uploadFileExtensionWhitelist property with the kubernetes site properties API.

commit(item_id, parts=None)

Use this operation to complete the upload of all the parts that make an item. The parts parameter indicates to the kubernetes site all the parts that make up the item.

Parameter

Description

item_id

Required string. Item ID to commit.

parts

Optional list. An optional comma-separated ordered list of all the parts that make the item. If this parameter is not provided, the default order of the parts is used.

Returns:

Boolean

delete(item_id)

Deletes the uploaded item and its configuration.

Parameter

Description

item_id

Required string. unique ID of the item

Returns:

boolean

download(item_id)

Downloads a previously uploaded file.

Parameter

Description

item_id

Required string. unique ID of the item

Returns:

str

item(item_id)

This resource represents an item that has been uploaded to the kubernetes site. Various workflows upload items and then process them on the kubernetes site. For example, when publishing a GIS service from ArcGIS for Desktop or ArcGIS kubernetes site Manager, the application first uploads the service definition (.SD) to the kubernetes site and then invokes the publishing geoprocessing tool to publish the service. Each uploaded item is identified by a unique name (item_id). The pathOnkubernetes site property locates the specific item in the ArcGIS kubernetes site system directory. The committed parameter is set to true once the upload of individual parts is complete.

Parameters:
item_id:

uploaded id identifier

upload(path, description=None)

Uploads a new item to the kubernetes site. Once the operation is completed successfully, the JSON structure of the uploaded item is returned.

Parameter

Description

path

Required string. The file location to upload

description

Optional string. Description of the upload.

Returns:

boolean

upload_by_part(item_id, part_number, part)

Uploads a new item to the kubernetes site. Once the operation is completed successfully, the JSON structure of the uploaded item is returned.

Parameter

Description

item_id

Required string. Item ID to upload to.

part_number

Required int. An integer value associated with the part.

part

Required string. File path to the part to upload.

Returns:

dict

property uploads

returns a collection of all the items that have been uploaded to the kubernetes site.

There are two ways to upload items. You can upload complete items using the Upload Item operation. If a particular item is made up of many chunks (parts), you need to first register the item and subsequently upload the individual parts using the Upload Part operation. Item uploads are filtered by a whitelist of filename extensions. This is the default list: soe, sd, sde, odc, csv, txt, zshp, kmz. The default list can be overridden by setting the uploadFileExtensionWhitelist property with the kubernetes site properties API.

UsageStatistics

class arcgis.gis.kubernetes.UsageStatistics(url, gis)

Bases: object

Provides access to the metrics viewer and metrics API tools. As an administrator, you can use these tools to monitor GIS service usage in your organization for feature services, map services, tiled map services, geocode services, and geometry services. Information that can be gathered from service usage statistics include:

  • Historical service usage data

  • Peak and off-peak periods of service usage

  • Slowdown in response times or throughput

property properties

returns the properties of the resource

update_credentials(resource, username, password)

Updates the credentials for the metrics viewer and metrics API.

Parameter

Description

resource

Required String. Specifies whether the updated credentials will be applied to the metrics viewer (grafana) or the metrics API (prometheus).

Values: grafana or prometheus

username

Required String. The new username for the specified metrics resource.

password

Required String. The new password for the metrics resource. The new password must be a minimum of eight characters and must contain at least one letter (A-Z, a-z), one number (0-9), and one special character.

Returns:

boolean

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