This module, the most important in the ArcGIS API for Python, ... The clone_items method is used to clone content to the GIS by creating new Item objects.
ArcGISAPIforPythonAPIReferenceHomeSamplesAPIReferenceMenuarcgis.gismoduleGISItemUserGroupDatastoreRoleLayerGroupApplicationCategorySchemaManagerContentManagerUserManagerGroupManagerGroupMigrationManagerDatastoreManagerRoleManagerResourceManagerAPIKeyManagerAPIKeyProfileManagerInvitationManagerCertificateManagerPortalDataStoreSubmodulesarcgis.envmodulearcgis.featuresmodulearcgis.rastermodulearcgis.networkmodulearcgis.geoanalyticsmodulearcgis.geocodingmodulearcgis.geoenrichmentmodulearcgis.geometrymodulearcgis.geoprocessingmodulearcgis.graphmodulearcgis.mappingmodulearcgis.realtimemodulearcgis.schematicsmodulearcgis.widgetsmodulearcgis.appsmodulearcgis.learnmodulearcgis.authpackageNavigationMenuarcgis.gismodule
ThegismoduleprovidesaninformationmodelforGIShosted
withinArcGISOnlineorArcGISEnterprise,servingasanentrypointtotheGIS.
Thismodule,themostimportantintheArcGISAPIforPython,providesfunctionalitytomanage
(create,read,updateanddelete)GISusers,groupsandcontent.ThemoduleallowsforaccesstotheGISservicesusing
PythonandisaninvaluabletoolintheAPI.
GIS¶
classarcgis.gis.GIS(url=None,username=None,password=None,key_file=None,cert_file=None,verify_cert=True,set_active=True,client_id=None,profile=None,**kwargs)¶
TheGISclassisrepresentativeofasingleArcGISOnlineorganizationoranArcGISEnterprisedeployment.
TheGISobjectprovideshelperobjectstomanage(search,create,retrieve)GISresourcessuchascontent,users,
andgroups.
Additionally,theGISobjecthaspropertiestoqueryitsstate,whichisaccessibleusingthepropertiesattribute.
Note
TheGISprovidesamappingwidgetthatcanbeusedintheJupyterNotebookenvironmentforvisualizingGIScontent
aswellastheresultsofyouranalysis.Tocreateanewmap,callthemapmethod.
IE11isnolongersupported.PleaseusethelatestversionofGoogleChrome,MozillaFirefox,
AppleSafari,orMicrosoftEdge.
TheconstructorconstructsaGISobjectgivenaurlandusercredentialstoArcGISOnline
oranArcGISEnterpriseportal.Usercredentialscanbepassedinusingusername/password
pair,orkey_file/cert_filepair(incaseofPKI).Supportsbuilt-inusers,LDAP,PKI,IntegratedWindowsAuthentication
(usingNTLMandKerberos)andAnonymousaccess.
Ifnourlisprovided,ArcGISOnlineisused.Ifusername/password
orkey/certfilesarenotprovided,thecurrentlylogged-inuser’scredentials(IWA)oranonymousaccessisused.
PersistedprofilesfortheGIScanbecreatedbygivingtheGISauthorizationcredentialsand
specifyingaprofilename.Theprofilestoresalloftheauthorizationcredentials(exceptthepassword)inthe
user’shomedirectoryinanunencryptedconfigfilenamed.arcgisprofile.Theprofilesecurelystoresthepassword
inanO.S.specificpasswordmanagerthroughthekeyringpythonmodule.
Note
Linuxsystemsmayneedadditionalsoftwareinstalledandconfiguredforpropersecurity.
Onceaprofilehasbeensaved,passingtheprofileparameterbyitselfusestheauthorizationcredentialssaved
intheconfigurationfile/passwordmanagerbythatprofilename.Multipleprofilescanbecreatedandusedin
parallel.
SeeWorkingwithdifferentauthenticationschemes
intheArcGISAPIforPythonguideforexamples.
Argument
Description
url
Optionalstring.IfURLisNone,thentheURLwillbeArcGIS
Online.ThisshouldbeawebaddresstoeitheranArcGISEnterpriseportal
ortoArcGISOnlineintheform:
:///.AnEnterpriseexampleisformattedin
theform:https://gis.example.com/portal
username
Optionalstring.Theloginusername(case-sensitive).
password
Optionalstring.Ifausernameisprovided,apasswordis
expected.Thisiscase-sensitive.Ifthepasswordisnot
provided,theuserispromptedintheinteractivedialog.
key_file
Optionalstring.Thefilepathtoauser’skeycertificateforPKI
authentication
cert_file
Optionalstring.Thefilepathtoauser’scertificatefileforPKI
authentication.IfaPFXorP12certificateisused,apasswordisrequired.
IfaPEMfileisused,thekey_fileisrequired.
verify_cert
Optionalboolean.IfasitehasaninvalidSSLcertificateoris
beingaccessedviatheIPorhostnameinsteadofthenameonthe
certificate,setthisvaluetoFalse.Thiswillensurethatall
SSLcertificateissuesareignored.
ThedefaultisTrue.
Warning
SettingthevaluetoFalsecanbeasecurityrisk.
set_active
Optionalboolean.ThedefaultisTrue.IfTrue,theGISobject
willbeusedasthedefaultGISobjectthroughoutthewhole
scriptingsession.
client_id
Optionalstring.UsedforOAuthauthentication.Thisisthe
clientIDvalue.
profile
Optionalstring.thenameoftheprofilethattheuserwishestouse
toauthenticate,ifset,theidentifiedprofilewillbeusedtologin
tothespecifiedGIS.
Inadditiontoexplicitlynamedparameters,theGISobjectsupportsoptionalkeyword
arguments:
kwargs
Description
proxy_host
Optionalstring.ThehostnameoftheproxyserverusedtoallowHTTP/S
accessinthenetworkwherethescriptisrun.
ex:127.0.0.1
use_gen_token
OptionalBoolean.ThedefaultisFalse.Forolder
Enterprises,theBUILT-INuserscanspecifyusingthe
generateTokenendpointforcreatingthetoken.
proxy_port
Optionalinteger.Theproxyhostport.Thedefaultis80.
token
Optionalstring.ThisistheEnterprisetokenforbuilt-in
logins.Thisparameterisonlyhonorediftheusername/password
isNoneandthesecurityforthesiteusesBUILT-INsecurity.
api_key
Optionalstring.Thisisakeygeneratedbythedevelopersite
toallowforalimitedsubsetoftheRESTAPIfunctionality.
trust_env
OptionalBoolean.Trustenvironmentsettingsforproxy
configuration,defaultauthenticationandsimilar.IfFalse
theGISclasswillignorethenetrcfilesdefinedonthe
system.
proxy
OptionalDictionary.Ifyouneedtouseaproxy,youcan
configureindividualrequestswiththeproxyargumenttoany
requestmethod.See`UsageExmaple9:UsingaProxy`for
exampleusage.
UsageExample
{“http”:“http://10.343.10.22:111”,
“https”:“https://127.343.13.22:6443”
}
expiration
OptionalInteger.Thedefaultis60minutes.Theexpiration
timeforagiventoken.Thisisusedforuserprovidedtokens
andAPIKeys.
validate_url
OptionalBoolean.ThedefaultisFalse.Ausercanchooseto
validatetheURLonanItem’surl.
#UsageExample1:AnonymousLogintoArcGISOnline
gis=GIS()
#UsageExample2:Built-inLogintoArcGISOnline
gis=GIS(username="someuser",password="secret1234")
#UsageExample3:Built-inLogintoArcGISEnterprise
gis=GIS(url="http://pythonplayground.esri.com/portal",
username="user1",password="password1")
#UsageExample4:Built-inLogintoArcGISEnterprise,ignoringSSLerrors
gis=GIS(url="http://pythonplayground.esri.com/portal",username="user1",
password="password1",verify_cert=False)
#UsageExample5:AnonymousArcGISOnlineLoginwithProxy
gis=GIS(proxy_host='127.0.0.1',proxy_port=8888)
#UsageExample6:PKILogintoArcGISEnterprise,usingPKCS12usercertificate
gis=GIS(url="https://pkienterprise.esri.com/portal",
cert_file="C:\users\someuser\mycert.pfx",password="password1")
#UsageExmaple7:Loginwithtoken(actualtokenabbreviatedforthisillustration)
gis=GIS(token="3G_e-FSoJdwxBgSA0RiOZg7zJVVqlOG-ENw83UtoUzDdz4..._L2aQMrthrEq7vKYBn39HGSc.",
referer="https://www.arcgis.com")
#UsageExmaple8:LoginwithAPIKey(actualtokenabbreviatedforthisillustration)
gis=GIS(api_key="APKSoJdwxBgSA0RiOZg7zJVVqlOG-ENw83UtoUzDdz4..._L2aQMrth39HGSc.",
referer="https")
#UsageExmaple9:UsingaProxy
proxy={
'http':'http://10.10.1.10:3128',
'https':'http://10.10.1.10:1080',
}
gis=GIS(proxy=proxy)
propertyapi_keys¶
Theapi_keyspropertyreturnsaninstanceofAPIKeyManagerobjectwhichallows
theUsertogenerate,manageandmodifyAPIKeysforcontrolledapplicationaccess.
Note
TheAPIKeymanagerisonlyavailableforArcGISOnline
Returns
AnAPIKeyManagerobject
propertycontent¶
ThecontentpropertyistheresourcemanagerforGIScontent.SeeContentManagerfor
moreinformation.
propertydatastore¶
ThedatastorepropertyistheresourcemanagerforGISdatastores.
..note:
ThisisonlyavailablewithArcGISEnterprise10.7+.
See:class:`~arcgis.gis._impl._datastores.PortalDataStore`formoreinformation.
Returns
APortalDataStoreobject
propertygroups¶
ThegroupspropertyisresourcemanagerforGISgroups.SeeGroupManagerformore
information.
propertyhosting_servers¶
ReturnsthehostingserversfortheGIS
Returns
list
propertyhub¶
ThehubpropertyistheresourcemanagerforGIShub.SeeHubformoreinformation.
propertylanguages¶
Liststheavailablelanguages.
Returns
List[Dict[str,Any]]
map(location=None,zoomlevel=None,mode='2D',geocoder=None)¶
Themapmethodcreatesamapwidgetcenteredatthedeclaredlocationwiththespecified
zoomlevel.Ifanaddressisprovided,itisgeocoded
usingtheGIS’sconfiguredgeocoders.Providedamatchisfound,thegeographic
extentofthematchedaddressisusedastheextentofthemap.Ifazoomlevelisalso
provided,themapiscenteredatthematchedaddressinsteadandthemapiszoomed
tothespecifiedzoomlevel.SeeMapViewformoreinformation.
Note
ThemapwidgetisonlysupportedwithinaJupyterNotebook.IE11isnolongersupported.
PleaseusethelatestversionofGoogleChrome,MozillaFirefox,AppleSafari,orMicrosoftEdge.
Argument
Description
location
Optionalstring.Theaddressorlat-longtupleofwherethemapistobecentered.
zoomlevel
Optionalinteger.Thedesiredzoomlevel.
mode
Optionalstringofeither‘2D’or‘3D’tospecifymapmode.Defaultsto‘2D’.
geocoder
OptionalGeocoder.Allowsuserstospecifyageocodertofindagivenlocation.
SeetheUnderstandinggeocoders
pageintheArcGISAPIforPythonguideformoreinformation.
Note
IftheJupyterNotebookserverisrunningoverhttp,youneedto
configureyourArcGISEnterpriseportalorArcGISOnlineorganizationtoallowyourhostandport;orelse
youwillrunintoCORSissueswhendisplayingthismapwidget.
ThiscanbeaccomplishedbysigningintoyourArcGISEnterpriseportalorArcGISOnlineorganizationina
browser,thennavigatingto:
Organization>Settings>Security>Alloworigins>Add>http://localhost:8888
(replacewiththehost/portyouarerunningon)
#UsageExample
>>>gis=GIS(url="http://pythonplayground.esri.com/portal",username="user1",password="password1")
>>>gis.map("Durham,NC")
Returns
Amapwidget(thewidgetisdisplayedinJupyterNotebookwhenqueried).
propertynotebook_server¶
Thenotebook_serverpropertyprovidesaccesstotheNotebookServerregistered
withtheorganizationorenterprise.
:return:List[NotebookServer]
propertyorg_settings¶
Theportalsettingsresourceisusedtoreturnaviewofthe
portal’sconfigurationasseenbythecurrentusers,either
anonymousorloggedin.Informationreturnedbythisresource
includeshelperservices,allowedredirectURIs,andthecurrent
configurationforanyaccessnoticesorinformationbanners.
Parameters
Description
settings
RequiredDict.Adictionaryofthesettings
Fields
Description
anonymousAccessNotice
Dict.AJSONobjectrepresentinganoticethatisshowntoyourorganization’sanonymoususers.
Ex:{‘title’:‘AnonymousAccessNoticeTitle’,‘text’:‘AnonymousAccessNoticeText’,‘buttons’:‘acceptAndDecline’,‘enabled’:True}
authenticatedAccessNotice
Dict.AJSONobjectrepresentinganoticethatisshowntoyourorganization’sauthenticatedusers.
Ex:{‘title’:‘AuthenticatedAccessNoticeTitle’,‘text’:‘AuthenticatedAccessNoticeText’,‘buttons’:‘okOnly’,‘enabled’:True}
informationalBanner
Dict.AJSONobjectrepresentingtheinformationalbannerthatisshownatthetopofyourorganization’spage.
Ex:{‘text’:‘HeaderText’,‘bgColor’:‘grey’,‘fontColor’:‘blue’,‘enabled’:True}
clearEmptyFields
Bool.IfTrue,anyemptydictionarywillbesettonull.
Returns
Dictionaryindicating‘success’or‘error’
propertyproperties¶
propertiesmanagestheactualpropertiesoftheGISobject.
propertyregions¶
Liststheavailableregions.
Returns
List[Dict[str,Any]]
propertyservers¶
ReturnstheserversregisteredwithArcGISEntperise.ForArcGIS
Online,thereturnvalueisNone.
Returns
dict
propertysites¶
ThesitespropertyistheresourcemanagerforEnterpriseSites.Seesitesformoreinformation.
update_properties(properties_dict)¶
Theupdate_propertiesmethodupdatestheGIS’spropertiesfromthoseinproperties_dict.Thismethod
canbeusefulforupdatingtheutilityservicesusedbytheGIS.
Argument
Description
properties_dict
Requireddictionary.Adictionaryofjustthosepropertiesand
valuesthataretobeupdated.
Returns
Abooleanindicatingsuccess(True),orfailure(False)
Note
Forexamplesofthepropertynamesandkey/valuestousewhenupdatingutilityservices,
refertotheCommonparameters
pageintheArcGISRESTAPI.
#UsageExample:Updatethegeocodeservice
gis=GIS(profile='xyz')
upd={'geocodeService':[{
"singleLineFieldName":"SingleLineInput",
"name":"AtlantaLocator",
"url":"https://some.server.com/server/rest/services/GeoAnalytics/AtlantaLocator/GeocodeServer",
"itemId":"abc6e1fc691542938917893c8944606d",
"placeholder":"",
"placefinding":"true",
"batch":"true",
"zoomScale":10000}]}
gis.update_properties(upd)
propertyurl¶
Theurlpropertyisaread-onlyURLofyourGISconnection.
propertyusers¶
TheuserspropertyistheresourcemanagerforGISusers.SeeUserManagerformore
information.
propertyvelocity¶
TheresourcemanagerforArcGISVelocity.SeeVelocity
:return:Velocity
propertyversion¶
TheversionpropertyreturnstheGISversionnumber
Item¶
classarcgis.gis.Item(gis,itemid,itemdict=None)¶
Bases:dict
TheItemclassrepresentsanitemintheGIS,whereanitemissimplyconsideredaunitofcontentintheGIS.
Eachitemhasauniqueidentifierandawell-knownURLthatisindependentoftheuserowningtheitem.
Additionally,eachitemcanhaveassociatedbinaryortextualdatathat’savailableviatheitemdataresource.
Forexample,anitemoftypeMapPackagereturnstheactualbitscorrespondingtothe
mappackageviatheitemdataresource.
Itemsthathavelayers(egFeatureLayerCollectionitemsandImageryLayeritems)andtableshave
thedynamiclayersandtablespropertiestogettotheindividuallayers/tablesinthisitem.
add_comment(comment)¶
Theadd_commentmethodaddsacommenttoanitem.
Note
Theadd_commentmethodisonlyavailableonlytoauthenticateduserswhohaveaccesstotheitem.
Argument
Description
comment
Requiredstring.Texttobeaddedasacommenttoaspecificitem.
Returns
CommentIDifsuccessful,Noneiffailureoccurs.
#UsageExample
>>>item.add_comment("DetailedCommentontheItem")
add_relationship(rel_item,rel_type)¶
Theadd_relationshipmethodaddsarelationshipfromthecurrentitemtorel_item.
Note
Note:Relationshipsarenottiedtoanitem.Instead,theyaredirectionallinksfromanoriginitem
toadestinationitemandhaveatype.Thetypeoftherelationshipdefinesthevalidoriginanddestination
itemtypesaswellassomerules.SeeRelationshiptypesinRESTAPIhelpformoreinformation.
Usersdon’thavetoowntheitemstheyrelateunlesssodefinedbytherulesoftherelationship
type.
Userscanonlydeleterelationshipstheycreate.
Relationshipsaredeletedautomaticallyifoneofthetwoitemsisdeleted.
Argument
Description
rel_item
RequiredItemobjectcorrespondingtotherelateditem.
rel_type
Requiredstring.Thetypeoftherelateditem;isoneof
[‘Map2Service’,‘WMA2Code’,‘Map2FeatureCollection’,‘MobileApp2Code’,
‘Service2Data’,‘Service2Service’].See
RelationshipTypesintheRESTAPIhelp
formoreinformationonthisparameter.
Returns
Abooleanindicatingsuccess(True),orfailure(False)
#UsageExample
>>>item.add_relationship(reL_item=item2,rel_type='Map2FeatureCollection')
propertyapp_info¶
Theapp_infopropertyisaresourceforaccessingapplicationinformation.Iftheparentitemisregistered
usingtheregisterappoperation,app_inforeturnsinformationpertainingtotheregisteredapp.
EveryregisteredappgetsanAppIDandAppSecret,whicharetitledclient_idandclient_secret,respectively,
intheterminologyofOAuth.
Returns
ADictionary
propertycan_delete¶
ChecksiftheItemcanberemovedfromthesystem.
Returns
bool
propertycomments¶
Thecommentspropertygetsalistofcommentsforagivenitem.
propertycontent_status¶
Thecontent_statuspropertystatesifanItemisauthoritativeordeprecated.This
givensownersandadministratorsofItemtheabilitytowarnusersthatthey
shouldbeeitherthisinformationornot.
Argument
Description
value
OptionalstringorNone.DefinesifanItemisdeprecatedor
authoritative.
IfavalueofNoneisgiven,thenthevaluewillbereset.
AllowedValues:authoritative,deprecated,orNone
copy(title=None,tags=None,snippet=None,description=None,layers=None)¶
ThecopymethodallowsforthecreationofanitemthatisderivedfromthecurrentItem.
Forlayers,copywillcreateanewitemthatusestheURLasareference.
Fornon-layerbaseditems,thesewillbecopiedandtheexactsamedatawillbe
provided.
Iftitle,tags,snippetofdescriptionisnotprovidedthevaluesfromitemwillbeused.
Thecopymethodcanbeusedinavarietyofsituations,suchas:
Vectortileservicespritecustomization
Limitingfeatureserviceexposure
Sharingcontentbyreferencewithgroups
Creatingbackupitems.
Argument
Description
title
Optionalstring.Thenameofthenewitem.
tags
Optionallistofstring.Descriptivewordsthathelpinthe
searchingandlocatingofthepublishedinformation.
snippet
Optionalstring.Abriefsummaryoftheinformationbeing
published.
description
Optionalstring.AlongdescriptionoftheItembeing
published.
layers
Optionallistofintegers.Ifyouhavealayerwithmultiple
andyouonlywantspecificlayers,anindexcanbeprovided
thoselayers.Ifnothingisprovided,alllayerswillbe
visible.
Returns
AnItemobject
**UsageExample**
>>>item.copy()
>>>item.copy(title="GIS_Tutorial")
>>>item.copy()
copy_feature_layer_collection(service_name,layers=None,tables=None,folder=None,description=None,snippet=None,owner=None)¶
Thecopy_feature_layer_collectionmethodallowsuserstocopyexistingFeatureLayerCollectionsandselect
thelayers/tablesthattheuserwantsintheservice.Itisquitesimilartothecopymethod,butonly
copiestheselectedFeatureLayerCollections.
Argument
Description
service_name
Requiredstring.Itisthenameoftheservice.
layers
Optionallist/string.Thisisaeitheralistofintegersoracomma
seperatedlistofintegersasastring.Eachindexvaluerepresents
alayerinthefeaturelayercollection.
tables
Optionallist/string.Thisisaeitheralistofintegersoracomma
seperatedlistofintegersasastring.Eachindexvaluerepresents
atableinthefeaturelayercollection.
folder
Optionalstring.Thisisthenameofthefoldertoplacein.The
defaultisNone,whichmeanstherootfolder.
description
Optionalstring.ThisistheItemdescriptionoftheservice.
snippet
Optionalstring.ThisistheItem’ssnippetoftheservice.Itis
nolongerthan250characters.
owner
Optionalstring/User.Thedefaultisthecurrentuser,butifyou
wanttheservicetobeownedbyanotheruser,passinthisvalue.
Returns
Ifsuccessful,returnsanItemobject.Otherwise,returnsNoneonfailure.
#UsageExample
>>>item.copy_feature_layer_collection(service_name="service_name",layers="1,4,5,8")
copy_item(*,title=None,tags=None,folder=None,include_resources=False,include_private=False)¶
Thecopy_itemoperationcreatesanewItemthatisacopyoftheoriginal
Itemontheserverside.Itis
quitesimilartothecopymethod,butonlycreatesanewItem.
Thecopy_itemmethodisallowedforthefollowing:
Originalitembeingcopiedisownedbytheuserinvokingthecopyoperation.
TheUserobjectisanadministrator.
TheUserobjecthasitemControlupdatecapability.
Additionally,thereareseveralcaveatstothecopy_itemmethod.First,thenewitemcreatedbythe
copy_itemoperationwillhaveasystemgenerateditemID.Additionally,hostedservicesarecopiedas
referenceonly.Reservedkeywords,ratings,views,commentsandlistingpropertiesareresetforthenewitem.
Sharingaccessoftheoriginalitemisnotpreservedandsharingaccessofnewitemissettoprivate.
Lastly,relationshipsanddependenciesoftheoriginalitemarenotmaintainedinthenewitem.
Note
ThismethodisonlyavailableonArcGISOnlineorArcGISEnterprise10.9orhigher
Argument
Description
title
Optionalstring.Thetitleofthedestinationitem.Ifnotspecified,titleoftheoriginalitemisused.
tags
OptionalString.Newsetoftags(commaseparated)ofthedestinationitem.
folder
OptionalString.FolderIdofthedestinationitem.IfthefolderIdisnotspecified,thentheitemremainsinthesamefolder.
Iftheadministratorinvokesacopyofanitembelongingtoanotheruser,anddoesnotspecifythefolderId,theitemgetscreatedintherootfolderoftheadministrator.
include_resources
Optionalboolean.Iftrue,thefileresourcesoftheoriginal
itemwillbecopiedovertothenewitem.Privatefileresources
willnotbecopiedover.Iffalse,thefileresourcesofthe
originalitemwillnotbecopiedovertothenewitem.The
defaultisfalse.
include_private
Iftrue,andifinclude_resourcesissettotrueaswell,then
theprivateresourcesoftheoriginalitemwillbecopiedoverto
thenewitem.Iffalse,theprivatefileresourcesoftheoriginal
itemwillnotbecopiedovertothenewitem.Thedefaultisfalse.
Returns
AnItemobject
create_thumbnail(update=True)¶
Thecreate_thumbnailmethodcreatesaThumbnailforafeatureserviceportalitemusingtheservice’s
symbologyandtheprintserviceregisteredfortheenterprise.
Argument
Description
update
Optionalboolean.WhensettoTrue,theitemwillbeupdatedwiththe
thumbnailgeneratedinthiscall,elseitwillnotupdatetheitem.
ThedefaultisTrue.
Returns
ADataFileobject
create_tile_service(title,min_scale,max_scale,cache_info=None,build_cache=False)¶
Thecreate_tile_servicemethodallowspublishersandadministratorstopublishhostedfeature
layersandhostedfeaturelayerviewsasatileservice.
Argument
Description
title
Requiredstring.Thenameofthenewservice.
min_scale
Requiredfloat.Thesmallestscaleatwhichtoviewdata.
max_scale
Requiredfloat.Thelargestscaleatwhichtoviewdata.
cache_info
Optionaldictionary.Ifnotnone,administratorprovidesthe
tilecacheinfofortheservice.ThedefaultistheArcGISOnlinescheme.
build_cache
Optionalboolean.DefaultisFalse;ifTrue,thecachewillbe
builtatpublishingtime.Thiswillincreasethetimeittakes
topublishtheservice.
Returns
TheItemobjectifsuccessfullyadded,Noneifunsuccessful.
#UsageExample
>>>item.create_tile_service(title="SeasideHeightsNJTiles",min_scale=70000.0,max_scale=80000.0)
delete(force=False,dry_run=False)¶
Thedeletemethoddeletestheitem.Iftheitemisunabletobedeleted,aRuntimeExceptionisraised.
Toknowifyoucansafelydeletetheitem,usetheoptionalparameter‘dry_run’inordertotesttheoperation
withoutactuallydeletingtheitem.
Argument
Description
force
Optionalboolean.AvailableinArcGISEnterprise10.6.1andhigher.
Forcedeletionisapplicableonlytoitemsthatwereorphanedwhen
aserverfederatedtotheArcGISEnterprisewasremovedaccidentally
beforeproperlyunfederatingit.Whencalledonotheritems,ithas
noeffect.
dry_run
Optionalboolean.AvailableinArcGISEnterprise10.6.1andhigher.If
True,checksiftheitemcanbesafelydeletedandgivesyouback
eitheradictionarywithdetails.Ifdependentitemsarepreventing
deletion,alistofsuchItemobjectsareprovided.
Returns
Abooleanindicatingsuccess(True),orfailure(False).Whendry_runisused,adictionarycontaining
detailsoftheitemisreturned.
USAGEEXAMPLE:Successfuldeletionofanitem
item1=gis.content.get('itemId12345')
item1.delete()
>>True
USAGEEXAMPLE:Faileddeletionofanitem
item1=gis.content.get('itemId12345')
item1.delete()
>>RuntimeError:Unabletodeleteitem.ThisserviceitemhasarelatedServiceitem
>>(ErrorCode:400)
USAGEEXAMPLE:Dryruntocheckdeletionofanitem
item1=gis.content.get('itemId12345abcde')
item1.delete(dry_run=True)
>>{'can_delete':False,
>>'details':{'code':400,
>>'message':'Unabletodeleteitem.ThisserviceitemhasarelatedServiceitem',
>>'offending_items':[]}}
Note
Duringthedryrun,ifyoureceivealistofoffendingitems,attempttodeletethemfirstbeforedeleting
thecurrentitem.Youcaninturncalldry_runonthoseitemstoensuretheycanbedeletedsafely.
delete_rating()¶
Thedelete_ratingmethodremovestheratingthecallinguseraddedforthespecifieditem.
delete_relationship(rel_item,rel_type)¶
Thedelete_relationshipmethoddeletesarelationshipbetweenthisitemandtherel_item.
Argument
Description
rel_item
RequiredItemobjectcorrespondingtotherelateditem.
rel_type
Requiredstring.Thetypeoftherelateditem;isoneof
[‘Map2Service’,‘WMA2Code’,‘Map2FeatureCollection’,‘MobileApp2Code’,
‘Service2Data’,‘Service2Service’].See
RelationshipTypesintheRESTAPIhelp
formoreinformationonthisparameter.
Returns
Abooleanindicatingsuccess(True),orfailure(False)
#UsageExample
item.delete_relationship(item2,'Map2FeatureCollection')
propertydependencies¶
ThedependenciespropertyreturnsaclasstomanagetheItem’sdependencies
dependent_to()¶
Thedependent_tomethodreturnsitems,urls,etcthataredependenttothisitem.
Note
Thiscapability(itemdependencies)isnotyetavailableonArcGISOnline-Currently,itisavailableonlywithanArcGISEnterprise.
dependent_upon()¶
Thedependent_uponmethodreturnsitems,urls,etcthatthisitemisdependenton.
Note
Thiscapability(itemdependencies)isnotyetavailableonArcGISOnline-Currently,itisavailableonly
withanArcGISEnterprise.
download(save_path=None,file_name=None)¶
Thedownloadmethoddownloadsthedatatothespecifiedfolderoratemporaryfolder,ifafolderisnotprovided.
Argument
Description
save_path
Optionalstring.Folderlocationtodownloadthefileto.
file_name
Optionalstring.Thenameofthefile.
Returns
Thedownloadpathifdatawasavailable,otherwiseNone.
#UsageExample
>>>item.download("C:\ARCGIS\Projects","hurricane_data")
download_metadata(save_folder=None)¶
Thedownload_metadatamethodissimilartothedownloadmethodbutonlydownloadstheitemmetadatafor
thespecifieditemid.Itemswithmetadatahave‘Metadata’intheirtypeKeywords.
Argument
Description
save_folder
Optionalstring.Folderlocationtodownloadtheitem’smetadatato.
Returns
Afilepath,ifthemetadatadownloadwassuccessful.Noneiftheitemdoesnothavemetadata.
download_thumbnail(save_folder=None)¶
Thedownload_thumbnailmethodissimilartothedownloadmethodbutonlydownloadstheitemthumbnail.
Argument
Description
save_folder
Optionalstring.Folderlocationtodownloadtheitem’sthumbnailto.
return
Afilepath,Ifthedownloadwassuccessful.Noneiftheitemdoesnothaveathumbnail.
export(title,export_format,parameters=None,wait=True,enforce_fld_vis=None,tags=None,snippet=None)¶
Theexportmethodisusedtoexportaserviceitemtothespecifiedexportformat.
However,itisavailableonlytouserswithanorganizationalsubscriptionandcanonlybeinvokedbythe
serviceitemowneroranadministrator,unlessaLocationTrackingServiceorLocationTrackingViewisused.
Theexportmethodisusefulforlongrunningexportsthatcouldholdupascript.
Argument
Description
title
Requiredstring.Thedesirednameoftheexportedserviceitem.
export_format
Requiredstring.Theformattoexportthedatato.Allowedtypes:Shapefile,
CSV,FileGeodatabase,FeatureCollection,GeoJson,ScenePackage,KML,
Excel,geoPackage,orVectorTilePackage.
parameters
Optionalstring.AJSONobjectdescribingthelayerstobeexported
andtheexportparametersforeachlayer.andtheexportparametersforeachlayer.See
ExportItem
intheRESTAPIforguidance.
wait
Optionalboolean.DefaultisTrue,whichforcesawaitforthe
exporttocomplete;useFalseforwhenitisokaytoproceedwhile
theexportcontinuestocompletion.
enforce_fld_vis
Optionalboolean.Bedefaultwhenyouaretheownerofanitemand
theexportoperationiscalled,thedataprovidesallthecolumns.
Iftheexportisbeingperformonaview,toensuretheview’s
columndefinitionishonor,thensetthevaluetoTrue.Whenthe
owneroftheserviceandthevalueissettoFalse,alldataand
columnswillbeexported.
tags
OptionalString.Acommaseperatedvalueofitemdescriptors.
snippet
OptionalString.Ashortdescriptivepieceoftext.
Returns
AnItemobjectoradictionary.Itemisreturnedwhenwait=True.
Adictionarydescribingthestatusoftheitemisreturnedwhenwait=False.Seethe
statusmethodformoreinformation.
#UsageExample
>>>item.export("hurricane_data","CSV",wait=True,tags="Hurricane,NaturalDisasters")
get_data(try_json=True)¶
Theget_datamethodretrievesthedataassociatedwithanitem.
Note
Thiscallmayreturndifferentresultsfordifferentitemtypes:someitemtypesmayevenreturnNone.See
Workingwithusers,groups,anditems
intheArcGISRESTAPIformoreinformation.
Argument
Description
try_json
Optionalstring.DefaultisTrue.ForJSON/textfiles,iftry_json
isTrue,themethodtriestoconvertthedatatoaPythondictionary
(usejson.dumps(data)toconvertthedictionarytoastring),
otherwisethedataisreturnedasastring.
Returns
Dependentonthecontenttypeofthedata.
Fornon-JSON/textdata,binaryfilesarereturnedandthepathtothedownloadedfile.
ForJSON/textfiles,aPythondictionaryorastring.Allotherswillbeabytearray,
thatcanbeconvertedtostringusingdata.decode(‘utf-8’).ZerobytefileswillreturnNone.
get_thumbnail()¶
Theget_thumbnailmethodretrievesthebytesthatmakeupthethumbnailforthisitem.
Returns
Bytesthatrepresenttheitem’sthumbnail.
Example
>>>response=item.get_thumbnail()
>>>f=open(filename,'wb')
>>>f.write(response)
get_thumbnail_link()¶
Theget_thumbnail_linkmethodissimilartotheget_thumbnailmethod,butretrievesthelinktothe
item’sthumbnailratherthanthebytesthatmakeupthethumbnailforthisitem.
Returns
Thelinktotheitem’sthumbnail.
propertyhomepage¶
ThehomepagepropertygetstheURLtotheHTMLpagefortheitem.
propertymetadata¶
Themetadatapropertygetsandsetstheitemmetadataforthespecifieditem.
metadatareturnsNoneiftheitemdoesnothavemetadata.
Note
Itemswithmetadatahave‘Metadata’intheirtypeKeywords.
move(folder)¶
Themovemethodmovesthecurrentitemtothenameofthefolderpassedwhenmoveiscalled.
Argument
Description
folder
Requiredstring.Thenameofthefoldertomovetheitemto.
Use‘/’fortherootfolder.Forotherfolders,passinthe
foldernameasastring,oradictionarycontainingthefolderID,
suchasthedictionaryobtainedfromthefoldersproperty.
Returns
Ajsonobjectinthefollowingformat:
{
“success”:true|false,
“itemId”:“”,
“owner”:“”,
“folder”:“”
}
#UsageExample
>>>item.move("C:\Projects\ARCGIS\ArcGis_data")
protect(enable=True)¶
Theprotectmethodenablesordisablesdeleteprotectiononthisitem,essentiallyallowingtheitemtobe
deletedorprotectingitfromdeletion.
Argument
Description
enable
Optionalboolean.DefaultisTruewhichenablesdelete
protection,Falsetodisabledeleteprotection.
Returns
Ajsonobjectinthefollowingformat:
{“success”:true|false}
propertyproxies¶
TheproxiespropertygetstheArcGISOnlinehostedproxyservices,setonaregisteredapp,
itemwiththeRegisteredApptypekeyword.Additionally,thisresourceisonly
availabletotheitemownerandtheorganizationadministrator.
publish(publish_parameters=None,address_fields=None,output_type=None,overwrite=False,file_type=None,build_initial_cache=False,item_id=None,geocode_service=None)¶
Thepublishesmethodisusedtopublishahostedservicebasedonanexistingsourceitem(thisitem).
Publisherscanthencreatefeature,tiledmap,vectortileandsceneservices.
Featureservicescanbecreatedfrominputfilesofvarioustypes,including
csvfiles
shapefiles
servicedefinitionfiles
featurecollectionfiles
filegeodatabasefiles
CSVfilesthatcontainlocationfields(i.e.addressfieldsorXYfields)arespatiallyenabledduringtheprocessofpublishing.
Shapefilesandfilegeodatabasesshouldbepackagedas*.zipfiles.
Tiledmapservicescanbecreatedfromservicedefinition(*.sd)files,tilepackages,andexistingfeatureservices.
Vectortileservicescanbecreatedfromvectortilepackage(*.vtpk)files.
Sceneservicescanbecreatedfromscenelayerpackage(*.spk,*.slpk)files.
ServicedefinitionsareauthoredinArcGISProorArcGISDesktopandcontainboththecartographicdefinitionforamap
aswellasitspackageddatatogetherwiththedefinitionofthegeo-servicetobecreated.
Note
ArcGISdoesnotpermitoverwritingifyoupublishedmultiplehostedfeaturelayersfromthesamedataitem.
Note
ArcGISforEnterpriseforKubernetesdoesnotsupportpublishingservicedefinitionfilegeneratedbyArcMap.
Argument
Description
publish_parameters
Optionaldictionary.containingpublishinstructionsandcustomizations.
Cannotbecombinedwithoverwrite.
SeePublishItem
intheArcGISRESTAPIfordetails.
address_fields
Optionaldictionary.containingmappingofdfcolumnstoaddressfields,
output_type
Optionalstring.Onlyusedwhenafeatureserviceispublishedasatileservice.
overwrite
Optionalboolean.IfTrue,thehostedfeatureserviceisoverwritten.
OnlyavailableinArcGISEnterprise10.5+andArcGISOnline.
file_type
Optionalstring.Someformatsarenotautomaticallydetected,
whenthisoccurs,thefile_typecanbespecified:
serviceDefinition,shapefile,csv,excel,tilePackage,
featureService,featureCollection,fileGeodatabase,geojson,
scenepackage,vectortilepackage,imageCollection,mapService,
andsqliteGeodatabasearevalidentries.Thisisan
optionalparameter.
build_initial_cache
Optionalboolean.Thebooleanvalue(defaultFalse),iftrue
andapplicableforthefile_type,thevaluewillbuiltcache
fortheservice.
item_id
Optionalstring.AvailableinArcGISEnterprise10.8.1+.NotavailableinArcGISOnline.
Thisparameterallowsthedesireditemidtobespecifiedduringcreationwhich
canbeusefulforcloningandautomatedcontentcreationscenarios.
Thespecifiedidmustbea32characterGUIDstringwithoutanyspecialcharacters.
Iftheitem_idisalreadybeingused,anerrorwillberaised
duringthepublishprocess.
geocode_service
OptionalGeocoder.Whenpublishingatableofdata,anoptional
Geocodercanbesuppliedinordertospecifywhichservice
geocodestheinformation.Ifnogeocoderisgiven,thefirst
registeredGeocoderisused.
Returns
AnItemobjectcorrespondingtothepublishedweblayer.
#PublishingaHostedTableExample
>>>csv_item=gis.content.get('')
>>>analyzed=gis.content.analyze(item=csv_item)
>>>publish_parameters=analyzed['publishParameters']
>>>publish_parameters['name']='AVeryUniqueName'#thisneedstobeupdated
>>>publish_parameters['locationType']=None#thismakesitahostedtable
>>>published_item=csv_item.publish(publish_parameters)
#PublishingaTileServiceExample
>>>item.publish(address_fields={"CountryCode":"Country"},
>>>output_type="Tiles",
>>>file_type="CSV",
>>>item_id=9311d21a9a2047d19c0faaebd6f2cca6
>>>)
Note
Forpublish_parameters,seePublishItem
intheArcGISRESTAPIformoredetails.
propertyrating¶
Get/Settheratinggivenbythecurrentusertotheitem.
Setaddsaratingtoanitemtowhichyouhaveaccess-Onlyonerating
canbegiventoanitemperuser.Ifthiscallismadeona
currentlyrateditem,thenewratingwilloverwritetheexisting
rating.Ausercannotratetheirownitem.Availableonlyto
authenticatedusers.
Argument
Description
value
Requiredfloat.Theratingtobeappliedfortheitem.Thevalue
mustbeafloatingpointnumberbetween1.0and5.0.
reassign_to(target_owner,target_folder=None)¶
Thereassign_tomethodallowstheadministratortoreassignasingleitemfromoneusertoanother.
Note
Ifyouwishtomoveallofauser’sitems(andgroups)toanotheruserthenusethe
user.reassign_to()method.Theitem.reassign_tomethod(thismethod)onlymovesoneitematatime.
Argument
Description
target_owner
Requiredstring.Thenewdesiredowneroftheitem.
target_folder
Optionalstring.Thefoldertomovetheitemto.
Returns
Abooleanindicatingsuccess(True)withtheIDofthereassigneditem,orfailure(False).
#UsageExample
>>>item.reassign_to("User1234")
register(app_type,redirect_uris=None,http_referers=None,privileges=None)¶
Theregistermethodregistersanappitemwiththeenterprise,resultinginanAPPIDandAPPSECRET
(alsoknownasclient_idandclient_secretinOAuthspeak,respectively)being
generatedforthatapp.Uponsuccessfulregistration,aRegistered
Apptypekeywordgetsappendedtotheappitem.
Note
Theregistermethodisavailabletotheitemowner.
Argument
Description
app_type
Requiredstring.Thetypeofappthatwasregisteredindicating
whetherit’sabrowserapp,nativeapp,serverapp,oramultiple
interfaceapp.
Values:browser,native,server,ormultiple
redirect_uris
Optionallist.TheURIswheretheaccess_tokenorauthorization
codewillbedelivereduponsuccessfulauthorization.The
redirect_urispecifiedduringauthorizationmustmatchoneofthe
registeredURIs,otherwiseauthorizationwillberejected.
Aspecialvalueofurn:ietf:wg:oauth:2.0:oobcanalsobespecified
forauthorizationgrants.Thiswillresultintheauthorization
codebeingdeliveredtoaportalURL(/oauth2/approval).This
valueistypicallyusedbyappsthatdon’thaveawebserverora
customURIschemewherethecodecanbedelivered.
ThevalueisaJSONstringarray.
http_referers
OptionalList.Alistofthehttpreferrersforwhichusageofthe
APIKeywillberestrictedto.
Note
HttpReferrerscanbeconfiguredfornonapiKeytypeappsas
well.Thelistconfiguredherewillbeusedtovalidatetheapp
tokenssentinwhileaccessingthesharingAPI.Thereferrerchecks
willnotbeappliedtousertokens.
privileges
OptionalList.Alistoftheprivilegesthatwillbeavailablefor
thisAPIKey.
Note
PrivilegescanbeconfiguredfornonAPIKeytypeappsas
well.Thelistconfiguredherewillbeusedtograntaccesstoitems
whenitemendpointisaccessedwithapptokens.Thecheckswillnot
beappliedtousertokensandtheycancontinueaccessingitems
basedonthecurrentitemsharingmodel.Withapptokens,allitems
ofappownercanbeaccessediftheprivilegeslistisnot
configured.
Returns
Adictionaryindicating‘success’or‘error’
#UsageExample
>>>item.register(app_type="browser",
>>>redirect_uris=["https://app.example.com","urn:ietf:wg:oauth:2.0:oob"],
>>>http_referers=["https://foo.com","https://bar.com"],
>>>privileges=["portal:apikey:basemaps","portal:app:access:item:itemId",
>>>"premium:user:geocode","premium:user:networkanalysis"]
)
related_items(rel_type,direction='forward')¶
Therelated_itemsmethodretrievestheitemsrelatedtothisitem.Relationshipscanbeaddedanddeleted
usingitem.add_relationship()anditem.delete_relationship(),respectively.
Note
WithWebMapsitems,relationshipsareonlyavailableonlocalenterprises.
Argument
Description
rel_type
Requiredstring.Thetypeoftherelateditem;isoneof
[‘Map2Service’,‘WMA2Code’,‘Map2FeatureCollection’,‘MobileApp2Code’,
‘Service2Data’,‘Service2Service’].See
RelationshipTypesintheRESTAPIhelp
formoreinformationonthisparameter.
direction
Requiredstring.Oneof[‘forward’,‘reverse’]
Returns
Thelistofrelateditems.
#UsageExample
>>>item.related_items("Service2Service","forward")
propertyresources¶
TheresourcespropertyreturnstheItem’sResourceManager
Returns
AResourceManagerobject
share(everyone=False,org=False,groups=None,allow_members_to_edit=False)¶
Thesharemethodsharesanitemwiththespecifiedlistofgroups.
Argument
Description
everyone
Optionalboolean.DefaultisFalse,don’tsharewith
everyone.
org
Optionalboolean.DefaultisFalse,don’tsharewith
theorganization.
groups
Optionallistofgroupidsasstrings,oralistof
arcgis.gis.Groupobjects,oracomma-separatedlistof
groupIDs.
allow_members_to_edit
Optionalboolean.DefaultisFalse,toallowitemtobe
sharedwithgroupsthatallowsharedupdate
Returns
Adictionarywithakeytitled“notSharedWith”,containingarrayofgroupswithwhichtheitemcouldnotbe
shared.
#UsageExample
>>>item.share(org=True,allow_members_to_edit=True)
propertyshared_with¶
Theshared_withpropertyrevealstheprivacyorsharingstatusofthecurrentitem.Anitemcanbeprivate
orsharedwithoneormoreofthefollowing:
Aspecifiedlistofgroups
Allmembersintheorganization
Everyone(includinganonymoususers).
Note
IfthereturnisFalsefororg,everyoneandcontainsanemptylistofgroups,thenthe
itemisprivateandvisibleonlytotheowner.
Returns
ADictionaryinthefollowingformat:
{
‘groups’:[],#oneormoreGroupobjects
‘everyone’:True|False,
‘org’:True|False
}
propertysnapshots¶
ThesnapshotspropertyprovidesaccesstotheNotebookItem’sSnapshots.Iftheuserisnot
theowneroftheItem,thesnapshotswillbeanemptylist.
Returns
List[SnapShot]
status(job_id=None,job_type=None)¶
ThestatusmethodprovidesthestatusofanIteminthefollowingsituations:
PublishinganItem
AddinganIteminasyncmode
3.Addingwithamultipartupload.PartialisavailableforAddItemMultipartwhenonlyapartis
uploadedandtheItemobjectisnotcommitted.
Argument
Description
job_id
Optionalstring.ThejobIDreturnedduringpublish,generateFeatures,
export,andcreateServicecalls.
job_type
Optionalstring.Thetypeofasynchronousjobforwhichthestatus
hastobechecked.Defaultisnone,whichcheckstheitem’sstatus.
Thisparameterisoptionalunlessusedwiththeoperationslisted
below.Values:publish,generateFeatures,export,andcreateService
Returns
ThestatusofapublishingItemobject.
#UsageExample
>>>item.status(job_type="generateFeatures")
unregister()¶
Theunregisterpropertyremovestheapplicationregistrationfromanapp
Item,alongwiththeRegisteredApptypekeyword.
Note
Theunregistermethodisavailabletotheitemownerandorganizationadministrators.
Returns
Abooleanindicatingsuccess(True),orfailure(False)
unshare(groups)¶
TheunsharemethodstopssharingoftheItemwiththespecifiedlistofgroups.
Argument
Description
groups
Optionallistofgroupnamesasstrings,oralistofGroupobjects,
oracomma-separatedlistofgroupIDs.
Returns
ADictionarycontainingthekeynotUnsharedFromcontainingarrayofgroupsfromwhichtheitem
couldnotbeunshared.
update(item_properties=None,data=None,thumbnail=None,metadata=None)¶
TheupdatemethodupdatesaniteminaPortal.
Note
Thecontentcanbeafile(suchasalayerpackage,geoprocessingpackage,
mappackage)oraURL(toanArcGISServerservice,WMSservice,
oranapplication).
Touploadapackageorothertypeoffile,apathorURL
tothefilemustbeprovidedinthedataargument.
Foritem_properties,passinargumentsforonlythepropertiesyouwanttobeupdated.
Allotherpropertieswillbeuntouched.Forexample,ifyouwanttoupdateonlythe
item’sdescription,thenonlyprovidethedescriptionargumentinitem_properties.
Argument
Description
item_properties
Requireddictionary.Seetablebelowforthekeysandvalues.
data
Optionalstring,io.StringIO,orio.BytesIO.EitherapathorURLto
thedataoraninstanceofStringIOorBytesIOobjects.
thumbnail
Optionalstring.EitherapathorURLtoathumbnailimage.
metadata
Optionalstring.EitherapathorURLtothemetadata.
Key:ValueDictionaryOptionsforArgumentitem_properties
Key
Value
type
Optionalstring.Indicatestypeofitem,seethelinkbelowforvalidvalues.
typeKeywords
Optionalstring.Providealistsallsub-types,seethelinkbelowforvalidvalues.
description
Optionalstring.Descriptionoftheitem.
title
Optionalstring.Namelabeloftheitem.
url
Optionalstring.URLtoitemthatarebasedonURLs.
tags
Optionalstring.Tagslistedascomma-separatedvalues,oralistofstrings.
Usedforsearchesonitems.
text
Optionalstring.FortextbaseditemssuchasFeatureCollections&WebMaps
snippet
Optionalstring.Provideashortsummary(limittomax250characters)ofthewhattheitemis.
extent
Optionalstring.Providecomma-separatedvaluesforminx,miny,maxx,maxy.
spatialReference
Optionalstring.Coordinatesystemthattheitemisin.
accessInformation
Optionalstring.Informationonthesourceofthecontent.
licenseInfo
Optionalstring.Anylicenseinformationorrestrictionsregardingthecontent.
culture
Optionalstring.Locale,countryandlanguageinformation.
access
Optionalstring.Validvaluesareprivate,shared,org,orpublic.
commentsEnabled
Optionalboolean.Defaultistrue,controlswhethercommentsareallowed(true)
ornotallowed(false).
Note
SeeItemsandItemTypes
intheArcGISRESTAPIdocumentationformoredetails.
return
Abooleanindicatingsuccess(True)orfailure(False).
#UsageExample
item.update(description="aggregatedUShurricanedata",title="USHurricaneData",
tags="Hurricanes,USA,NaturalDisasters")
usage(date_range='7D',as_df=True)¶
Note
TheusagemethodisavailableforArcGISOnlineOnly.
Foritemownersandadministrators,theusagemethodprovidesusagedetailsaboutanitemthathelpyou
gaugeitspopularity.Usagedetailsshowhowmanytimestheitemhasbeenusedforthetime
periodyouselect.Historicalusageinformationisavailableforthepastyear.Dependingon
theitemtype,usagedetailscanincludethenumberofviews,requests,ordownloads,and
theaveragenumberofviews,requests,ordownloadsperday.
Viewsreferstothenumberoftimestheitemhasbeenviewedoropened.Formaps,scenes,
non-hostedlayers,andwebapps,theviewcountisincreasedbyonewhenyouopentheitem
pageoropentheiteminMapViewer.Forexample,ifyouopenedtheitempageforamap
imagelayerandclickedOpeninMapViewer,thecountwouldincreasebytwo.Forotheritems
suchasmobileapps,KML,andsoon,theviewcountisincreasedbyonewhenyouopenthe
item;thecountdoesnotincreasewhenyouopentheitemdetailspage.
Forhostedweblayers(feature,tile,andscene),thenumberofrequestsisprovidedinstead
ofviews.Requestsreferstothenumberoftimesarequestismadeforthedatawithinthe
layer.Forexample,someonemightopenanappthatcontainsahostedfeaturelayer.Opening
theappcountsasoneviewfortheapplication,butmultiplerequestsmaybenecessaryto
drawallthefeaturesinthehostedlayerandarecountedassuch.
FordownloadablefileitemtypessuchasCSV,SHP,andsoon,thenumberofdownloadsis
displayed.Forregisteredapps,theUsagetabalsodisplaysthenumberoftimesusershave
loggedintotheapp.Appsthatallowaccesstosubscribercontentthroughtheorganization
subscriptionshowusagebycredits.Additionally,thetimeframeforthecreditusage
reportingperiodcanbechanged.
Argument
Description
date_range
Optionalstring.Thedefaultis7d.Thisistheperiodtoquery
usageforagivenitem.
24H
Past24hours
7D
Past7days(default)
14D
Past14days
30D
Past30days
60D
Past60days
6M
Past6months
1Y
Past12months
as_df
Optionalboolean.ReturnsaPandasDataFramewhenTrue,returnsdata
asadictionarywhenFalse
Returns
PandasDataFrameorDictionary
User¶
classarcgis.gis.User(gis,username,userdict=None)¶
Bases:dict
TheUserclassrepresentsaregistereduseroftheGISsystem,eitherArcGISOnlineorArcGISEnterprise.The
Userclasshasamyriadofpropertiesthatarespecifictoaparticularuser-thesepropertiesare
enumeratedinthetablebelow.
Property
Details
username
Theusernameoftheuser.
fullName
Theuser’sfullname
availableCredits
Thenumberofcreditsavailabletotheuser.
assignedCredits
Thenumberofcreditsallocatedtotheuser.
firstName
Theuser’sfirstname.
lastName
Theuser’slastname.
preferredView
Theuser’spreferredviewforcontent,eitherweborGIS.
description
Adescriptionoftheuser.
email
Theuser’se-mailaddress.
idpUsername
Theoriginalusernameifusingenterpriselogins.
favGroupId
Theuser’sfavoritesgroupandiscreatedautomaticallyforeachuser.
lastLogin
ThelastlogindateoftheuserinmillisecondssincetheUnixepoch.
mfaEnabled
Indicatesiftheuser’saccounthasmultifactorauthenticationsetup.
access
Indicatesthelevelofaccessoftheuser:private,org,orpublic.Ifprivate,theuserdescriptiveinformationwillnotbeavailabletoothersnorwilltheusernamebesearchable.
storageUsage
Theamountofstorageusedfortheentireorganization.
NOTE:Thisvalueisanestimatefortheorganization,notthespecificuser.
Forstorageestimateofauser’sitems,seecodeexampleintheitemsmethod.
storageQuota
Applicabletopublicusersasitsetsthetotalamountofstorageavailableforasubscription.Themaximumquotais2GB.
orgId
TheIDoftheorganizationtheuserbelongsto.
role
Definestheuser’sroleintheorganization.
Values:
org_admin-administratororcustomrolewithadministrativeprivileges
org_publisher-publisherorcustomrolewithpublisherprivileges
org_user-userorcustomrolewithuserprivileges)
privileges
AJSONarrayofstringswithpredefinedpermissionsineach.Foracompletelisting,seePrivileges.
roleId
(Optional)TheIDoftheuser’sroleifitisacustomone.
level
Theleveloftheuser.
disabled
Theloginaccesstotheorganizationfortheuser.
units
User-definedunitsformeasurement.
tags
User-definedtagsthatdescribetheuser.
culture
Theuserlocaleinformation(languageandcountry).
cultureFormat
TheuserpreferrednumberanddateformatdefinedinCLDR(onlyapplicableforEnglish,
Spanish,French,German,anditalian:i.e.whencultureisen,es,fr,de,orit).
Note
SeeLanguages
forsupportedformats.Itwillinheritfrom
organization
cultureFormatifundefined.
region
Theuserpreferredregion,usedtosetthefeaturedmapsonthehomepage,contentinthegallery,andthedefaultextentofnewmapsintheViewer.
thumbnail
Thefilenameofthethumbnailusedfortheuser.
created
Thedatetheuserwascreated.ShowninmillisecondssincetheUnixepoch.
modified
Thedatetheuserwaslastmodified.ShowninmillisecondssincetheUnixepoch.
groups
AJSONarrayofgroupstheuserbelongsto.SeeGroupforpropertiesofagroup.
provider
Theidentityproviderfortheorganization.
Values:arcgis(forbuilt-inusers),enterprise(forexternalusersmanagedbyanenterpriseidentitystore),facebook(forpublicaccountsinArcGISOnline),google(forpublicaccountsinArcGISOnline)
id
(optional)TheuniqueidentifieroftheuserusedinArcGISOnlineorArcGISEnterprise10.7+
propertybundles¶
Thebundlesmethodprovidesthecurrentuser’sassignedapplicationbundles.
Note
ThebundlesmethodisavailableinArcGISOnlineandPortal10.7+.
Returns
AListofBundleobjects
delete(reassign_to=None)¶
Thedeletemethoddeletesthisuserfromtheportal,optionallydeletingorreassigninggroupsanditems.
Note
YoucannotdeleteauserinPortalifthatuserownsgroupsoritemsand/oris
assignedanapplicationbundle.Ifyouspecifyauserinthereassign_to
argument,thenitemsandgroupswillbetransferredtothatuser.Ifthat
argumentisnotset,themethodwillfailprovidedtheuserhasitemsorgroups
thatneedtobereassigned.Additionally,seethereassign_tomethodformore
informationonreassignment.
Argument
Description
reassign_to
Optionalstring.Thenewowneroftheitemsandgroups
thatbelongtotheuserbeingdeleted.
#UsageExample
user.delete(reassign_to="User1234")
Returns
Abooleanindicatingsuccess(True)orfailure(False).
delete_thumbnail()¶
Thedelete_thumbnailremovesthethumbnailfromtheuser’sprofile.
Returns
Abooleanindicatingsuccess(True)orfailure(False).
disable()¶
Thedisablemethoddisablesloginaccessfortheuser.
Note
Thedisablemethodisonlyavailabletotheadministratoroftheorganization.
Returns
Abooleanindicatingsuccess(True)orfailure(False).
download_thumbnail(save_folder=None)¶
Thedownload_thumbnailmethoddownloadstheitemthumbnailforthisuserandsavesitinthefolderthat
ispassedwhendownload_thumbnailiscalled.
Argument
Description
save_folder
Optionalstring.Thedesiredfoldernametodownloadthethumbnailto.
Returns
Thefilepathofthedownloadedthumbnail.
enable()¶
Theenablemethodenablesloginaccessfortheuser.
Note
enableisonlyavailabletotheadministratoroftheorganization.
propertyesri_access¶
Theesri_accesspropertywillreturnastringdescribingthecurrentuser’sEsriaccess.
Whensetting,supplyabooleantoenableordisableesri_accessforthatUser
object.
Note
AdministratorprivilegesarerequiredtoenableordisableEsriaccess
AmemberwhoseaccounthasEsriaccessenabledcanuseMyEsriand
CommunityandForums(GeoNet),accesse-LearningontheTraining
website,andmanageemailcommunicationsfromEsri.Themember
cannotenableordisabletheirownaccesstotheseEsriresources.
Warning
Trialaccountscannotmodifyesri_accessproperty.
PleaseseetheEnableEsriaccess
sectionintheManagememberspageinArcGISOnlineResourcesformoreinformation.
Argument
Description
value
Requiredboolean.Thecurrentuserwillbeallowedtouse
theusernameforotherEsri/ArcGISloginswhenthevalue
issettoTrue.Iffalse,theaccountcanonlybeusedto
accessagivenindividual’sorganization.
expire_password(temporary_password=None)¶
Expiresthecurrentuser’sPassword.
Argument
Description
temporary_password
OptionalString.Allowstheadministratortosetanew
temporarypasswordforagivenuser.Thisisavailableon
ArcGISEnterpriseOnly.
Returns
Boolean
propertyfolders¶
Thefoldersproperty,whencalled,retrievesthelistoftheuser’sfolders.
Returns
Listoffoldersrepresentedasdictionaries.
Dictionarykeysinclude:username,folderid(id),title,anddatecreated(created)
#Exampletogetnameofallfolders
user=User(gis,username)
folders=user.folders
forfolderinfolders:
print(folder["title"])
#Exampletogetidofallfolders
user=User(gis,username)
folders=user.folders
forfolderinfolders:
print(folder["id"])
generate_direct_access_url(store_type)¶
Thegenerate_direct_access_urlmethodcreatesadirectaccessURLthatisideal
foruploadinglargefilestodatafileshare,notebookworkspacesorrasterstores.
Note
Thegenerate_direct_access_urlisavailableinArcGISOnlineOnly
Argument
Description
store_type
OptionalString.ThetypeofuploadURLtogenerate.
Types:big_data_file,‘notebook’,or‘raster`.
Returns
AstringrepresentingadirectaccessURL
#UsageExample
>>>user.generate_direct_access_url(store_type="notebook")
get_thumbnail()¶
Theget_thumbnailmethodreturnsthebytesthatmakeupthethumbnailforthisuser.
Returns
Bytesthatrepresenttheimage.
UsageExample:
response=user.get_thumbnail()
f=open(filename,'wb')
f.write(response)
get_thumbnail_link()¶
Theget_thumbnail_linkmethodretrievestheURLtothethumbnailimage.
Returns
Thethumbnail’sURL.
propertygroups¶
ThegroupspropertyretrievesaListofGroupobjectsthecurrentuserbelongsto.
propertyhomepage¶
ThehomepagepropertyretrievestheURLtotheHTMLpagefortheuser.
propertyinvitations¶
Providesalistofinvitationsforagivenuser
Returns
UserInvitationManager
items(folder=None,max_items=100)¶
TheitemmethodprovidesalistofItemobjectsinthespecifiedfolder.
Forcontentintherootfolder,usethedefaultvalueofNoneforthefolderargument.
Forotherfolders,passinthefoldernameasastring,orasadictionarycontaining
thefolderID,suchasthedictionaryobtainedfromthefoldersproperty.
Argument
Description
folder
Optionalstring.Thespecifcfolder(asastringordictionary)
togetalistofitemsin.
max_items
Optionalinteger.Themaximumnumberofitemstobereturned.Thedefaultis100.
Returns
ThelistofItemobjectsinthespecifiedfolder.
#Exampleto**estimate**storageforauser'sitems
storage=0
foriteminuser.items():
storage+=item.size
try:
forfinuser.folders:
forf_iteminuser.folders(folder=f):
storage+=f_item.size
print(f"{user.username}using{storage}bytes")
exceptExceptionase:
print(f"{user.username}using{storage}bytes")
#Examplegetitemsineachfolderthatisnotroot
user=User(gis,username)
folders=user.folders
forfolderinfolders:
items=user.items(folder=folder["title"])
foriteminitems:
print(item,folder)
propertylanding_page¶
GetsorsetstheUser’sloginpage,
Argument
Description
value
Requiredstring.Thevaluesarehome,gallery,map,
scene,groups,content,ororganization
Returns
str
#Usageexample:Settingloginpage
>>>user1=gis.users.get("org_data_viewer")#approach1:setvialanding_page
>>>user1.landing_page="map"
>>>us=user.user_settings#approach2:setviauser_settings
>>>us['landingPage']['url']="webmap/viewer.html"
>>>user1.user_settings=us
link_account(username,user_gis)¶
Thelink_accountmethodallowsausertolinkseveralaccountstogetherandshareinformationbetweenthem.
Forexample,ifyouusemultipleaccountsforArcGISOnlineandEsriwebsites,
youcanlinkthemsoyoucanswitchbetweenaccountsandshareyour
EsricustomerinformationwithMyEsri,e-Learning,andGeoNet.You
canlinkyourorganizational,public,enterprise,andsociallogin
accounts.Yourcontentandprivilegesareuniquetoeachaccount.
FromEsriwebsites,onlyEsriaccess-enabledaccountsappearin
yourlistoflinkedaccounts.Seetheunlink_accountmethodformoreinformationonhow
tounlinklinkedaccountsthathavebeenproducedusingthelink_accountmethod.
SeetheSigninpageinArcGISOnlineResources
foraddtionalinformation.
Argument
Description
username
requiredstring/User.ThisistheusernameorUserobject
thatauserwantstolinkto.
user_gis
requiredGIS.ThisistheGISobjectfortheusername.
Inordertolinkanaccount,ausermustbeabletologin
tothataccount.TheGISobjectistheentryintothat
account.
#UsageExample
>>>gis=GIS("https://www.arcgis.com","username1","password123")
>>>user=gis.users.get('username')
>>>user.link_account("User1234",gis)
returns:Abooleanindicatingsuccess(True)orfailure(False).
propertylinked_accounts¶
Thelinked_accountsmethodretrievesalllinkedaccountsforthecurrentuseras
Userobjects
Returns
AlistofUserobjects
propertynotifications¶
Thenotificationspropertyretrievesthelistofnotificationsavailableforthegivenuser.
Returns
Alistcontainingavailablenotifications
propertyprovisions¶
Theprovisionspropertyreturnsalistofallprovisionedlicensesforthecurrentuser.
Note
TheprovisionsmethodisonlyavailableinArcGISEnterprise10.7+.
Returns
Alistcontaningprovisionallicenses
reassign_to(target_username)¶
Thereassign_tomethodreassignsallofthisuser’sitemsandgroupstoanotheruser.
Itemsaretransferredtothetargetuserintoafoldernamed
_whereusercorrespondstotheuserwhoseitemswere
movedandfoldercorrespondstothefolderthatwasmoved.
Note
Thismethodmustbeexecutedasanadministrator.Thismethodalso
cannotbeundone.Thechangesareimmediatelymadeandpermanent.
Argument
Description
target_username
Requiredstring.Theuserwhowillbethenewownerofthe
itemsandgroupsfromwhichthesearebeingreassignedfrom.
Returns
Abooleanindicatingsuccess(True)orfailure(False).
#UsageExample
>>>user.reassign_to(target_username="User1234")
report(report_type,start_time,*,duration='weekly')¶
Thereportsoperationistogeneratethereportsoftheoverall
usageoftheorganizations.Reportsdefineorganizationusage
metricsinoneplacefortheday,week,ormonth.Administrators
canmonitorwhoisusingwhichservices,consuminghowmuchcredits
andstoragewithincertaintimeperiod.Reportsalsoinclude
currentstateoftheorganizationsuchasnumberofitems,groups,
users,level1svslevel2s,Applicenseassignmentsandpublic
items.
Argument
Description
report_type
RequiredString.Thetypeoforganizationalreportto
generated.Theallowedreporttypesare:credits,
content,users,andactivity.
start_time
RequiredDatetime.Thedayonwhichthereportis
generated.EachreportmuststartonaSundayorMonday
forthestartdateforweeklyandmonthlyreports.All
datetimesmustbeinGMTtimezone.PassinginNonefor
thestart_timewillusetheclosestSundaytothedate
forweeklyandmonthlyreports.Fordailyreports,the
currentday/timewillbeusedinGMT.
duration
OptionalString.Thetimeframeonwhichthereportsare
ran.Theallowedvaluesare:monthly,weekly,
daily.Foractivityandcreditsastart_time
isrequired.
#UsageExample
importdatetimeas_dt
seven_days_ago=_dt.datetime.now(_dt.timezone.utc)-_dt.timedelta(days=7)
item=user.report("content",
seven_days_ago,
duration="weekly")
Returns
Item
reset(password=None,new_password=None,new_security_question=None,new_security_answer=None,reset_by_email=False)¶
Theresetmethodresetsauser’spassword,securityquestion,and/orsecurityanswer.
Ifanewsecurityquestionisspecified,anewsecurityanswershouldbeprovided.
Note
Thisfunctiondoesnotapplytothoseusingenterpriseaccounts
thatcomefromanenterprisesuchasActiveDirectory,LDAP,orSAML.
Itonlyhasaneffectonbuilt-inusers.
Note
Toresetthepasswordbyemail,setreset_by_emailtoTrueandpassword
toNone.
Argument
Description
password
Requiredstring.Thecurrentpassword.
new_password
Optionalstring.Thenewpasswordifresettingpassword.
new_security_question
Optionalstring.Thenewsecurityquestionifdesired.
new_security_answer
Optionalstring.Thenewsecurityquestionanswerifdesired.
reset_by_email
OptionalBoolean.IfTrue,theuserwillberesetbyemail.ThedefaultisFalse.
NOTE:NotavailablewithArcGISonKubernetes.
Warning
Thisfunctiondoesnotapplytothoseusingenterpriseaccounts
thatcomefromanenterprisesuchasActiveDirectory,LDAP,orSAML.
Itonlyhasaneffectonbuilt-inusers.
Returns
Abooleanindicatingsuccess(True)orfailure(False).
#UsageExample
>>>user.reset("password123",new_password="passWORD1234",reset_by_email=True)
propertytasks¶
Thetaskspropertyretrievestheuserstasks,effectivelyservingassesourcemanagerforuser’stasks.
SeeTaskManagerformoreinformationontaskmanagers.
unlink_account(username)¶
Theunlink_accountmethodallowsfortheremovaloflinkedaccountswhenauserwishestonolongerhave
alinkedaccount.Seethelink_accountmethodformoreinformationonhowaccountsare
linkedtogether.
SeetheSigninpageinArcGISOnlineResources
foraddtionalinformation.
Argument
Description
username
requiredstring/User.ThisistheusernameorUserobject
thatauserwantstounlink.
#UsageExample
>>>user.unlink_account("User1234")
returns:Abooleanindicatingsuccess(True)orfailure(False).
update(access=None,preferred_view=None,description=None,tags=None,thumbnail=None,fullname=None,email=None,culture=None,region=None,first_name=None,last_name=None,security_question=None,security_answer=None,culture_format=None)¶
Theupdatemethodupdatesthisuser’spropertiesbasedontheargumentspassedwhencallingupdate.
Note
Onlypassinargumentsforpropertiesyouwanttoupdate.
Allotherpropertieswillbeleftastheyare.Ifyou
wanttoupdatethedescription,thenonlyprovide
thedescriptionargument.
Whenupdatingthesecurityquestion,youmustprovideasecurity_answeraswell.
Argument
Description
access
Optionalstring.Theaccesslevelfortheuser,values
allowedareprivate,org,public.
preferred_view
Optionalstring.Thepreferredviewfortheuser,valuesallowedareWeb,GIS,null.
description
Optionalstring.Adescriptionoftheuser.
tags
Optionalstring.Tagslistedascomma-separatedvalues,oralistofstrings.
thumbnail
Optionalstring.ThepathorurltoafileoftypePNG,GIF,
orJPEG.Maximumallowedsizeis1MB.
fullname
Optionalstring.Thefullnameofthisuser,onlyforbuilt-inusers.
email
Optionalstring.Thee-mailaddressofthisuser,onlyforbuilt-inusers.
culture
Optionalstring.Thetwo-letterlanguagecode,frforexample.
region
Optionalstring.Thetwo-lettercountrycode,FRforexample.
first_name
Optionalstring.User’sfirstname.
last_name
Optionalstring.User’sfirstname.
security_question
Optionalinteger.Theisanumberfrom1-14.The
questionsareasfollows:
Whatcitywereyoubornin?
Whatwasyourhighschoolmascot?
Whatisyourmother’smadenname?
Whatwasthemakeofyourfirstcar?
Whathighschooldidyougotto?
Whatisthelastnameofyourbestfriend?
Whatisthemiddlenameofyouryoungestsibling?
Whatisthenameofthestreetonwhichyourgrewup?
Whatisthenameofyourfavoritefictionalcharacter?
Whatisthenameofyourfavoritepet?
Whatisthenameofyourfavoriterestaurant?
Whatisthetitleofyourfacoritebook?
Whatisyourdreamjob?
Wheredidyougoonyourfirstdate?
UsageExample:
security_question=13
security_answer
Optionalstring.Thisistheanswertosecurityquestion.
Ifyouarechangingauser’squestion,ananswermustbe
provided.
Usageexample:
security_answer=”WorkingonthePythonAPI”
culture_format
OptionalString.Specifiesuser-preferrednumberanddateformat
Returns
Abooleanindicatingsuccess(True)orfailure(False).
#UsageExample
>>>user.update(description="AggregatedUSHurricaneData",tags="Hurricanes,USA,2020")
update_level(level)¶
Theupdate_levelallowsadministrators
ofanorganizationtoupdatethelevelofauser.Administratorscan
leveragetwolevelsofmembershipwhenassigningrolesand
privilegestomembers.Membershiplevelsalloworganizationsto
controlaccesstosomeArcGIScapabilitiesforsomememberswhile
grantingmorecompleteaccesstoothermembers.
Note
Level1membershipisdesignedformemberswhoneedprivilegestoviewandinteract
withexistingcontent,whileLevel2membershipisforthosewho
contribute,create,andsharecontentandgroups,inadditionto
othertasks.
Maximumuserquotaofanorganizationatthegivenlevelischecked
beforeallowingtheupdate.
Built-inrolesincludingorganizationadministrator,publisher,and
userareassignedasLevel2,memberswithcustomrolescanbe
assignedasLevel1,1PlusEdit,orLevel2.
Level1membershipallowsforlimitedcapabilitiesgiventhrougha
maximumof8privileges:portal:user:joinGroup,
portal:user:viewOrgGroups,portal:user:viewOrgItems,
portal:user:viewOrgUsers,premium:user:geocode,
premium:user:networkanalysis,premium:user:demographics,and
premium:user:elevation.IfupdatingtheroleofaLevel1userwith
acustomrolethathasmoreprivilegesthantheeight,additional
privilegeswillbedisabledfortheusertoensurerestriction.
Note
Level1usersarenotallowedtoownanycontentorgroupwhichcan
bereassignedtootherusersthroughtheReassignItemandReassign
Groupoperationsbeforedowngradingthem.Theoperationwillalso
failiftheuserbeingupdatedhasgotlicensesassignedtopremium
appsthatarenotallowedatthetargetinglevel.
Argument
Description
level
Requiredint.Thevaluesof1or2.This
istheuserlevelforthegivenuser.
1-Viewonly
2-Contentcreator
Returns
Abooleanindicatingsuccess(True)orfailure(False).
#UsageExample
>>>user.update_level(2)
update_license_type(user_type)¶
Theupdate_license_typemethodisprimarilyusedtoupdatetheuser’slicensingtype.Thisallows
administratorstochangeauserfromacreatortoaviewerorany
othercustomuserlicensetype.
Note
Theupdate_license_typemethodisavailableinArcGISOnlineandPortal10.7+.
Argument
Description
user_type
Requiredstring.Theuserlicensetypetoassignauser.
Built-inTypes:creatororviewer
Returns
Abooleanindicatingsuccess(True)orfailure(False).
update_role(role)¶
Theupdate_rolemethodupdatesthisuser’sroletoorg_user,org_publisher,org_admin,viewer,view_only,
viewplusedit,oracustomrole.
Note
TherearefourtypesofrolesinPortal-user,publisher,administratorandcustomroles.
Ausercanshareitems,createmaps,creategroups,etc.Apublishercan
doeverythingausercandoandadditionallycreatehostedservices.Anadministratorcan
doeverythingthatispossibleinPortal.Acustomrolesprivilegescanbecustomized.
Argument
Description
role
Requiredstring.Valuemustbeeitherorg_user,
org_publisher,org_admin,viewer,view_only,viewplusedit
oracustomroleobject(fromgis.users.roles).
Returns
Abooleanindicatingsuccess(True)orfailure(False).
propertyuser_settings¶
Get/setthecurrentuser’ssettingsthataredefinedintheuserprofile.
Argument
Description
value
Requireddict.ThelandingPageandappLaunchersettings.
Returns
dict
#Usageexample:Gettingthecurrentusersettings
>>>us=user.user_settings#similartosettingthelanding_pageproperty
>>>us['landingPage']['url']="webmap/viewer.html"
>>>user1.user_settings=us
user_types()¶
Theuser_typesmethodisusedtoretrievetheusertypeandanyassignedapplicationsoftheuser.
Note
Theuser_typesmethodisavailableinPortal10.7+.
Group¶
classarcgis.gis.Group(gis,groupid,groupdict=None)¶
Bases:dict
TheGroupclassisanobjectthatrepresentsagroupwithintheGIS,eitherArcGISOnlineorArcGISEnterprise.
add_users(usernames=None,admins=None)¶
Theadds_usersmethodaddsuserstothisgroup.
Note
Theadd_usersmethodwillonlyworkiftheuserforthe
Portalobjectiseitheranadministratorfortheentire
Portalortheownerofthegroup.
Argument
Description
usernames
Optionallistofstringsorsinglestring.
Thelistofusernamesorsingleusername
tobeadded.
admins
OptionalListofString,orSingleString.
Thisisalistofuserstobeanadministrator
ofthegroup.
Returns
Adictionarycontainingtheusersthatwerenotaddedtothegroup.
#UsageExample
>>>group.add_users(usernames=["User1234","User5678"],admin="Admin9012")
application(user)¶
Theapplicationmethodretrievesonegroupapplicationforthegivengroup.
Argument
Description
user
RequiredString.Theusernameof
theuserapplyingtojointhegroup.
Note
Theapplicationmethodisavailabletoadministratorsofthegrouporadministratorsofanorganization
ifthegroupispartofone.
propertyapplications¶
Theapplicationspropertyretrievesthegroupapplicationsforthegivengroupasalist.
Note
Theapplicationsmethodisavailabletoadministratorsofthegrouporadministratorsofanorganization
ifthegroupispartofone.
propertycategories¶
Thecategoriespropertyservesasthecategorymanagerforgroups.
SeeCategorySchemaManagerformoreinformationoncategorymanagers.
content(max_items=1000)¶
Thecontentmethodretrievesthelistofitemssharedwiththisgroup.
Argument
Description
max_items
Requiredinteger.Themaximumnumberofitemstobereturned,defaultsto1000.
Returns
Thelistofitemsthatareshared.
delete()¶
Thedeletemethoddeletesthisgrouppermanently.
Returns
Abooleanindicatingsuccess(True)orfailure(False).
delete_group_thumbnail()¶
Thedelete_group_thumbnailmethoddeletesthegroup’sthumbnail.
Returns
Abooleanindicatingsuccess(True)orfailure(False).
download_thumbnail(save_folder=None)¶
Thedownload_thumbnailmethoddownloadstheitemthumbnailforthisuserandsavesitinthefolderthat
ispassedwhendownload_thumbnailiscalled.
Argument
Description
save_folder
Optionalstring.Thefilepathtowherethegroupthumbnailwillbedownloaded.
Returns
Thefilepathtowhichthegroupthumbnailisdownloaded.
get_members()¶
Theget_membersmethodretrievesthemembersofthisgroup.
Key
Value
owner
Thegroup’sowner(string).
admins
Thegroup’sadmins(listofstrings).Typicallythisisthesameastheowner.
users
Themembersofthegroup(listofstrings).
Returns
Adictionarywithkeys:owner,admins,andusers.
#UsageExample:Toprintusersinagroup
response=group.get_members()
foruserinresponse['users']:
print(user)
get_thumbnail()¶
Theget_thumbnailmethodretrievesthebytesthatmakeupthethumbnailforthisgroup.
Returns
Bytesthatrepresenttheimage.
Example
response=group.get_thumbnail()
f=open(filename,'wb')
f.write(response)
get_thumbnail_link()¶
Theget_thumbnail_linkmethodretrievestheURLtothethumbnailimage.
Returns
AURLlinkedtothethumbnailimage.
propertyhomepage¶
ThehomepagemethodretrievestheURLtotheHTMLpageforthegroup.
Returns
AURLlinkingtothegroupHTMLpage.
invite_by_email(email,message,role='member',expiration='1Day')¶
Deprecatedsinceversionv1.5.1:UseGroup.inviteinstead.
Warning
Deprecated:Theinvite_by_emailfunctionisnolongersupported.
Theinvite_by_emailmethodinvitesauserbyemailtotheexistinggroup.
Argument
Description
email
Requiredstring.Theusertosendjoinemailto.
message
Requiredstring.Themessagetosendtotheuser.
role
Optionalstring.Eithermember(thedefault)oradmin.
expiration
Optionalstring.Theisthetimeoutoftheinvite.
Thevaluesare:1Day(default),3Days,1Week,or
2Weeks.
Returns
Abooleanindicatingsuccess(True)orfailure(False)
invite_users(usernames,role='group_member',expiration=10080)¶
Theinvite_usersmethodinvitesexistinguserstothisgroup.
Note
Theuserexecutingtheinvite_userscommandmustbetheownerofthegroup.
Argument
Description
usernames
Requiredlistofstrings.Theuserstoinvite.
role
Optionalstring.Eithergroup_member(thedefault)orgroup_admin.
expiration
Optionalinteger.Specifieshowlongtheinvitationis
validforinminutes.Defaultis10,080minutes(7days).
Note
Auserwhoisinvitedtothisgroupwillseealistofinvitations
inthe“Groups”tabofPortallistinginvitations.Theuser
caneitheracceptorrejecttheinvitation.
Returns
Abooleanindicatingsuccess(True)orfailure(False).
#UsageExample
>>>group.invite_users(usernames=["User1234","User5678"],role="group_admin")
join()¶
Usersapplytojoinagroupusingthejoinoperation.This
createsanewgroupapplication,whichthegroupadministrators
acceptordecline.Thisoperationalsocreatesanotificationfor
theuserindicatingthattheyhaveappliedtojointhisgroup.
Note
Availableonlytoauthenticatedusers.Userscanonlyapplytojoingroupstowhichtheyhaveaccess-if
thegroupisprivate,userswillnotbeabletofindittoaskto
joinit.
Informationpertainingtotheapplyinguser,suchastheirfull
nameandusername,canbesentaspartofthegroupapplication.
Returns
Abooleanindicatingsuccess(True)orfailure(False).
leave()¶
Theleavemethodremovestheloggedinuserfromthisgroup.
Note
Theusermustbeloggedintousetheleavecommand.
Returns
Abooleanindicatingsuccess(True)orfailure(False).
propertymigration¶
ThemigrationmethodallowsusersandgroupstomigratecontentofaGrouptoanewOrganaizationor
Portal.
notify(users,subject,message,method='email',client_id=None)¶
Thenotifymethodcreatesagroupnotificationthatsendsamessagetoalluserswithin
thegroup.
Argument
Description
users
RequiredList.Alistofusersorusernames.
subject
RequiredString.Thesubjectofthenotification.
message
RequiredString.Themessagebodythatwillbesentto
thegroup’susers.
method
OptionalString.Thisistheformforwhichuserswillbe
contacted.Theallowedvaluesare:email,push,and
builtin.
email-sentamessageviasmtp.
push-pushesamessageout.
builtin-createsausernotification.
client_id
OptionalString.Theclientidoftheapplicationforthe
pushoperation.
Returns
Abooleanindicatingsuccess(True),orfailure(False).
#UsageExample
>>>group.notify(users="User1234",subject="TestMessage",message="Testingthenotificationsystem",
>>>method="email"
propertyprotected¶
Indicatesifthegroupisprotectedfromdeletion.
Argument
Description
value
Requiredbool.
Values:True(protectgroup)|False(unprotect)
Returns
Trueifgroupcurrentlyprotected,Falseifunprotected
reassign_to(target_owner)¶
Thereassign_tomethodreassignsthisgroupfromitscurrentownertoanotherowner.
Argument
Description
target_owner
RequiredstringorUser.Theusernameofthenewgroupowner.
Returns
Abooleanindicatingsuccess(True)orfailure(False).
remove_users(usernames)¶
Theremove_usersmethodisusedtoremoveusersfromthisgroup.
Argument
Description
usernames
Requiredlistofstrings.
Acomma-separatedlistofuserstoberemoved.
Returns
AdictionarywithakeynotRemovedthatisalistofusersnotremoved.
search(query,return_count=False,max_items=100,bbox=None,categories=None,category_filter=None,start=1,sort_field='title',sort_order='ASC',as_dict=False)¶
Thesearchoperationallowsuserstofindcontentwithinthespecificgroup.
Argument
Description
query
RequiredString.Thesearchquery.Whenthesearchfilters
containtwoormoreclauses,therecommendedschemaistohave
clausesseparatedbyblank,orAND,e.g.
UsageExample
group.search(query=’owner:USERNAMEtype:map’)
#or
group.search(query=’type:mapANDowner:USERNAME’)
Whentheclausesareseparatedbycomma,thefilteringcondition
forownershouldnotbeplacedatthefirstposition,e.g.
group.search(query=’type:map,owner:USERNAME’)
isallowed,while
group.search(query=’owner:USERNAME,type:map’)
isnot.Formore,pleasecheck
https://developers.arcgis.com/rest/users-groups-and-items/search-reference.htm
bbox
OptionalString/List.Thisisthexmin,ymin,xmax,ymaxbounding
boxtolimitthesearchin.Itemslikedocumentsdonothave
boundingboxesandwillnotbeincludedinthesearch.
categories
OptionalString.Acommaseparatedlistofupto8orgcontent
categoriestosearchitems.Exactfullpathofeachcategoryis
required,ORrelationshipbetweenthecategoriesspecified.
Eachrequestallowsamaximumof8categoriesparameterswith
ANDrelationshipbetweenthedifferentcategoriesparameters
called.
category_filters
OptionalString.Acommaseparatedlistofupto3category
termstosearchitemsthathavematchingcategories.Upto2
category_filtersparameterareallowedperrequest.Itcan
notbeusedtogetherwithcategoriestosearchinarequest.
start
OptionalInt.Thestartingpositiontosearchfrom.Thisis
onlyrequiredifpagingisneeded.
sort_field
OptionalString.Responsesfromthesearchoperationcanbe
sortedonvariousfields.avgratingisthedefault.
sort_order
OptionalString.Thesequenceintowhichacollectionof
recordsarearrangedaftertheyhavebeensorted.Theallowed
valuesare:ascforascendinganddescfordescending.
as_dict
RequiredBoolean.IfTrue,theresponsecomesbackasadictionary.
Returns
ListofItemobjects
#UsageExample
>>>group.search("HurricaneData",category_filters=["Natural_Disasters","Hurricanes","USA"])
update(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=False,clear_empty_fields=False,display_settings=None,is_open_data=False,leaving_disallowed=False)¶
Theupdatemethodupdatesthegroup’spropertieswiththevaluessuppliedforparticulararguments.
Note
Ifavalueisnotsuppliedforaparticularargument,thecorrespondingpropertywillnotbeupdated.
Argument
Description
title
Optionalstring.Thenewnameofthegroup.
tags
Optionalstring.Acomma-delimitedlistofnewtags,or
alistoftagsasstrings.
description
Optionalstring.Thenewdescriptionforthegroup.
snippet
Optionalstring.Anewshortsnippet(<250characters)
thatsummarizesthegroup.
access
Optionalstring.Choicesareprivate,public,ororg.
is_invitation_only
Optionalboolean.Defineswhetheruserscanjoinby
request.Truemeansaninvitationisrequired.
sort_field
Optionalstring.Specifieshowshareditemswiththe
grouparesorted.
sort_order
Optionalstring.Choicesareascordescforascending
ordescending,respectively.
is_view_only
Optionalboolean.Defineswhetherthegroupissearchable.
Truemeansthegroupissearchable.
thumbnail
Optionalstring.URLorfilelocationtoanewgroupimage.
max_file_size
Optionalinteger.Thisisthemaximumfilesizeallowed
beuploaded/sharedtoagroup.Defaultvalueis:1024000
users_update_items
Optionalboolean.Memberscanupdateallitemsinthis
group.Updatestoanitemcanincludechangestothe
item’sdescription,tags,metadata,aswellascontent.
Thisoptioncan’tbedisabledoncethegrouphas
beencreated.DefaultisFalse.
clear_empty_fields
OptionalBoolean.IfTrue,theusercansetvaluesto
emptystring,else,Nonevalueswillbeignored.
display_settings
OptionalString.Definesthedefaultdisplayforthe
grouppagetoshowacertaintypeofitems.Theallowed
valuesare:apps,all,files,maps,layers,scenes,tools.
Thedefaultvalueisall.
is_open_data
OptionalBoolean.Defineswhetherthegroupcanbeused
intheOpenDatacapabilitiesofArcGISHub.Thedefault
isFalse.
leaving_disallowed
Optionalboolean.Defineswhetherusersarerestricted
fromchoosingtoleavethegroup.IfTrue,onlyan
administratorcanremovethemfromthegroup.Thedefault
isFalse.
Returns
Abooleanindicatingsuccess(True)orfailure(False).
#UsageExample
>>>user.update(description="AggregatedUSHurricaneData",tags="Hurricanes,USA,2020")
update_users_roles(managers=None,users=None)¶
Theupdate_users_rolesupgradesasetofuserstobecomeeitherGroupMembersorGroupManagers.
Argument
Description
managers
RequiredList.Acomma-separatedarrayofUserobjectstoupgradetoagroupmanagerrole.
users
RequiredList.Acomma-separatedarrayofUserobjectstomakegroupmemberroles.
Returns
List[dictionary]
user_list()¶
Theuser_listmethodreturnsadictionarylistingusersandownersforthegroup.
Note
Theuser_listmethodisonlyavailableonArcGISOnlineandArcGISEnterprise10.9+.
Returns
Adictionaryofusersandownersforthegroup
Datastore¶
classarcgis.gis.Datastore(datastore,path)¶
Bases:dict
TheDatastoreclassrepresentsadatastore(folder,databaseorbigdatafileshare)withintheGIS’sdatastore.
SeetheDatastoreformoreinformationondatastores.
propertydatasets¶
Thedatasetspropertyretrievesthedatasetsinthedatastore,returningthemasadictionary
(currentlyimplementedforbigdatafileshares).
Returns
Adictionary
delete()¶
Thedeletemethodunregistersthisdataitemfromthedatastore.
#UsageExample
>>>datastore.delete()
Returns
Abooleanindicatingsuccess(True)orfailure(False).
propertymanifest¶
Themanifestpropertyretrievesorsetsthemanifestresourceforbigdatafileshares,asadictionary.
propertyref_count¶
Theref_countpropertygetsthetotalnumberofreferencestothisdataitemthatexistsontheserver.
Thispropertycanbeusedtodetermineifthisdataitemcanbesafelydeletedortakendownformaintenance.
regenerate()¶
Theregeneratemethodisusedtoregeneratethemanifestforabigdatafileshare.Youcan
regenerateamanifestifyouhaveaddednewdataorifyouhave
uploadedahintsfileusingtheeditresource.
Returns
Abooleanindicatingsuccess(True),orfailure(False)
update(item)¶
Theupdatemethodeditsthisdataitemtoupdateitsconnectioninformation.
Argument
Description
item
Requireddictionary.Therepresentationoftheupdateditem.
Returns
Abooleanindicatingsuccess(True)orfailure(False).
validate()¶
Thevalidatemethodisusedtovalidatethatthisdataitem’spath(forfileshares)or
connectionstring(fordatabases)isaccessibletoeveryservernodeinthesite.
Returns
Abooleanindicatingsuccess(True)orfailure(False).
Role¶
classarcgis.gis.Role(gis,role_id,role)¶
Bases:object
TheRoleclassisusedtorepresentaroleinaGIS,eitherArcGISOnlineorArcGISEnterprise.
delete()¶
Thedeletemethodiscalledtodeletesthecurrentrole.
#UsageExample
>>>role.delete()
Returns
Abooleanindicatingsuccess(True)orfailure(False).
propertydescription¶
Thedescriptionmethodretrievesandsetsthedescriptionofthecustomrole.
propertyname¶
Thenamemethodretrievesandsetsthenameofthecustomrole.
propertyprivileges¶
Theprivilegesmethodretrievesandsetstheprivilegesforthecustomroleasalistofstrings.
SupportedAdministratorPrivilegeswithpredefinedpermissionsfor:
Members
portal:admin:viewUsers:grantstheabilitytoviewfullmemberaccountinformationwithinorganization.
portal:admin:updateUsers:grantstheabilitytoupdatememberaccountinformationwithinorganization.
portal:admin:deleteUsers:grantstheabilitytodeletememberaccountswithinorganization.
portal:admin:inviteUsers:grantstheabilitytoinvitememberstoorganization.(ThisprivilegeisonlyapplicabletoArcGISOnline.)
portal:admin:disableUsers:grantstheabilitytoenableanddisablememberaccountswithinorganization.
portal:admin:changeUserRoles:grantstheabilitytochangetheroleamemberisassignedwithinorganization;however,itdoesnotgranttheabilitytopromoteamemberto,ordemoteamemberfrom,theAdministratorrole.ThatprivilegeisreservedfortheAdministratorrolealone.
portal:admin:manageLicenses:grantstheabilitytoassignlicensestomembersoforganization.
portal:admin:reassignUsers:grantstheabilitytoassignallgroupsandcontentofamembertoanotherwithinorganization.
Groups
portal:admin:viewGroups:grantstheabilitytoviewallgroupswithinorganization.
portal:admin:updateGroups:grantstheabilitytoupdategroupswithinorganization.
portal:admin:deleteGroups:grantstheabilitytodeletegroupswithinorganization.
portal:admin:reassignGroups:grantstheabilitytoreassigngroupstoothermemberswithinorganization.
portal:admin:assignToGroups:grantstheabilitytoassignmembersto,andremovemembersfrom,groupswithinorganization.
portal:admin:manageEnterpriseGroups:grantstheabilitytolinkgroupmembershiptoanenterprisegroup.(ThisprivilegeisonlyapplicabletoArcGISEnterprise.)
Content
portal:admin:viewItems:grantstheabilitytoviewallcontentwithinorganization.
portal:admin:updateItems:grantstheabilitytoupdatecontentwithinorganization.
portal:admin:deleteItems:grantstheabilitytodeletecontentwithinorganization.
portal:admin:reassignItems:grantstheabilitytoreassigncontenttoothermemberswithinorganization.
portal:admin:shareToGroup:grantstheabilitytoshareothermember’scontenttogroupstheuserbelongsto.
portal:admin:shareToOrg:grantstheabilitytoshareothermember’scontenttoorganization.
portal:admin:shareToPublic:grantstheabilitytoshareothermember’scontenttoallusersoftheportal.
ArcGISMarketplaceSubscriptions
marketplace:admin:purchase:grantstheabilitytorequestpurchaseinformationaboutappsanddatainArcGISMarketplace.(ThisprivilegeisonlyapplicabletoArcGISOnline.)
marketplace:admin:startTrial:grantstheabilitytostarttrialsubscriptionsinArcGISMarketplace.(ThisprivilegeisonlyapplicabletoArcGISOnline.)
marketplace:admin:manage:grantstheabilitytocreatelistings,listitemsandmanagesubscriptionsinArcGISMarketplace.(ThisprivilegeisonlyapplicabletoArcGISOnline.)
PublisherPrivileges:
Content
portal:publisher:publishFeatures:grantstheabilitytopublishhostedfeaturelayersfromshapefiles,CSVs,etc.
portal:publisher:publishTiles:grantstheabilitytopublishhostedtilelayersfromtilepackages,features,etc.
portal:publisher:publishScenes:grantstheabilitytopublishhostedscenelayers.
UserPrivileges:
Groups
portal:user:createGroup:grantstheabilityforamembertocreate,edit,anddeletetheirowngroups.
portal:user:joinGroup:grantstheabilitytojoingroupswithinorganization.
portal:user:joinNonOrgGroup:grantstheabilitytojoingroupsexternaltotheorganization.(ThisprivilegeisonlyapplicabletoArcGISOnline.)
Content
portal:user:createItem:grantstheabilityforamembertocreate,edit,anddeletetheirowncontent.
Sharing
portal:user:shareToGroup:grantstheabilitytosharecontenttogroups.
portal:user:shareToOrg:grantstheabilitytosharecontenttoorganization.
portal:user:shareToPublic:grantstheabilitytosharecontenttoallusersofportal.
portal:user:shareGroupToOrg:grantstheabilitytomakegroupsdiscoverablebytheorganization.
portal:user:shareGroupToPublic:grantstheabilitytomakegroupsdiscoverablebyallusersofportal.
PremiumContent
premium:user:geocode:grantstheabilitytoperformlarge-volumegeocodingtaskswiththeEsriWorldGeocodersuchaspublishingaCSVofaddressesashostedfeaturelayer.
premium:user:networkanalysis:grantstheabilitytoperformnetworkanalysistaskssuchasroutinganddrive-timeareas.
premium:user:geoenrichment:grantstheabilitytogeoenrichfeatures.
premium:user:demographics:grantstheabilitytomakeuseofpremiumdemographicdata.
premium:user:spatialanalysis:grantstheabilitytoperformspatialanalysistasks.
premium:user:elevation:grantstheabilitytoperformanalyticaltasksonelevationdata.
Features
features:user:edit:grantstheabilitytoeditfeaturesineditablelayers,accordingtotheeditoptionsenabledonthelayer.
features:user:fullEdit:grantstheabilitytoadd,delete,andupdatefeaturesinahostedfeaturelayerregardlessoftheeditingoptionsenabledonthelayer.
OpenData
opendata:user:openDataAdmin:grantstheabilitytomanageOpenDataSitesfortheorganization.(ThisprivilegeisonlyapplicabletoArcGISOnline.)
opendata:user:designateGroup:grantstheabilitytodesignategroupswithinorganizationasbeingavailableforuseinOpenData.(ThisprivilegeisonlyapplicabletoArcGISOnline.)
Layer¶
classarcgis.gis.Layer(url,gis=None)¶
Bases:arcgis.gis._GISResource
TheLayerclassisaprimaryconceptforworkingwithdatainaGIS.
Userscreate,import,export,analyze,edit,andvisualizelayers.
Layerscanbeaddedtoandvisualizedusingmaps.Theyactasinputstoandoutputsfromanalysistools.
LayersarecreatedbypublishingdatatoaGIS,andareexposedasabroaderresource(Item)inthe
GIS.LayerobjectscanbeobtainedthroughthelayersattributeonlayerItemobjectsin
theGIS.
classmethodfromitem(item,index=0)¶
ThefromitemmethodreturnsthelayeratthespecifiedindexfromalayerItemobject.
Argument
Description
item
Requiredstring.AnitemIDrepresentingalayer.
index
Optionalint.Theindexofthelayeramongsttheitem’slayers
Returns
Thelayeratthespecifiedindex.
#UsageExample
>>>layer.fromitem(item="9311d21a9a2047d19c0faaebd6f2cca6",index=3)
GroupApplication¶
classarcgis.gis.GroupApplication(url,gis,**kwargs)¶
Bases:object
TheGroupApplicationclassrepresentsasinglegroupapplicationontheGIS,eitherArcGISOnlineor
ArcGISEnterprise.
accept()¶
TheacceptmethodisusedtomanageaUserapplication.Whena
UserappliestojoinaGroup,a
GroupApplicationobjectiscreated.Groupadministratorschoosetoacceptthisapplication
usingtheacceptoperation.Thisoperationaddstheapplyingusertothegroupthendeletestheapplication.
Thisoperationalsocreatesanotificationfortheuserindicatingthattheuser’sgroupapplicationwas
accepted.Thismethodisverysimilartothedeclinemethod,whichdeclines
ratherthanacceptstheapplicationtojoinagroup.
Note
Theacceptmethodisonlyavailabletogroupownersandadministrators.
#UsageExample
>>>group1=gis.groups.get('name')
>>>group_app=group1.applications[0]
>>>group_app.accept()
Returns
Abooleanindicatingsuccess(True)orfailure(False).
decline()¶
ThedeclinemethodisusedtomanageaUserapplication.Whena
UseraskstojoinaGroup,a
GroupApplicationobjectiscreated.Groupadministratorschoosetodeclinethisapplication
usingthedeclineoperation.Thisoperationdeletestheapplicationandcreatesanotificationfortheuser
indicatingthattheuser’sgroupapplicationwasdeclined.Thismethodisverysimilartothe
acceptmethod,whichacceptsratherthandeclinestheapplicationto
joinagroup.
Note
Thedeclinemethodisonlyavailabletogroupownersandadministrators.
#UsageExample
>>>group_app=group.applications[0]
>>>groupapplication.decline()
Returns
Abooleanindicatingsuccess(True)orfailure(False).
propertyproperties¶
ThepropertiesoperationretreviesthepropertiesoftheGroupApplication.
CategorySchemaManager¶
classarcgis.gis.CategorySchemaManager(base_url,gis=None)¶
TheCategorySchemaHelperclassisformanagingcategoryschemas.Aninstanceofthisclass,calledcategories,
isavailableasapropertyintheContentManagerandtheGroupclass.See
categoriesandcategoriesformoreinformation.
Note
Thisclassisnotcreatedbyusersdirectly.
assign_to_items(items)¶
Theassign_to_itemsfunctionaddsgroupcontentcategoriestotheportalitems
specifiedintheitemsargument(seebelow).Forassigningcategories
toitemsinagroup,youmustbethegroupowner/manager.Forassigning
organizationcontentcategoriesonitems,youmustbetheitemowner
oranadministratorwhohastheportal:admin:updateItemsprivilege.
Note
Amaximumof100itemscanbebulkupdatedperrequest.
Argument
Description
items
RequiredList.AJSONarrayofitemobjects.Eachis
specifiedwiththeitemIDthatconsistsofacategories
object.categoriesisspecifiedwithanarraythatlists
allcontentcategoriestoupdateontheitem,eachwith
fullhierarchicalpathprefixedwith/.
Eachitemcanbecategorizedtoamaximumof20
categories.
Returns
Adictofitem_id:status,withstatusbeing
whetherthecontentcategoriesweresuccessfullyadded.Ifthestatusis
unsuccessfullyupdated,amessagewillprovideinformationtohelpyoudebug
theissue.
#UsageExample
>>>gis.content.categories.assign_to_items(items=[{"2678d3002eea4e4a825e3bdf10016e61":{
"categories":["/Categories/Geology",
"/Categories/Elevation"]}},
{"c3ad4ed8bcf04d619537cfe252a1760d":{
"categories":["/Categories/Geology",
"/Categories/Landcover/Forest/DeciduousForest"]}},
{"9ced00fdce3e4b20bb4b05155acbe817":{
"categories":[]}}])
delete()¶
Thedeletefunctionallowsgroupownerormanagerstoremovethe
categoryschemasetonagroup.
#UsageExample
>>>gis.content.categories.delete()
Returns
Abooleanindicatingsuccess(True),orfailure(False)
propertyproperties¶
Thepropertiesmethodretrievesthepropertiesoftheschema.
propertyschema¶
Theschemapropertyallowsgroupowners/managerstomanagethecontent
categoriesforagroup.Thesecontentcategoriesareahierarchical
setofclassestohelporganizeandbrowsegroupcontent.
Note
Eachgroupcanhaveamaximumof5categorytreeswitheach
categoryschemacanhaveupto4hierarchicallevels.Themaximum
numberofcategoriesagroupcanhaveintotalis200witheach
categoryoflessthan100characterstitleand300characters
description.
Whengettingschema,returnsthecontentcategoryschema
setonagroup.
Whensettingschema,willupdatethegroupcategoryschema
basedonthedictthispropertyissetto.Seebelow.
Argument
Description
categories
RequiredDict.Acategoryschemaobjectconsistsofan
arrayofdictobjectsrepresentingtoplevelcategories.
Eachobjecthastitle,descriptionandcategories
propertieswherecategoriesconsistsofanarrayof
objectswitheachhavingthesamepropertiesand
representsthedescendantcategoriesorsubcategoriesand
soon.
ContentManager¶
classarcgis.gis.ContentManager(gis)¶
TheContentManagerclassisahelperclassformanagingcontentinArcGISOnlineorArcGISEnterprise.
Aninstanceofthisclass,called‘content’,isavailableasapropertyoftheGISobject.Users
callmethodsonthis‘content’objecttomanipulate(create,get,search,
etc)items.Seecontentformoreinformation.
Note
Theclassisnotcreatedbytheuser.
add(item_properties,data=None,thumbnail=None,metadata=None,owner=None,folder=None,item_id=None,**kwargs)¶
TheaddmethodaddscontenttotheGISbycreatinganItem.
Note
Contentcanbeafile(suchasaservicedefinition,shapefile,
CSV,layerpackage,filegeodatabase,geoprocessingpackage,
mappackage)oritcanbeaURL(toanArcGISServerservice,
WMSservice,oranapplication).
Ifyouareuploadingapackageorotherfile,provideapathor
URLtothefileinthedataargument.
Fromatechnicalperspective,noneoftheitem_properties(see
tablebelowKey:ValueDictionaryOptionsforArgument
item_properties)arerequired.However,itisstrongly
recommendedthatargumentstitle,type,typeKeywords,tags,
snippet,anddescriptionbeprovided.
Argument
Description
item_properties
Requireddictionary.Seetablebelowforthekeysandvalues.
data
Optionalstring,io.StringIO,orio.BytesIO.EitherapathorURLto
thedataoraninstanceofStringIOorBytesIOobjects.
thumbnail
Optionalstring.EitherapathorURLtoathumbnailimage.
metadata
Optionalstring.EitherapathorURLtothemetadata.
owner
Optionalstring.Defaultstotheloggedinuser.
folder
Optionalstring.Nameofthefolderwhereplacingitem.
item_id
Optionalstring.AvailableinArcGISEnterprise10.8.1+.NotavailableinArcGISOnline.
Thisparameterallowsthedesireditemidtobespecifiedduringcreationwhich
canbeusefulforcloningandautomatedcontentcreationscenarios.
Thespecifiedidmustbea32characterGUIDstringwithoutanyspecialcharacters.
Iftheitem_idisalreadybeingused,anerrorwillberaised
duringtheaddprocess.
Example:item_id=9311d21a9a2047d19c0faaebd6f2cca6
OptionalInputParametersforthe`add`method
OptionalArgument
Description
upload_size
Optionalfloat.Thedefaultvalueis1e7bytesor~10MBs.Thisthe
minimumdefaultvalueforthesizeofthefilewhenuploadingbyparts.
Key:ValueDictionaryOptionsforArgumentitem_properties
Key
Value
type
Optionalstring.Indicatestypeofitem,seeURL1belowforvalidvalues.
dataUrl
Optionalstring.TheUrlofthedatastoredoncloudstorage.Ifgiven,filenameisrequired.
filename
Optionalstring.Thenameofthefileoncloudstorage.ThisisrequiredisdataUrlisused.
typeKeywords
Optionalstring.Providealistsallsub-types,seeURLbelowforvalidvalues.
description
Optionalstring.Descriptionoftheitem.
title
Optionalstring.Namelabeloftheitem.
url
Optionalstring.URLtoitemthatarebasedonURLs.
text
Optionalstring.FortextbaseditemssuchasFeatureCollections&WebMaps
tags
Optionalstring.Tagslistedascomma-separatedvalues,oralistofstrings.
Usedforsearchesonitems.
snippet
Optionalstring.Provideashortsummary(limittomax250characters)ofthewhattheitemis.
extent
Optionalstring.Providecomma-separatedvaluesforminx,miny,maxx,maxy.
spatialReference
Optionalstring.Coordinatesystemthattheitemisin.
accessInformation
Optionalstring.Informationonthesourceofthecontent.
licenseInfo
Optionalstring.Anylicenseinformationorrestrictionsregardingthecontent.
culture
Optionalstring.Locale,countryandlanguageinformation.
commentsEnabled
Optionalboolean.Defaultistrue,controlswhethercommentsareallowed(true)
ornotallowed(false).
culture
Optionalstring.Languageandcountryinformation.
overwrite
Optionalboolean.Defaultisfalse.Controlswhetheritemcanbeoverwritten.
SeeItemandItemTypes
intheArcGISRESTAPIformoreinformation.
Returns
TheItemifsuccessfullyadded,Noneifunsuccessful.
#UsageExample
>>>gis.content.add(item_properties={
>>>"type":"FeatureCollection",
>>>"title":"USHurricaneData",
>>>"tags":"Hurricanes,NaturalDisasters,USA",
>>>"description":"AggregatedUSAHurricaneDatafor2020",
>>>"commentsEnabled":False
>>>},owner="User1234")
advanced_search(query,return_count=False,max_items=100,bbox=None,categories=None,category_filter=None,start=1,sort_field='title',sort_order='asc',count_fields=None,count_size=None,as_dict=False)¶
Theadvanced_searchmethodallowstheabilitytofullycustomizethesearchexperience.
Theadvanced_searchmethodallowsuserstocontrolofthefinergrainedparameters
notexposedbytheContentManagermethod.Additionally,itallowsforthemanualpagingof
informationandhowthedataisreturned.
Argument
Description
query
RequiredString.Thesearchquery.Whenthesearchfilters
containtwoormoreclauses,therecommendedschemaistohave
clausesseparatedbyblank,orAND,e.g.
UsageExample
gis.content.advanced_search(query=’owner:USERNAMEtype:map’)
#or
gis.content.advanced_search(query=’type:mapANDowner:USERNAME’)
Whentheclausesareseparatedbycomma,thefilteringcondition
forownershouldnotbeplacedatthefirstposition,e.g.
gis.content.advanced_search(query=’type:map,owner:USERNAME’)
isallowed,while
gis.content.advanced_search(query=’owner:USERNAME,type:map’)
isnot.Formore,pleasecheck
https://developers.arcgis.com/rest/users-groups-and-items/search-reference.htm
bbox
OptionalString/List.Thisisthexmin,ymin,xmax,ymaxbounding
boxtolimitthesearchin.Itemslikedocumentsdonothave
boundingboxesandwillnotbeincludedinthesearch.
categories
OptionalString.Acommaseparatedlistofupto8orgcontent
categoriestosearchitems.Exactfullpathofeachcategoryis
required,ORrelationshipbetweenthecategoriesspecified.
Eachrequestallowsamaximumof8categoriesparameterswith
ANDrelationshipbetweenthedifferentcategoriesparameters
called.
category_filters
OptionalString.Acommaseparatedlistofupto3category
termstosearchitemsthathavematchingcategories.Upto2
category_filtersparameterareallowedperrequest.Itcan
notbeusedtogetherwithcategoriestosearchinarequest.
start
OptionalInt.Thestartingpositiontosearchfrom.Thisis
onlyrequiredifpagingisneeded.
sort_field
OptionalString.Responsesfromthesearchoperationcanbe
sortedonvariousfields.avgratingisthedefault.
sort_order
OptionalString.Thesequenceintowhichacollectionof
recordsarearrangedaftertheyhavebeensorted.Theallowed
valuesare:ascforascendinganddescfordescending.
count_fields
OptionalString.Acommaseparatedlistoffieldstocount.
Maximumcountfieldsallowedperrequestis3.Supportedcount
fields:tags,type,access,contentstatus,and
categories.
count_size
OptionalInt.Themaximumnumberoffieldvaluestocountfor
eachcount_fields.ThedefaultvalueisNone,andmaximumsize
allowedis200.
as_dict
RequiredBoolean.IfTrue,theresponsecomesbackasadictionary.
Returns
Dependsontheinputs:
Dictionaryforastandardsearch
`return_count`=Trueanintegerisreturned
count_fieldsisspecifiedalistofdictsforeachfieldspecified
#UsageExample
>>>gis.content.advanced_search(query="Hurricanes",categories="Hurricanes,USA,NaturalDisasters",
>>>sort_order="asc",count_fields="tags,type",as_dict=True)
analyze(url=None,item=None,file_path=None,text=None,file_type=None,source_locale='en',geocoding_service=None,location_type=None,source_country='world',country_hint=None)¶
TheanalyzemethodhelpsaclientanalyzeaCSVorExcelfile(.xlsx,.xls)priortopublishingor
generatingfeaturesusingthePublishorGenerateoperation,respectively.
analyzereturnsinformationaboutthefileincludingthefieldspresentaswellassamplerecords.
analyzeattemptstodetectthepresenceoflocationfieldsthatmaybepresentaseitherX,Yfieldsor
addressfields.
analyzepackagesitsresultsothatpublishParameterswithintheJSONresponsecontainsinformationthat
canbepassedbacktotheserverinasubsequentcalltoPublishorGenerate.ThepublishParameterssubobject
containspropertiesthatdescribetheresultinglayerafterpublishing,includingitsfields,thedesired
renderer,andsoon.analyzewillsuggestdefaultsfortherenderer.
Inatypicalworkflow,theclientwillpresentportionsoftheanalyzeresultstotheuserforediting
beforemakingthecalltogenerateorpublish.
Note
Themaximumuploadsizeforshapefilesisnow2Mband10Mbforallothersupportedfiletypes.
Note
Ifthefiletobeanalyzedcurrentlyexistsintheportalasanitem,callerscanpassinitsitemId.
Callerscanalsodirectlypostthefile.
Inthiscase,therequestmustbeamultipartpostrequestpursuanttoIETFRFC1867.
Thethirdoptionfortextfilesistopassthetextinasthevalueofthetextparameter.
Argument
Description
url
Optionalstring.TheURLofthecsvfile.
item
Optionalstring/Item.TheIDorItemoftheitemtobe
analyzed.
file_path
Optionalstring.Thefiletobeanalyzed.
text
Optionalstring.Thetextinthefiletobeanalyzed.
file_type
Optionalstring.Thetypeoftheinputfile:shapefile,csv,excel,
orgeoPackage(AddedArcGISAPIforPython1.8.3+).
source_locale
Optionalstring.Thelocaleusedforthegeocodingservicesource.
geocoding_service
Optionalstring/geocoder.TheURLoftheservice.
location_type
Optionalstring.Indicatesthetypeofspatialinformationstoredinthedataset.
ValuesforCSV:coordinates|address|lookup|none
ValuesforExcel:coordinates|address|none
source_country
Optionalstring.Thetwocharactercountrycodeassociatedwiththegeocodingservice,defaultis“world”.
country_hint
Optionalstring.Iffirsttimeanalyzing,thehintisused.Ifsourcecountryisalreadyspecifiedthansourcecountryisused.
Returns
dictionary
#UsageExample
>>>gis.content.analyze(item="9311d21a9a2047d19c0faaebd6f2cca6",file_type="csv")
bulk_update(itemids,properties)¶
Thebulk_updatemethodupdatesacollectionofitems’properties.
Note
bulk_updateonlyworkswithcontentcategoriesatthistime.
Argument
Description
itemids
RequiredlistofstringorItem.ThecollectionofItemstoupdate.
properties
Requireddictionary.TheItem’spropertiestoupdate.
Returns
AListofresults
#UsageExample
>>>itemsids=gis.content.search("owner:TestUser12399")
>>>properties={'categories':["clothes","formal_wear/socks"]}
>>>gis.content.bulk_update(itemids,properties)
[{'results':[{'itemid':'id','success':"True/False"}]}]
can_delete(item)¶
Thecan_deletemethodindicateswhetheranItemcanbeerasedor
not.Whenthereturnedresponsefromcan_deleteistrue,the
itemcanbesafelyremoved.Whenthereturnedresponseisfalse,
theitemcannotbedeletedduetoadependencyorprotection
setting.
Argument
Description
item
RequiredItem.TheItemtobeerased.
Returns
Adictionary-seethetablebelowforexamplesofasuccessfulcallofcan_deleteandafailed
callofcan_delete.
#UsageExample
>>>gis.content.can_delete("9311d21a9a2047d19c0faaebd6f2cca6")
Status
Response
success
{
“itemId”:“e03f626be86946f997c29d6dfc7a9666”,
“success”:True
}
failure
{
“itemId”:“a34c2e6711494e62b3b8d7452d4d6235”,
“success”:false,
“reason”:{
“message”:“Unabletodeleteitem.Deleteprotectionisturnedon.”
}
}
propertycategories¶
ThecategoriespropertyiscategorymanagerforanItemobject.
SeeCategorySchemaManager.
check_url(url)¶
ToverifyaURLisaccessiblebytheOrganization,providetheurland
thesystemwillcheckifthelocationisvalidandreachable.This
methodisusefulwhencheckingserviceURLsorvalidatingthatURLscan
bereached.
Returns
Dict[str,Any]
clone_items(items,folder=None,item_extent=None,use_org_basemap=False,copy_data=True,copy_global_ids=False,search_existing_items=True,item_mapping=None,group_mapping=None,owner=None,preserve_item_id=False)¶
Theclone_itemsmethodisusedtoclonecontenttotheGISbycreatingnewItem
objects.
Note
Cloninganitemwillcreateacopyoftheitemandforcertain
itemtypesacopyoftheitemdependenciesintheGIS.
Forexample,awebapplicationcreatedusingWebAppBuilder
oraConfigurableAppTemplatewhichisbuiltfromawebmap
thatreferencesoneormorehostedfeaturelayers.Thisfunction
willclonealloftheseitemstotheGISandswizzlethepaths
inthewebmapandwebapplicationtopointtothenewlayers.
Note
Theactionsintheexampleabovecreateanexactcopyoftheapplication,map,andlayers
intheGIS.
Argument
Description
items
Requiredlist.CollectionofItemobjectstoclone.
folder
Optionalstring.Nameofthefolderwhereplacingitem.
item_extent
OptionalEnvelope.Extentsetforanycloneditems.DefaultisNone,
extentwillremainunchanged.Spatialreferenceoftheenvelopewillbe
usedforanyclonedfeaturelayers.
use_org_basemap
Optionalboolean.Indicatingwhetherthebasemapinanyclonedwebmaps
shouldbeupdatedtotheorganizationsdefaultbasemap.DefaultisFalse,
basemapwillnotchange.
copy_data
Optionalboolean.IfFalse,thedataisputbyreferenceratherthan
bycopy.DefaultisTrue,datawillbecopied.ThiscreatesaHosted
FeatureCollectionorFeatureLayer.
copy_global_ids
Optionalboolean.AssumespreviousparameterissettoTrue.IfTrue,
featurescopiedwillpreservetheirglobalIDs.DefaultisFalse
search_existing_items
Optionalboolean.Indicatingwhetheritemsthathavealreadybeencloned
shouldbesearchedforintheGISandreusedratherthanclonedagain.
item_mapping
Optionaldictionary.Canbeusedtoassociateanitemidinthesource
GIS(key)toanitemidinthetargetGIS(value).Thetargetitemwill
beusedratherthancloningthesourceitem.
group_mapping
Optionaldictionary.Canbeusedtoassociateagroupidinthesource
GIS(key)toagroupidinthetargetGIS(value).Thetargetgroupwill
beusedratherthancloningthesourcegroup.
owner
Optionalstring.Defaultstotheloggedinuser.
preserve_item_id
OptionalBoolean.WhentrueandthedestinationGISisnotArcGIS
Online,thecloneitemwillattempttokeepthesameitemidsforthe
itemsifavailable.ArcGISEnterprisemustbe10.9+.
Returns
AlistofItemobjectscreatedduringtheclone.
#UsageExample
>>>gis.content.clone_items(items=["item1","item2","item3","item4","item5"],
folder="/",owner='User1234')
cost(tile_storage=None,file_storage=None,feature_storage=None,generate_tile_count=None,loaded_tile_count=None,enrich_variable_count=None,enrich_report_count=None,service_area_count=None,geocode_count=None)¶
Thecostallowsfortheestimationofamountofcreditsan
operationwillberequired.Forvectorandtilestorage,ausercan
estimatethecosttocooktileandthecostofstorage.This
operationallowsuserstoplanforfuturecostseffecientlytobest
servetheirorganizationandclients.
Note
ThisoperationisonlysupportedonArcGISOnline.
Argument
Description
tile_storage
OptionalFloat.ThesizeoftheuncompressedtilesinMBs.
file_storage
OptionalFloat.EstimatesthecreditcostofMBfilestorage.
feature_storage
OptionalFloat.Estimatesthecostoffeaturestorageperfeature.
generate_tile_count
OptionalInt.Estimatesthecreditcostpertile.
loaded_tile_count
OptionalInt.Estimatesthecreditcostofpregeneratedtilestorage.
enrich_variable_count
OptionalInt.Estimatesthecreditcostergeoenrichmentvariable.
enrich_report_count
OptionalInt.Estimatesthecreditcostofrunningreports.
service_area_count
OptionalInt.Estimatesthecreditcostperserviceareageneration.
geocode_count
OptionalInt.Estimatesthecreditcostperrecordforgeocoding.
Returns
dict[str,float]
create_folder(folder,owner=None)¶
Thecreate_foldermethodcreatesafolderwiththegivenfoldername,forthegivenowner.
Note
Thecreate_foldermethoddoesnothingifthefolderalreadyexists.
Additionally,ifownerisnotspecified,ownerissetastheloggedinuser.
Argument
Description
folder
Requiredstring.Thenameofthefoldertocreatefortheowner.
owner
Optionalstring.User,folderowner,Noneforloggedinuser.
Returns
Ajsonobjectlikethefollowingifthefolderwascreated:
{“username”:“portaladmin”,”id”:“bff13218991c4485a62c81db3512396f”,”title”:“testcreate”};Noneotherwise.
#UsageExample
>>>gis.content.create_folder("Hurricane_Data",owner="User1234")
create_service(name,service_description='',has_static_data=False,max_record_count=1000,supported_query_formats='JSON',capabilities=None,description='',copyright_text='',wkid=102100,create_params=None,service_type='featureService',owner=None,folder=None,item_properties=None,is_view=False,tags=None,snippet=None,item_id=None)¶
Thecreate_servicemethodcreatesaserviceinthePortal.Seethetablebelowforalistofarguments
passedwhencallingcreate_service.
Argument
Description
name
Requiredstring.Theuniquenameoftheservice.
service_description
Optionalstring.Descriptionoftheservice.
has_static_data
Optionalboolean.Indicatingwhetherthedatacanchange.DefaultisTrue,dataisnotallowedtochange.
max_record_count
Optionalinteger.Maximumnumberofrecordsinqueryoperations.
supported_query_formats
Optionalstring.Formatsinwhichqueryresultsarereturned.
capabilities
Optionalstring.Specifyservicecapabilities.
Ifleftunspecified,‘Image,Catalog,Metadata,Download,Pixels’
areusedforimageservices,and‘Query’
isusedforfeatureservices,and‘Query’otherwise
description
Optionalstring.Auser-friendlydescriptionforthepublisheddataset.
copyright_text
Optionalstring.Thecopyrightinformationassociatedwiththedataset.
wkid
Optionalinteger.Thewellknownid(WKID)ofthespatialreferencefortheservice.
Alllayersaddedtoahostedfeatureserviceneedtohavethesamespatial
referencedefinedforthefeatureservice.Whencreatinganew
emptyservicewithoutspecifyingitsspatialreference,thespatial
referenceofthehostedfeatureserviceissettothefirstlayeraddedtothatfeatureservice.
create_params
Optionaldictionary.Addallcreate_serviceparametersintoadictionary.Ifthisparameterisused,
alltheparametersaboveareignored.
service_type
Optionalstring.Thetypeofservicetobecreated.CurrentlytheoptionsareimageServiceorfeatureService.
owner
Optionalstring.Theusernameoftheowneroftheservicebeingcreated.
folder
Optionalstring.Thenameoffolderinwhichtocreatetheservice.
item_properties
Optionaldictionary.Seebelowforthekeysandvalues
is_view
Optionalboolean.Indicatingiftheserviceisahostedfeaturelayerview
item_id
Optionalstring.AvailableinArcGISEnterprise10.8.1+.NotavailableinArcGISOnline.
Thisparameterallowsthedesireditemidtobespecifiedduringcreationwhich
canbeusefulforcloningandautomatedcontentcreationscenarios.
Thespecifiedidmustbea32characterGUIDstringwithoutanyspecialcharacters.
Iftheitem_idisalreadybeingused,anerrorwillberaised
duringtheaddprocess.
Example:item_id=9311d21a9a2047d19c0faaebd6f2cca6
tags
Optionalstring.Tagslistedascomma-separatedvalues,oralistofstrings.
Usedforsearchesonitems.
snippet
Optionalstring.Provideashortsummary(limittomax250characters)ofthewhattheitemis.
Key:ValueDictionaryOptionsforArgumentitem_properties
Key
Value
type
Optionalstring.Indicatestypeofitem,seeURL1belowforvalidvalues.
typeKeywords
Optionalstring.Providealistsallsub-types,seeURL1belowforvalidvalues.
description
Optionalstring.Descriptionoftheitem.
title
Optionalstring.Namelabeloftheitem.
url
Optionalstring.URLtoitemthatarebasedonURLs.
tags
Optionalstring.Tagslistedascomma-separatedvalues,oralistofstrings.
Usedforsearchesonitems.
snippet
Optionalstring.Provideashortsummary(limittomax250characters)ofthewhattheitemis.
extent
Optionalstring.Providecomma-separatedvaluesforminx,miny,maxx,maxy.
spatialReference
Optionalstring.Coordinatesystemthattheitemisin.
accessInformation
Optionalstring.Informationonthesourceofthecontent.
licenseInfo
Optionalstring.Anylicenseinformationorrestrictionsregardingthecontent.
culture
Optionalstring.Locale,countryandlanguageinformation.
access
Optionalstring.Validvaluesareprivate,shared,org,orpublic.
commentsEnabled
Optionalboolean.Defaultistrue,controlswhethercommentsareallowed(true)
ornotallowed(false).
culture
Optionalstring.Languageandcountryinformation.
Returns
TheItemfortheserviceifsuccessfullycreated,Noneifunsuccessful.
#UsageExample
>>>gis.content.create_service("HurricaneCollection")
delete_folder(folder,owner=None)¶
Thedelete_foldermethoddeletesafolderforthegivenownerwith
thegivenfoldername.
Note
Iftheanownerisnotespecifiedinthedelete_foldercall,themethoddefaultstotheloggedinuser.
Argument
Description
folder
Requiredstring.Thenameofthefoldertodelete.
owner
Optionalstring.User,folderowner,Noneforloggedinuseristhedefault.
Returns
Abooleanindicatingsuccessifthefolderwasdeleted(True),orfailureifthefolderwasnotdeleted
(False)
#UsageExample
>>>gis.content.delete_folder("Hurricane_Data",owner="User1234")
delete_items(items)¶
Thedelete_itemsmethoddeletesacollectionofItemobjectsfromauserscontent.
Argument
Description
items
listofItemobjectsorItemIds.Thisisanarray
ofitemstobedeletedfromthecurrentuser’scontent
Returns
Abooleanindicatingsuccessiftheitemsweredeleted(True),orfailureiftheitemswerenotdeleted
(False)
#UsageExample
>>>gis.content.delete_items(items=["item1","item2","item3","item4","item5"])
propertydependency_manager¶
ProvidesuserstheabilitytomanagetheEnterprise’sItemDependenciesDatabase.
AvailableinArcGISEnterprise10.9.1+
Returns
DependencyManagerorNoneforArcGISOnline.
generate(item=None,file_path=None,url=None,text=None,publish_parameters=None,future=False)¶
ThegeneratemethodhelpsaclientgeneratefeaturesfromaCSVfile,shapefile,
GPX,orGeoJsonfiletypes.
Note
Themaximumuploadsizeforshapefilesisnow2Mband10Mbforallothersupportedfiletypes.
Argument
Description
item
OptionalItem.AnItemonthecurrentportal.
file_path
OptionalString.Thefileresourcelocationonlocaldisk.
url
OptionalString.Awebresourceofa‘shapefile’,‘csv’,‘gpx’or‘geojson’file.
text
OptionalString.Thesourcetext.
publish_parameters
OptionalDict.APythondictionarydescribingthelayerandservicetobecreated
aspartofthepublishoperation.Theappropriatekey-valuepairs
dependonthefiletypebeingpublished.Foracomplete
description,seethePublishItem
documentationintheRESTAPI.AlsoseetheItem
publish()method.CSV,Shapefilesand
GeoJSONfiletypesmusthavepublishparametersprovided.
future
OptionalBoolean.Thisallowstheoperationtorunasynchronouslyallowing
theusertonotpausethethreadandcontinuetoperformmultipleoperations.
ThedefaultisTrue.WhenTruetheresultofthemethodwillbea
concurrentFutureobject.Theresultofthemethodcanbeobtained
usingtheresult()ontheFutureobject.WhenFalse,andItemis
returned.Future==Trueisonlysupportedfor‘shapefiles’and‘gpx’files.
Returns
Themethodhas3potentialreturns:
AFutureobjectwhenfuture==True,
AnItemobjectwhenfuture==False
AdictionaryoferrormessageswhenExceptionsareraised
#UsageExample
>>>gis.content.generate(item=item1,future=False)
get(itemid)¶
ThegetmethodreturnstheItemobjectforthespecifieditemid.
Argument
Description
itemid
Requiredstring.Theitemidentifier.
Returns
Theitemobjectiftheitemisfound,Noneiftheitemisnotfound.
import_data(df,address_fields=None,folder=None,item_id=None,**kwargs)¶
Theimport_datamethodimportsaPandasDataFrame
(thathasanaddresscolumn),oranarcgisspatial
DataFrameintotheGIS.
SpatialdataframesareimportedintotheGISandpublishedasfeature
layers.Pandasdataframesthathaveanaddresscolumnareimportedas
anin-memoryfeaturecollection.
Note
Bydefault,thereisalimitof1,000rows/featuresforPandas
dataframes.Thislimitisn’tthereforspatialdataframes.
Argument
Description
df
RequiredDataFrame.Pandasdataframe
address_fields
Optionaldictionary.Dictionarycontainingmappingofdfcolumnstoaddressfields,eg:{“CountryCode”:“Country”}or{“Address”:“Address”}.
folder
Optionalstring.Nameofthefolderwhereimporteddatawouldbestored.
title
Optionalstring.Titleoftheitem.Thisisusedforspatialdataframeobjects.
tags
Optionalstring.Tagslistedascomma-separatedvalues,oralistofstrings.ProvidetagswhenpublishingaspatialdataframetothetheGIS.
item_id
Optionalstring.AvailableinArcGISEnterprise10.8.1+.NotavailableinArcGISOnline.
Thisparameterallowsthedesireditemidtobespecifiedduringcreationwhich
canbeusefulforcloningandautomatedcontentcreationscenarios.
Thespecifiedidmustbea32characterGUIDstringwithoutanyspecialcharacters.
Iftheitem_idisalreadybeingused,anerrorwillberaised
duringtheaddprocess.
Example:item_id=9311d21a9a2047d19c0faaebd6f2cca6
Inadditiontotheparametersabove,youcanspecifyadditionalinformationtohelppublishCSV
data.
OptionalArgument
Description
location_type
Optionalstring.Indicatesthetypeofspatialinformationstoredinthe
dataset.
ValuesforCSV:
coordinates
address(default)
lookup
none
ValuesforExcel:
coordinates
address(default)
none
Whenlocation_type=coordinates,theCSVorExceldatacontainsx,y
information.
Whenlocation_type=address,theCSVorExceldatacontainsaddress
fieldsthatwillbegeocodedtoasinglepoint.
Whenlocation_type=lookup,theCSVorExceldatacontainsfieldsthat
canbemappedtowell-knownsetsofgeographies.
Whenlocation_type=none,theCSVorExceldatacontainsnospatial
contentanddatawillbeloadedandsubsequentlyqueriedastabulardata.
Basedonthisparameter,additionalparameterswillberequired,for
example,whenspecifyinglocation_type=coordinates,thelatitudeand
longitudefieldnamesmustbespecified.
latitude_field
Optionalstring.Iflocation_type=coordinates,thenameofthefieldthat
containstheycoordinate.
longitude_field
Optionalstring.Iflocation_type=coordinates,thenameofthefieldthat
containsthexcoordinate.
coordinate_field_type
Optionalstring.Specifythetypeofcoordinatesthatcontainlocation
information.Values:LatitudeAndLongitude(default),MGRS,USNG
coordinate_field_name
Optionalstring.Thenameofthefieldthatcontainsthecoordinates
specifiedincoordinate_field_type
lookup_type
Optionalstring.Thetypeofplacetolookup.
lookup_fields
Optionalstring.AJSONobjectwithnamevaluepairsthatdefinethe
fieldsusedtolookupthelocation.
geocode_url
Optionalstring.TheURLofthegeocodingservicethatsupportsbatch
geocoding.
source_locale
Optionalstring.Thelocaleusedforthegeocodingservicesource.
source_country
Optionalstring.Thetwocharactercountrycodeassociatedwiththe
geocodingservice,defaultis‘world’.
country_hint
Optionalstring.Iffirsttimeanalyzing,thehintisused.Ifsource
countryisalreadyspecifiedthansource_countryisused.
WhenpublishingaSpatialDataframe,additionaloptionscanbegiven:
OptionalArgument
Description
target_sr
optionalinteger.WKIDoftheoutputdata.Thisisusedwhenpublishing
SpatialDataframestoHostedFeatureLayers.Thedefaultis:102100
title
optionalstring.Nameofthelayer.Thedefaultisarandomstring.
tags
optionalstring.Commaseperatedstringsthatprovidemetadataforthe
items.ThedefaultisFGDB.
capabilities
optionalstring.specifiestheoperationsthatcanbeperformedonthe
featurelayerservice.ThedefaultisQuery.
sanitize_columns
Optionalboolean.ThedefaultisFalse.Whentrue,thecolumnnamewill
modifiedinordertoallowforsuccessfulpublishing.
service_name
OptionalString.ThenamefortheservicethatwillbeaddedtotheItem.
Returns
Afeaturecollectionorfeaturelayer
thatcanbeusedforanalysis,visualization,orpublishedtotheGISasanItem.
is_service_name_available(service_name,service_type)¶
Theis_service_name_availablemethoddeterminesifthatservicenameis
availableforuseornot,forthespecifiedservicetype.
Argument
Description
service_name
Requiredstring.Adesiredservicename.
service_type
Requiredstring.Thetypeofservicetobecreated.CurrentlytheoptionsareimageServiceorfeatureService.
Returns
Trueifthespecifiedservice_nameisavailableforthe
specifiedservice_type,Falseiftheservice_nameisunavailable.
#UsageExample
>>>gis.content.is_service_name_available("HurricaneCollection","featureService")
rename_folder(old_folder,new_folder,owner=None)¶
Therename_foldermethodrenamesanexistingfolderfromit’sexistingnametoanewname.
Note
Ifownerisnotspecified,ownerissetastheloggedinuser.
Argument
Description
old_folder
Requiredstring.Thenameofthefoldertorenamefortheowner.
new_folder
Requiredstring.Thenewnameofthefolder.
owner
Optionalstring.User,folderowner,Noneforloggedinuser.
Returns
Abooleanindicatingsuccess(True),orfailure(False)
#UsageExample
>>>gis.content.rename_folder("2020_Hurricane_Data","2021_Hurricane_Data","User1234")
replace_service(replace_item,new_item,replaced_service_name=None,replace_metadata=False)¶
Thereplace_serviceoperationallowsyoutoreplaceyourproductionvectortilelayerswithstagingones.
Thisoperationallowsyoutoperformqualitycontrolonastagingtilelayerandtothenreplacetheproduction
tilelayerwiththestagingwithminimaldowntime.Thisoperationhastheoptiontokeepabackupofthe
productiontilelayer.
Note
Thisfunctionalityisonlyavailableforhostedvectortilelayers,hostedtilelayersandhostedscene
layersbasedonpackages.Ifyouarelookingtocloneservices,usethe
clone_itemsmethodinstead.
Theworkflowforthereplace_servicemethodisasfollows:
1.Publishthestagingservicetothesamesystemastheproductionservice.Bothservicesareactiveat
thesametime.SharethestagingservicewithasmallersetofusersandQAthestagingservice.
2.Theitemproperties(ex:thumbnail,iteminfo,metadata)oftheproductionitemwillbepreserved.
IfyouneedtoupdatethemusetheItem.update()method.
3.Callthereplace_serviceoperation.Theservicerunningonthehostingservergetsreplaced
(forexample,itscache).
Note
Itistheresponsibilityoftheusertoensurebothservicesarefunctionallyequivalentforclients
consumingthem.Forexample,whenreplacingahostedfeatureservice,ensurethenewserviceisconstructed
withtheanticipatedlayersandfieldsforitsclientapplication.
Ifyouwanttoretainthereplacedproductionservice,forexample,tokeepanarchiveoftheevolutionofthe
serviceyoucandosobyomittingavaluefor“ReplacedServiceName”.Ifreplacedservicenameisnotprovided,
theproductionservicebeingreplacedwillbearchivedwithatimestampwhenreplaceservicewasexecuted.
Youcanprovideanynameforthereplacedserviceaslongasitisnotpre-existingonyourportalcontent.
Argument
Description
replace_item
RequiredItemorItem’sIdasstring.Theservicetobereplaced
new_item
RequiredItemorItem’sIdasstring.Thereplacementservice.
replaced_service_name
Optionalstring.Thenameofthereplacementservice.
replace_metadata
OptionalBoolean.WhensettoTrue,theiteminfo{“thumbnail”,“tag”,
“description”,“summary”}ofthecurrentserviceisupdatedtothatof
thereplacementservice.TheCredits,Termsofuse,andCreatedfrom
detailswillnotbereplaced.ThisoptionissettoFalsebydefault.
Returns
Abooleanindicatingsuccess(True),orfailure(False)
#UsageExample
>>>gis.content.replace_service(replace_item="9311d21a9a2047d19c0faaebd6f2cca6",
new_item="420554d21a9a2047d19c0faaebd6f2cca4")
search(query,item_type=None,sort_field='avgRating',sort_order='desc',max_items=10,outside_org=False,categories=None,category_filters=None)¶
Thesearchmethodsearchesforportalitems.
Note
Afewthingsthatwillbehelpfultoknow…
Thequerysyntaxhasmanyfeaturesthatcan’tbeadequately
describedhere.PleaseseetheArcGISRESTAPISearch
Reference
forfulldetailsonsearchengineusedwiththismethod.
Mostofthetimewhensearchingforitems,you’llwantto
searchwithinyourorganizationinArcGISOnline
orwithinyourPortal.Asaconvenience,themethod
automaticallyappendsyourorganizationidtothequeryby
default.Ifyouwantcontentfromoutsideyourorganization
setoutside_orgtoTrue.
Argument
Description
query
Requiredstring.Aquerystring.Seenotesabove.Whenthesearchfilters
containtwoormoreclauses,therecommendedschemaistohaveclauses
separatedbyblank,orAND,e.g.
UsageExample
gis.content.search(query=’owner:USERNAMEtype:map’)
#or
gis.content.search(query=’type:mapANDowner:USERNAME’)
Whentheclausesareseparatedbycomma,thefilteringcondition
forownershouldnotbeplacedatthefirstposition,e.g.
gis.content.search(query=’type:map,owner:USERNAME’)
isrecommended,while
gis.content.search(query=’owner:USERNAME,type:map’)
isnot.
item_type
Optionalstring.Thetypeofitemtosearch.SeeItemsanditemtypes
forcomprehensivelistofvalues(thetypecolumn).
sort_field
Optionalstring.Validvaluescanbetitle,uploaded,type,owner,modified,
avgRating,numRatings,numComments,andnumViews.
sort_order
Optionalstring.Validvaluesareascordesc.
max_items
Optionalinteger.Maximumnumberofitemsreturned,defaultis10.
outside_org
Optionalboolean.Controlswhethertosearchoutsideyourorg(defaultisFalse,donotsearchoursideyourorg).
categories
Optionalstringorlist.Astringofcategoryvalues.
category_filters
Optionalstring.Acommaseparatedlistofupto3categorytermsto
searchitemsthathavematchingcategories.
Upto2category_filtersparameterareallowedperrequest.Itcannotbe
usedtogetherwithcategoriestosearchinarequest.
Returns
Alistofitemsobjectsmatchingthespecifiedquery.
#UsageExample
>>>gis.content.search(query="Hurricanes",categories="Hurricanes,USA,NaturalDisasters",
>>>item_type="FeatureCollection")
share_items(items,everyone=False,org=False,groups=None,allow_members_to_edit=False)¶
Theshares_itemsmethodsharesabatchofitemswitheveryone,membersoftheorganization,or
specifiedlistofGroup.AUsercanonlyshareitemswith
groupstowhichtheybelong.Thismethodisquitesimilartothe
unshare_itemsmethod,whichachievestheexactoppositeofshare_items.
Argument
Description
items
RequiredList.AlistofItemoritemidstomodifysharingon.
everyone
Optionalboolean.DefaultisFalse,don’tsharewitheveryone.
org
Optionalboolean.DefaultisFalse,don’tsharewiththe
organization.
groups
Optionallistofgroupnamesasstrings,oralistof
arcgis.gis.Groupobjects,oracomma-separatedlistofgroupIDs.
allow_members_to_edit
Optionalboolean.DefaultisFalse,toallowitemtobesharedwith
groupsthatallowsharedupdate
Returns
AdictionaryofsharedItemobjects
#UsageExample
>>>gis.content.share_items(items=[item1,item2,item3],everyone=True,org=True)
unshare_items(items,groups=None,everyone=None,org=None)¶
Theunshare_itemsmethodUnsharesabatchofitemswiththespecifiedlistofgroups,everyone,or
organization.Thismethodisquitesimilartothe
share_itemsmethod,whichachievestheexactoppositeofunshare_items.
Note
Eachitem’scurrentsharingwillbeoverwrittenwiththismethod.
Argument
Description
items
RequiredList.AlistofItemoritemidstomodifysharingon.
everyone
RequiredBoolean.Ifprovided,theeveryonesharingpropertywillbe
updated.Truemeansitwillsharetheitemswithanyone.Falsemeans
theitemwillnotbesharedwithallusers.
org
RequiredBoolean.Atruevaluemeansthattheitemswillbeshared
withallmembersoftheorganization.Afalsevaluemeansthatthe
itemwillnotbesharedwithallorganizationusers.
groups
Requiredlistofgroupnamesasstrings,oralistof
Groupobjects,oralistofgroupIDs.
Returns
AdictionaryofunsharedItemobjects
#UsageExample
>>>gis.content.share_items(items=[item1,item2,item3],everyone=True,org=True,
groups=["Developers","Engineers","GIS_Analysts"])
UserManager¶
classarcgis.gis.UserManager(gis)¶
Bases:object
TheUserManagerclassisahelperclassformanagingGISusers.Thisclassisnotcreatedbyusersdirectly.
Aninstanceofthisclass,called‘users’,isavailableasapropertyoftheGisobject.
Userscallmethodsonthis‘users’objecttomanipulate(create,get,search,etc)users.
advanced_search(query,return_count=False,max_users=10,start=1,sort_field='username',sort_order='asc',as_dict=False)¶
Theadvanced_searchmethodallowsforthefullcontrolofthequeryoperations
byanygivenuser.Thesearchesareperformedagainstahighperformance
indexthatindexesthemostpopularfieldsofanuser.Seethe
Searchreferencepageforinformation
onthefieldsandthesyntaxofthequery.Theadvanced_searchmethodis
quitesimilartothesearchmethod,whichislessrefined.
Thesearchindexisupdatedwheneverusersisadded,updated,ordeleted.There
canbealagbetweenthetimethattheuserisupdatedandthetimewhenit’s
reflectedinthesearchresults.
Note
Theresultsofasearchonlycontainitemsthattheuserhaspermissiontoaccess.
Argument
Description
query
RequiredString.Thesearchquery.Whenthesearchfilters
containtwoormoreclauses,therecommendedschemaistohave
clausesseparatedbyblank,orAND,e.g.
UsageExample
gis.users.advanced_search(query=’owner:USERNAMEtype:map’)
#or
gis.users.advanced_search(query=’type:mapANDowner:USERNAME’)
Whentheclausesareseparatedbycomma,thefilteringcondition
forownershouldnotbeplacedatthefirstposition,e.g.
gis.users.advanced_search(query=’type:map,owner:USERNAME’)
isallowed,while
gis.users.advanced_search(query=’owner:USERNAME,type:map’)
isnot.Formore,pleasecheck
https://developers.arcgis.com/rest/users-groups-and-items/search-reference.htm
return_count
OptionalBoolean.IfTrue,thenumberofusersfoundbythequery
stringisreturned.
max_users
OptionalInteger.Limitsthetotalnumberofusersreturnedina
aquery.Thedefaultis10users.Ifallusersisneeded,-1
shouldbeused.
start
OptionalInt.Thestartingpositiontosearchfrom.Thisis
onlyrequiredifpagingisneeded.
sort_field
OptionalString.Responsesfromthesearchoperationcanbe
sortedonvariousfields.usernameisthedefault.
sort_order
OptionalString.Thesequenceintowhichacollectionof
recordsarearrangedaftertheyhavebeensorted.Theallowed
valuesare:ascforascendinganddescfordescending.
as_dict
OptionalBoolean.IfTrue,theresponsecomesbackasadictionary.
Returns
Adictionaryifreturn_countisFalse,elseaninteger
#UsageExample
>>>gis.users.advanced_search(query="1234",sort_field="username",max_users=20,as_dict=20)
counts(type='bundles',as_df=True)¶
Thecountsmethodreturnsasimplereportonthenumberoflicensescurrentlyused
foragiventype.Atypecanbearole,app,bundleoruserlicensetype.
Argument
Description
type
RequiredString.Thetypeofdatatoreturn.Thefollowingvaluesarevalid:
role-returnscountsonuserroles
app-returnscountsonregisteredapplications
bundles-returnscountsonapplicationbundles
user_type-returnscountsontheuserlicensetypes
as_df
Optionalboolean.Iftrue,theresultsarereturnedasapandasDataFrame,else
itisreturnedasalistofdictionaries.
Returns
PandasDataFrame
ifas_dfisTrue.IfFalse,theresultisalistofdictionaries.
#UsageExample
>>>gis.users.counts("Role",as_df=True)
**Exampleas_df=True**
>>>df=gis.users.counts('user_type',True)
>>>df
countkey
012creatorUT
12viewerUT
**Exampleas_df=False**
>>>df=gis.users.counts('user_type',False)
>>>df
[{'key':'creatorUT','count':12},{'key':'viewerUT','count':2}]
create(username,password,firstname,lastname,email,description=None,role=None,provider='arcgis',idp_username=None,level=2,thumbnail=None,user_type=None,credits=-1,groups=None)¶
Thecreateoperationisusedtopre-createbuilt-inorenterpriseaccountswithintheEnterpriseportal,
orbuilt-inusersinanArcGISOnlineorganizationaccount.
Note
Onlyanadministratorcancallthismethod.
Amember’suser_typedeterminesthedefaultrolethatcanbeassignedtothemember.Usertypes
compatiblewitheachrolearenotedinthetablebelow(withintheuser_typesection).
Tocreateavieweraccount,chooserole=’viewer’anduser_type=’viewer’
Argument
Description
username
Requiredstring.Theusername,whichmustbeuniqueinthePortal,and
6-24characterslong.
password
Requiredstring.Thepasswordfortheuser.Itmustbeatleast8characters.
Thisisarequiredparameteronlyif
theproviderisarcgis;otherwise,thepasswordparameterisignored.
IfcreatinganaccountinanArcGISOnlineorg,itcanbesetasNonetolet
theusersettheirpasswordbyclickingonalinkthatisemailedtohim/her.
Whentheproviderisenterprise,passwordisoptional.
firstname
Requiredstring.Thefirstnamefortheuser
lastname
Requiredstring.Thelastnamefortheuser
email
Requiredstring.Theemailaddressfortheuser.Thisisimportanttohavecorrect.
description
Optionalstring.Thedescriptionoftheuseraccount.
thumbnail
Optionalstring.TheURLtouser’simage.
role
Optionalstring.Therolefortheuseraccount.The
defaultvalueisorg_user.Otherpossiblevaluesareorg_publisher,
org_admin,viewer,viewpluseditoracustomrole_id
valueobtainedfromtheall()methodoftheRoleManagerclass.
provider
Optionalstring.Theproviderfortheaccount.Thedefaultvalueisarcgis.
Theotherpossiblevalueisenterprise.
idp_username
Optionalstring.Thenameoftheuserasstoredbytheenterpriseuserstore.
Thisparameterisonlyrequirediftheproviderparameterisenterprise.
level
Optionalinteger.Theaccountlevel.(ArcGISEnterprisepriortoversion10.7.
SeeUsertypes,roles,andprivileges
forfulldetails.)TheGISProfessionaluser_typecanbeassignedatthefollowingthreelevels,whichcorrespondtothethreelicenselevelsofArcGISPro:
GISProfessionalBasic
GISProfessionalStandard
GISProfessionalAdvanced
user_type
Requiredstring.Theaccountusertype.Thiscanbecreator,viewer,etc.The
typeeffectswhatapplicationsausercanuseandwhatactionstheycandoin
theorganization.(ArcGISEnterprise10.7+andArcGISOnline.
SeeUsertypes,roles,andprivileges
forfulldetails.)
Membersassignedtheviewerrolecannotcreateorsharecontent,orperformanalysis,andtheviewerroleiscompatiblewithallusertypes.
TheDataEditorroleviewpluseditiscompatiblewithallusertypesexceptviewer.
Theorg_user,org_publisher,andorg_adminrolesarecompatiblewiththeCreator,GISProfessional,Storyteller,andInsightsAnalystusertypes.
Acompletelistofuser_typevaluescanbeobtainedfromthelicense_typespropertyontheUserManager.
credits
OptionalFloat.Thenumberofcreditstoassignauser.ThedefaultisNone,
whichmeansunlimited.(10.7+)
groups
OptionalList.AnarrayofGroupobjectstoprovideaccesstoforagiven
user.(10.7+)
Returns
Theuserifsuccessfullycreated,Noneifunsuccessful.
#UsageExample:Assigncustomroletoanewuser
>>>role_mgr=gis.users.roles
>>>forroleinrole_mgr.all():
>>>print(f"{role.name}{role.role_id}")
VieweriAAAAAAAAAAAAAAA
DataEditoriBBBBBBBBBBBBBBB
CustomRolebKrTCjFF9tKbaFk8
>>>user1=gis.users.create(username='new_user_1',
password='',
firstname='New',
lastname='User',
email='[email protected]',
description='Userwithcustomroleassigned',
role='bKrTCjFF9tKbaFk8',
user_type='Creator')
>>>ifuser1:#settingthestart_pageofthenewlycreateduser
>>>user1.landing_page="organization"
disable_users(users)¶
Thedisable_usersmethodisabulkdisablesuseroperationthatallowsadministratorstoquicklydisable
largenumberofusersinasinglecall.Itisusefultodothisoperationifyouhavemultiple
usersthatneedtobedisabled.disable_usersisquitesimilartothe
enable_usersmethod,whichenablesratherthandisablesusers.
Note
Thedisable_usersmethodissupportedonArcGISRESTAPI6.4+.
Argument
Description
users
RequiredList.ListofuserorUserNamestodisable
Returns
Abooleanindicatingsuccess(True),orfailure(False)
#UsageExample
>>>gis.users.disable_users(['user1','user1234','user123','user1234'])
enable_users(users)¶
Thieenable_usersmethodisabulkoperationthatallowsadministratorstoquicklyenablelargenumberof
usersinasinglecall.Itisusefultodothisoperationifyouhavemultipleusersthatneed
tobeenabled.enable_usersisquitesimilartothe
disable_usersmethod,whichdisablesratherthanenablesusers.
Note
Theenable_usersmethodissupportedonArcGISRESTAPI6.4+.
Argument
Description
users
RequiredList.ListofuserorUserNamestoenable
Returns
Abooleanindicatingsuccess(True),orfailure(False)
#UsageExample
>>>gis.users.enable_users(['user1','user1234','user123','user1234'])
get(username)¶
ThegetmethodretrievestheUserobjectforthespecifiedusername.
Argument
Description
username
Requiredstring.Theusertogetasastring.Thiscanbethe
user’sloginnameortheuser’sID.
Returns
TheUserobjectifsuccessfullyfound,Noneifunsuccessful.
#UsageExample
>>>gis.users.get("User1234")
propertyinvitations¶
Theinvitationspropertyprovidesaccesstoinvitationssenttousersusingthe
invitemethod.
Note:thisisonlysupportedbyArcGISOnline
Returns
AnInvitationManagerobject
invite(email,role='org_user',level=2,provider=None,must_approve=False,expiration='1Day',validate_email=True,message_text=None)¶
TheinvitemethodinvitesaUserobjecttoanorganizationbyemail.
Argument
Description
email
RequiredString.Theuser’semailthatwillbeinvitedtotheorganization.
role
OptionalString.Therolefortheuseraccount.Thedefaultvalueisorg_user.
Otherpossiblevaluesareorg_publisher,org_admin,org_viewer.
level
Optionalinteger.Theaccountlevel.Thedefaultis2.
SeeUsertypes,roles,andprivileges
forfulldetails.
provider
OptionalString.Theproviderfortheaccount.Thedefaultvalueisarcgis.
Theotherpossiblevalueisenterprise.
must_approve
Optionalboolean.Afterauseracceptstheinvite,ifTrue,andadministrator
mustapproveoftheindividualjoiningtheorganization.ThedefaultisFalse.
expiration
OptionalString.Thedefaultis‘1Day’.Thisisthetimetheemaileduserhas
toaccepttheinvitationrequestuntilitexpires.
Thevaluesare:1Day(default),3Days,1Week,or2Weeks.
validate_email
Optionalboolean.IfTrue(default)theEnterprisewillensurethattheemail
isproperlyformatted.Iffalse,nocheckwilloccur
message_text
OptionalString.Addedtothemessageoftheinvitationandcanprovidefurther
instructions,awelcome,oranyotherpersonalizedtexttothepersoninvited.
Returns
Abooleanindicatingsuccess(True),orfaliure(False)
#UsageExample
>>>gis.users.invite("[email protected]",role=org_admin,provider=enterprise)
propertylicense_types¶
Thelicense_typesmethodreturnsalistofavailablelicensesassociatedwithagivenGIS.
Note
Theinformationreturnedcanhelpadministratorsdeterminewhattype
ofausershouldmebasedonthebundlesassociatedwitheachuser
type.Additionally,thelicense_typesisonlyavailableonArcGISEnterprise10.7+.**
Returns
AListofavailablelicenses
propertyme¶
ThemepropertyretrievestheinformationoftheloggedinUserobject.
org_search(query=None,sort_field=None,sort_order=None)¶
Theorg_searchmethodallowsuserstofinduserswithintheorganizationonly.
Userscansearchfordetailssuchasprovider,fullNameandotheruserproperties
wheretheotherusersearchesarelimited.Thisoperationwillnotshowanyuseroutside
theorganization.
Argument
Description
query
Optionalstring.Thequerystring.Seenotesabove.PassNone
togetlistofallusersintheorganization.
sort_field
Optionalstring.Validvaluescanbeusername(thedefault)orcreated.
sort_order
Optionalstring.Validvaluesareasc(thedefault)ordesc.
Returns
List[User]
propertyroles¶
Therolespropertyisahelperobjecttomanagecustomrolesforusers.
Returns
AninstanceoftheRoleManager
search(query=None,sort_field='username',sort_order='asc',max_users=100,outside_org=False,exclude_system=False,user_type=None,role=None)¶
Thesearchmethodsearchesportalusers,returningalistofusersmatchingthespecifiedquery.
Thesearchmethodisquitesimilartotheadvanced_searchmethod,
whichismorerefined.
Note
Afewthingsthatwillbehelpfultoknow.
Thequerysyntaxhasquiteafewfeaturesthatcan’t
beadequatelydescribedhere.PleaserefertotheArcGISREST
APISearchReference
fordetailsonthesearchengineusedwiththismethod.
Searchingwithoutspecifyingaqueryparameterreturns
alistofallusersinyourorganization.
Mostofthetimewhensearchingusersyouwantto
searchwithinyourorganizationinArcGISOnline
orwithinyourPortal.Asaconvenience,themethod
automaticallyappendsyourorganizationidtothequeryby
default.Ifyoudon’twanttheAPItoappendtoyourquery
setoutside_orgtoTrue.Ifyouusethisfeaturewithan
ORclausesuchasfield=xorfield=yyoushouldputthis
intoparenthesiswhenusingoutside_org.
Argument
Description
query
Optionalstring.Thequerystring.Seenotesabove.PassNone
togetlistofallusersintheorganization.
sort_field
Optionalstring.Validvaluescanbeusername(thedefault)orcreated.
sort_order
Optionalstring.Validvaluesareasc(thedefault)ordesc.
max_users
Optionalinteger.Themaximumnumberofuserstobereturned.Thedefaultis100.
outside_org
Optionalboolean.Thiscontrolswhethertosearchoutside
yourorganization.ThedefaultisFalse(searchonly
withinyourorganization).
exclude_system
Optionalboolean.Controlsifbuilt-insystemaccountsare
returnedornot.Truemeansbuilt-inaccountarenot
returned,whereasFalsemeansthattheyare.
user_type
OptionalString.Thisparametersallowsforthefiltering
oftheusersbytheirassignedtype.
role
OptionalString.SpecifytheroleId.Thisparameter
allowsforthefiltingoftheusersbasedonaroleId.
Returns
AlistofUserobjectsthatfitthequeryparameters.
#UsageExample
>>>gis.users.search(query="1234",sort_field="username",max_users=20)
send_notification(users,subject,message,type='builtin',client_id=None)¶
Thesend_notificationmethodcreatesausernotifcationforalistofusers.
Argument
Description
users
RequiredList.AlistofstringsorUserobjectstosendnotificationsto.
subject
RequiredString.Thenotificationsubjectline.
message
RequiredString.Thenotificationcontent.Thisshouldbeinplaintext.
type
OptionalString.Thenotificationcanbesentvariousways.Theseinclude:
builtin-Theenterprisebuilt-insystem
push-Thepushnotificationtosendamessageto
email-anotificationsenttotheuser’semailaccount
client_id
OptionalString.Theclientidforpushnotification.
Returns
Abooleanindicatingsuccess(True),orfailure(False)
#UsageExample
>>>gis.users.send_notification([user1,user1234,user123,user1234],"testingnotificationsystem",
"Thiswasatestofthesendingnotificationproperty")
signup(username,password,fullname,email)¶
ThesignupmethodisusedtocreateanewuseraccountinanArcGISEnterprisedeployment.
Argument
Description
username
Requiredstring.Thedesiredusername,whichmustbeuniqueinthePortal,
andatleast4characters.
password
Requiredstring.Thepassowrd,whichmustbeatleast8characters.
fullname
Requiredstring.Thefullnameoftheuser.
email
Requiredstring.Theemailaddressfortheuser.Thisisimportanttohavecorrect.
Returns
TheUserobjectifsuccessfullycreated,Noneifunsuccessful.
#UsageExample
>>>gis.users.signup("User1234","password1234","UserUser","[email protected]")
user_groups(users,max_results=-1)¶
GivensaListofUsers,theuser_groupsmethodwillreportbackallgroupids
thateachUserbelongsto.user_groupsisdesignedtobeareporting
toolforadministratorssotheycaneasilymanageauserorusersgroups.
propertyuser_settings¶
Gets/setstheuser’ssettings
Theuser_settingsallowsadministratorstoset,andedit,new
memberdefaults.Memberswhocreatetheirownbuilt-inaccountsand
membersaddedbyanadministratororthroughautomaticaccount
creationwillbeautomaticallyassignedthenewmemberdefaults.
PassinginNonetothepropertywilldeletealltheusersettings.
SettingsKey/ValueDictionary
Keys
Description
role
String/Role.TheroleID.Toassignacustomroleasthenewmemberdefault,
provideaRoleobject.
Values:administrator,publisher,editor,viewerorcustomRoleobject
userLicenseType
String.TheIDofausertypelicensedwithyourorganization.Toseewhich
usertypesareincludedwithyourorganization’slicensing,seetheLicense
resourceinthePortalAdminAPI.
Values:creator,editor,AdvancedGIS,BasicGIS,StandardGIS,
viewer,orfieldWorker
groups
ListofString/Groups.AnarrayofgroupIDnumbersorGroupobjectsthat
specifythegroupsnewmemberswillbeaddedto.
userType
String.ThiskeyonlyappliestoArcGISOnline.Ifnewmemberswillhave
Esriaccess(both)orifEsriaccesswillbedisabled(arcgisonly).Thedefault
valueisarcgisonly.
Values:arcgisonlyorboth
apps
Listofdictionaries.Anarrayofanapp’sitemIDand,whenapplicable,entitlement.
Example:{“apps”:[{“itemId”:“f761dd0f298944dcab22d1e888c60293”,”entitlements”:[“Insights”]}]}
appBundles
Listofdictionaries.Anarrayofanappbundle’sID.
Example:{“appBundles”:[{“itemId”:“99d7956c7e824ff4ab27422e2a26c2b7}]}
Returns
Dictionaryoftheusersettings
GroupManager¶
classarcgis.gis.GroupManager(gis)¶
Bases:object
TheGroupManagerclassisahelperclassformanagingGISgroups.
Aninstanceofthisclass,calledgroups,isavailableasapropertyofthe
GISobject.
Userscallmethodsonthis‘groups’objecttomanipulate(create,get,search,etc)users.
Note
Thisclassisnotcreatedbyusersdirectly.
create(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)¶
Thecreatemethodcreatesagroupwiththevaluesforanyparticularargumentsthatarespecified.
Note
Onlytitleandtagsarerequired.
Argument
Description
title
Requiredstring.Thenameofthegroup.
tags
Requiredstring.Acomma-delimitedlistoftags,or
listoftagsasstrings.
description
Optionalstring.Adetaileddescriptionofthegroup.
snippet
Optionalstring.Ashortsnippet(<250characters)
thatsummarizesthegroup.
access
Optionalstring.Choicesareprivate,public,ororg.
thumbnail
Optionalstring.URLorfilelocationtoagroupimage.
is_invitation_only
Optionalboolean.Defineswhetheruserscanjoinby
request.DefaultisFalsemeaninguserscanasktojoin
byrequestorjoinbyinvitation.
sort_field
Optionalstring.Specifieshowshareditemswith
thegrouparesorted.
sort_order
Optionalstring.Choicesareascordescforascending
ordescending,respectively.
is_view_only
Optionalboolean.Defineswhetherthegroupissearchable.
DefaultisFalsemeaningthegroupissearchable.
auto_join
Optionalboolean.Onlyappliestoorgaccounts.IfTrue,
thisgroupwillallowjoiningwithoutrequesting
membershipapproval.DefaultisFalse.
provider_group_name
Optionalstring.Thenameofthedomaingroup.
CreateanassociationbetweenaPortalgroupandan
ActiveDirectoryorLDAPgroup.
provider
Optionalstring.Nameoftheprovider.Requiredifthe
parameterprovider_group_nameisspecified.Exampleof
use:provider_group_name=“groupNameTest”,provider=“enterprise”
max_file_size
Optionalinteger.Thisisthemaximumfilesizeallowed
beuploaded/sharedtoagroup.Defaultvalueis:1024000
users_update_items
Optionalboolean.Memberscanupdateallitemsinthis
group.Updatestoanitemcanincludechangestothe
item’sdescription,tags,metadata,aswellascontent.
Thisoptioncan’tbedisabledoncethegrouphas
beencreated.DefaultisFalse.
display_settings
OptionalString.Definesthedefaultdisplayforthe
grouppagetoshowacertaintypeofitems.Theallowed
valuesare:apps,all,files,maps,layers,scenes,tools.
Thedefaultvalueisall.
is_open_data
OptionalBoolean.Defineswhetherthegroupcanbeused
intheOpenDatacapabilitiesofArcGISHub.Thedefault
isFalse.
leaving_disallowed
Optionalboolean.Defineswhetherusersarerestricted
fromchoosingtoleavethegroup.IfTrue,onlyan
administratorcanremovethemfromthegroup.Thedefault
isFalse.
Returns
TheGroupifsuccessfullycreated,Noneifunsuccessful.
#UsageExample
>>>gis.groups.create(title="NewGroup",tags="new,group,USA",
>>>description="anewgroupintheUSA",access="public")
create_from_dict(dict)¶
Thecreate_from_dictmethodcreatesagroupviaadictionarywiththevaluesforanyparticulararguments
thatarespecified.
Note
Onlytitleandtagsarerequired.
Argument
Description
dict
Requireddictionary.Adictionaryofentriestocreate/definethe
group.Seehelpofthecreatemethodforparameters.
Returns
TheGroupifsuccessfullycreated,Noneifunsuccessful.
get(groupid)¶
ThegetmethodretrievestheGroupobjectforthespecifiedgroupid.
Argument
Description
groupid
Requiredstring.Thegroupidentifier.
Returns
TheGroupobjectifthegroupisfound,Noneifitisnotfound.
search(query='',sort_field='title',sort_order='asc',max_groups=1000,outside_org=False,categories=None)¶
Thesearchmethodsearchesforportalgroups.
Note
Afewthingsthatwillbehelpfultoknow.
Thegroupsearchsyntaxhasmanyfeaturesthatcan’t
beadequatelydescribedhere.SeetheSearchReference
pageintheArcGISRESTAPIformoreinformation.
Searchingwithoutspecifyingaqueryparameterreturns
alistofallgroupsinyourorganization.
Mostofthetimewhensearchingforgroups,you’llwantto
searchwithinyourorganizationinArcGISOnline
orwithinyourPortal.Asaconvenience,themethod
automaticallyappendsyourorganizationidtothequeryby
default.Ifyoudon’twanttheAPItoappendtoyourquery
setoutside_orgtoTrue.
Argument
Description
query
OptionalstringonPortal,orrequiredstringforArcGISOnline.
Ifnotspecified,allgroupswillbesearched.Seenotesabove.
sort_field
Optionalstring.Validvaluescanbetitle,owner,
created.
sort_order
Optionalstring.Validvaluesareascordesc.
max_groups
Optionalinteger.Maximumnumberofgroupsreturned,defaultis1,000.
outside_org
Optionalboolean.Controlswhethertosearchoutside
yourorg.DefaultisFalse,donotsearchoursideyourorg.
categories
Optionalstringorlist.Astringofcategoryvalues.
Returns
AListofGroupobjectsmatchingthespecifiedquery.
#UsageExample
>>>gis.groups.search(query="HurricaneTrackers",categories="Hurricanes,USA,NaturalDisasters",
>>>sort_field="title",sort_order="asc")
GroupMigrationManager¶
classarcgis.gis.GroupMigrationManager(group)¶
Bases:object
TheGroupMigrationManagerclassallowsgroupstoexportandimportdatatoandfromEPKfiles.
create(items=None,future=True)¶
ThecreatemethodexportsaGroupcontenttoanEPKPackageItem.
EPKItemsareintendedtomigratecontentfromanenterprisedeploymenttoanew
enterprise.OnceanEPKItemiscreatedusingthismethod,youcanusetheload
toingestthepackage’scontentintothetargetenterprise.Ifyourpackage
containswebmaps,web-mappingapplications,and/orassociatedweblayers,during
theimportoperation,themethodwilltakescareofswizzlingtheserviceURLsand
itemIDscorrectly.
..note:
Therearesomelimitstothisfunctionality.Packagesshouldbeunder10GBinsize
andonlyhostedfeaturelayers,webmaps,web-mappingapps,andothertext-based
itemsaresupported.Youneedtohave**administrative**privilegestorunthis
operation.
Argument
Description
items
OptionalList- .Asetofitemstoexportfromthegroup.If
nothingisgiven,allitemswillbeattemptedtobeexported.
future
OptionalBoolean.WhenTrue,theoperationwillreturnaJobobject
andreturntheresultsasynchronously.
Returns
Item–or–StatusJobwhenfuture=True
inspect(epk_item)¶
TheinspectmethodretrievesthecontentsoftheEPKPackage
===============================================================================================
KeysDescription
—————-——————————————————————————-
epk_itemRequiredItem.AreportonthecontentoftheEPKItem.Thisallowsadministrators
toviewthecontentsinsideaEPK.
load(epk_item,item_ids=None,overwrite=True,future=True,folder_id=None,folder_owner=None)¶
TheloadmethodimportstheEPKcontentintothecurrentGroup.
..note:
Administrativeprivilegesarerequiredtorunthisoperation.
Onceimported,itemswillbeownedbytheimporter,andwillhave
tobemanuallyreassignedtotheproperownerifneeded.
Keys
Description
epk_item
RequiredItem.AreportonthecontentoftheEPKItem.Thisallowsadministrators
toviewthecontentsinsideaEPK.
item_ids
Optionallist.AlistofitemIDstoimporttotheorganization.
overwrite
Optionalbool.IftheItemsimportexist,ortheItemIDthatisinuse
already,itwilldeletetheolditemandreplaceitwiththisone.
future
Optionalbool.WhenTrue,theloadwillreturnaJobobjectandwillnot
pausethecurrentthread.WhenFalseloadwilloccurinasynchronous
fashionpausingthethread.Ifyouareloadinglargeamountsofdata,set
futuretoTruetoreducetime.
folder_id
OptionalString.InArcGISOnlineandEnterprise10.9+,ausercanspecifythedestinationfolderIDfortheitems.
folder_owner
OptionalString.InArcGISOnlineandEnterprise10.9+,ausernameofthefolderowner.
Returns
Adictionary–or–StatusJobwhenfuture=True
DatastoreManager¶
classarcgis.gis.DatastoreManager(gis,admin_url,server)¶
Bases:object
TheDatastoreManagerclassisahelperclassformanagingtheGISdatastoresinArcGISEnterprise.
Instancesofthisclassarereturnedfromget_datastoresand
Datastorefunctionstogetthecorrespondingdatastores.
UserscallmethodsonthisDatastoreobjecttomanagethedatastoresinasite
federatedwiththeEnterpriseportal.
Note
Thisclassisnotcreatedbyusersdirectly.
add(name,item)¶
TheaddmethodregistersanewdataItemwiththe:class:~arcgis.gis.Datastore.
Argument
Description
name
Requiredstring.Thenameoftheitemtobeaddedontheserver.
item
Requireddictionary.Thedictionaryrepresentingthedataitem.
SeeDataItem
intheArcGISRESTApIdocumentationformoredetails.
Returns
ThenewdataItemifregisteredsuccessfully,Noneotherwise.
#UsageExample
>>>arcgis.geoanalytics.get_datastores.add("name",{})
add_amazon_s3(name,bucket_name,access_key,access_secret,region,folder=None,default_protocal='https')¶
AllowsadministratorstoregisteredAmazonS3BucketsasaDatastoreobject.
Argument
Description
name
Requiredstring.ThenameoftheAmazonS3instance.
bucket_name
RequiredString.ThenameoftheS3bucket.
access_key
RequiredString.ThekeyvaluefortheS3Bucket.
access_secret
RequiredString.TheaccesssecretvaluefortheS3bucket.
region
RequiredString.TheAmazonregionasastring.
folder
OptionalString.TheS3folderwithintheS3Bucket.
default_protocal
OptionalString.TheURLschemetocontacttheS3bucket.
Returns
ADatastoreobject
#UsageExample
>>>arcgis.geoanalytics.get_datastores.add_amazon_s3("bucket_name","access_key","access_secret","region")
add_bigdata(name,server_path=None,connection_type='fileShare')¶
Theadd_bigdatamethodregistersabigdatafilesharewiththeDatastore.
Argument
Description
name
Requiredstring.Theuniquebigdatafilesharenameontheserver.
server_path
Optionalstring.Thepathtothefolderfromtheserver.
connection_type
Optionalstring.Allowsforthesettingofthetypesofbigdatastore.
Thevalue‘fileShare’isusedforlocalbigdatastores,andfor
cloudstores,theconnection_typeshouldbe‘dataStore’.Thevalue
‘fileShare’isthedefaultvalue.
Returns
Thebigdatafileshareifregisteredsuccessfully,Noneotherwise.
#UsageExample
>>>arcgis.geoanalytics.get_datastores.add_bigdata("name")
add_cloudstore(name,conn_str,object_store,provider,managed=False,folder=None)¶
Theadd_cloudstoremethodaddsaCloudStoredataItem.
CloudStoredataitemrepresentsaconnectiontoaAmazonorMicrosoftAzurestore.
Connectioninformationforthedatastoreitemisstoredwithinconn_strasa
stringifiedJSON.ArcGISServerencryptsconnectionstringforstorage.Connection
stringsthatareencryptedwillincludea{crypt}prefix.
Note
YoucangetaDatastore
itemwithdecryptedconnectionstringbypassingadecrypt=trueparameterintherequest
foradatastoreitem.Datastorewithdecryptedconnectionstringwillbereturnedonlyfor
requestsmadewithhttps.Theexamplesbelowshowdatastoreswithdecryptedconn_str.
Avalidobject_store(S3bucketorAzureBlobstore)isrequired.Folderswithinanobject
storeareoptional.
Argument
Description
name
Requiredstring.Thenameofthecloudstore.
conn_str
Requiredstring.Theconnectioninformationforthecloudstorage
product.
object_store
Requiredstring.ThisistheamazonbucketpathorAzuzepath.
provider
Requiredstring.Valuesmustbeazuredatalakestore,amazon,
Alibaba,orazure.
managed
Optionalboolean.Whenthedatastoreisserveronly,thedatabase
isentirelymanagedandownedbytheserverandcannotbeaccessed
bythepublisherdirectly.Whenthisoptionischosen,the
managedpropertyshouldbesettotrue.Otherwiseitisfalse.
folder
Optionalstring.ForsomeAzurecloudstores,anoptionalfolder
canbespecified.
Returns
ADatastoreobject
#UsageExample
>>>arcgis.geoanalytics.get_datastores.add_cloudstore("name","connection_info","path","provider")
add_database(name,conn_str,client_conn_str=None,conn_type='shared')¶
Theadd_databasemethodregistersadatabasewiththeDatastore.
Argument
Description
name
Requiredstring.Theuniquedatabasenameontheserver.
conn_str
Requiredstring.thepathtothefolderfromtheserver(andclient,ifsharedorserverOnlydatabase).
client_conn_str
Optionalstring.Theconnectionstringforclienttoconnecttoreplicatedenterprisedatabase.
conn_type
Optionalstring.Choiceof“”,sharedisthedefault.
Returns
Thedatabaseifregisteredsuccessfully,Noneotherwise.
#UsageExample
>>>arcgis.geoanalytics.get_datastores.add_databse("name","connection_info")
add_folder(name,server_path,client_path=None)¶
Theadd_foldermethodregistersafolderwiththeDatastore.
Argument
Description
name
Requiredstring.Theuniquefilesharenameontheserver.
server_path
Requiredstring.Thepathtothefolderfromtheserver(andclient,ifsharedpath).
client_path
Optionalstring.Iffolderisreplicated,thepathtothefolderfromtheclient.
Returns
Thefolderifregisteredsuccessfully,Noneotherwise.
#UsageExample
>>>arcgis.geoanalytics.get_datastores.add_folder("filesharename","folder_path","clienth_path")
add_ms_azure_storage(cloud_storage_name,account_key,account_name,container_name,folder=None)¶
Theadd_ms_azure_storagecreatesacloudstorewithMicrosoftAzure.
Argument
Description
cloud_storage_name
Requiredstring.Thenameofthestorageentry.
access_key
RequiredString.ThekeyvaluefortheAzurestorage.
access_secret
RequiredString.TheaccesssecretvaluefortheAzurestorage.
container_name
RequiredString.Thecontainerholdingthedata.
folder
OptionalString.TheAzurefolderwithinthedatastoreitem.
Returns
ADatastoreobject
#UsageExample
>>>arcgis.geoanalytics.get_datastores.add_ms_azure_storage("name","key","secret","cont_name")
propertyconfig¶
Theconfigmethodretrievesandsetsthedatastoreconfigurationproperties,whichaffectthebehaviorof
thedataholdingsoftheserver.ThepropertiesincludeblockDataCopy.WhenthispropertyisFalse,ornot
setatall,copyingdatatothesitewhenpublishingservicesfromaclientapplicationisallowed.Thisisthe
defaultbehavior.WhenthispropertyisTrue,theclientapplicationisnotallowedtocopydatatothesite
whenpublishing.Rather,thepublisherisrequiredtoregisterdataitemsthroughwhichtheservicebeing
publishedcanreferencedata.
Argument
Description
value
Requiredbool.
Values:True|False
..note:
Ifyouspecifythepropertyas``True``,userswillnotbeable
topublish``geoprocessingservices``and``geocodeservices``
fromcompositelocators.Theseservicetypesrequiredatatobe
copiedtotheserver.
Asaworkaround,youcantemporarilysetthepropertyto``False``,
publishtheservice,andthensetthepropertybackto``True``.
Returns
ADictionaryindicating‘success’or‘error’
get(path)¶
ThegetmethodretrievesthedataItemobjectatthegivenpath.
Argument
Description
path
Requiredstring.Thepathforthedataitem.
Returns
Thedataitemobjectiffound,Noneotherwise.
search(parent_path=None,ancestor_path=None,types=None,id=None)¶
Thesearchmethodisusedtosearchthroughthevariousdata
itemsregisteredintheserver’sdatastore.Searchingwithout
specifyingtheparentpathandotherparametersreturnsalist
ofallregistereddataitems.
Argument
Description
parentPath
Optionalstring.Thepathoftheparentunderwhichtofinditems.
Pass‘/’togettherootdataitems.
ancestorPath
Optionalstring.Thepathoftheancestorunderwhichtofinditems.
types
Optionalstring.Acommaseparatedfilterforthetypeoftheitems.
Typesincludefolder,egdb,bigDataFileShare,datadir.
id
Optionalstring.AfiltertosearchbytheIDoftheitem.
Returns
Alistofdataitemsmatchingthespecifiedquery.
#UsageExample
>>>arcgis.geoanalytics.get_datastores.search(parentPath="parent_path",
ancestorPath="ancestor_path",id="id")
validate()¶
ThevalidatemethodvalidatesallitemsintheDatastore.Inorderforadataitem
toberegisteredandusedsuccessfullywithintheGIS’sdatastore,youneedtomakesurethatthepath
(forfileshares)orconnectionstring(fordatabases)isaccessibletoeveryserver
nodeinthesite.Tovalidateallregistereddataitemsall
atonce,youcaninvokethisoperation.
Returns
Abooleanindicatingsuccessfulvalidation(True),orfailedvalidation(False)
RoleManager¶
classarcgis.gis.RoleManager(gis)¶
Bases:object
TheRoleManagerclassisahelperclasstomanagecustomrolesfor
UserinaGIS.Itisavailableastheroles
propertyoftheUserManager
Note
Usersdon’tcreatethisclassdirectly.
#UsageExample
>>>role_mgr=gis.users.roles
>>>type(role_mgr)
all(max_roles=1000)¶
TheallmethodprovidesalistcontainingthedefaultViewerandDataEditorroles,plusany
customrolesdefinedintheGIS.(Theorg_admin,org_user,
andorg_publisherdefaultrolesarenotreturned.SeeDefaultroles
fordetaileddescriptionsofeachrole.)
Argument
Description
max_roles
Requiredinteger.Themaximumnumberofrolestobereturned,defaultsto1000.
Returns
Thelistofallcustomroles,plusthedefaultViewer
andDataEditorrolesdefinedintheGIS.
#UsageExample
>>>primary_default_roles=['org_admin','org_publisher','org_user']
>>>role_mgr=gis.users.roles
>>>org_roles=role_mgr.all()
>>>forroleinorg_roles:
print(f"{role.name:25}{role.role_id}"
VieweriAAAAAAAAAAAAAAA
DataEditoriBBBBBBBBBBBBBBB
Analyzer8KqWobO1p1vDLZ2O
Sharing_analystZllNulU2kqaFwsaH
Group_creatoruT3334C4LtnQ99Cj
>>>all_org_roles=primary_default_roles+[r.nameforrinorg_roles]
>>>print(all_org_roles)
['org_admin','org_publisher','org_user','Viewer','DataEditor','Analyzer','Sharing_analyst','Group_creator']
SeethecreatemethodofUserManagerforusing
roleinformationwhencreatingusers.
create(name,description,privileges=None)¶
ThecreatemethodcreatesacustomRolewiththespecifiedparameters.
Argument
Description
name
Requiredstring.Thecustomrole’sname.
description
Requiredstring.Thecustomrole’sdescription.
privileges
Optionalstring.Anarrayofstringswithpredefinedpermissionswithin
eachprivilege.Forsupportedprivilegesseethe
Privileges
pageintheArcGISRESTAPIdocumentation.
Returns
Thecustomroleobjectifsuccessfullycreated,Noneifunsuccessful.
#UsageExample
>>>role_mgr=gis.users.roles
>>>role_mgr.create("name_role","role_description")
exists(role_name)¶
TheexistsmethodcheckstoseeifaRoleobjectexistsgiventhedeclaredrolename.
Argument
Description
role_name
Requiredstring.Thenameoftheroletodetermineifitexistsornot.
Returns
Trueiftheroleexists,andFalseifitdoesnot.
#UsageExample
>>>role_mgr=gis.users.roles
>>>role_mgr.exists("name_role")
get_role(role_id)¶
Theget_rolemethodretrievestheRoleobjectwiththespecifiedcustomroleId.
Argument
Description
role_id
Requiredstring.TheroleIDofthecustomroletoget.
Returns
TheRoleobjectassociatedwiththespecifiedroleID
ResourceManager¶
classarcgis.gis.ResourceManager(item,gis)¶
Bases:object
TheResourceManagerclassisahelperclassformanagingresourcefilesofanitem.
AninstanceofthisclassisavailableasapropertyoftheItemobject
(Seeresourcesformoreinformationonthisproperty).
Userscallmethodsonthisresourcesobjecttomanage
(add,remove,update,list,get)itemresources.
Note
Usersdonotcreatethisclassdirectly.
add(file=None,folder_name=None,file_name=None,text=None,archive=False,access=None,properties=None)¶
Theaddoperationaddsnewfileresourcestoanexistingitem.Forexample,animagethatis
usedascustomlogoforReportTemplate.Allthefilesareaddedto‘resources’folderoftheitem.File
resourcesusestoragespacefromyourquotaandarescannedforviruses.Theitemsizeisupdatedto
includethesizeofaddedresourcefiles.
Note
Eachfileaddedshouldbenomorethan25Mb.
Supporteditemtypesthatallowaddingfileresourcesare:VectorTileService,VectorTilePackage,
Style,CodeAttachment,ReportTemplate,WebMappingApplication,FeatureService,WebMap,
StatisticalDataCollection,SceneService,andWebScene.
Supportedfileformatsare:JSON,XML,TXT,PNG,JPEG,GIF,BMP,PDF,MP3,MP4,andZIP.
Thisoperationisonlyavailabletotheitemownerandtheorganizationadministrator.
Argument
Description
file
Optionalstring.Thepathtothefilethatneedstobeadded.
folder_name
Optionalstring.Provideafoldernameifthefilehastobe
addedtoafolderunderresources.
file_name
Optionalstring.Thefilenameusedtorenameanexistingfile
resourceuploaded,ortobeusedtogetherwithtextasfilenameforit.
text
Optionalstring.Textinputtobeaddedasafileresource,
usedtogetherwithfile_name.Ifthisresourceisused,then
file_namebecomesrequired.
archive
Optionalboolean.DefaultisFalse.IfTrue,fileresources
addedareextractedandfilesareuploadedtorespectivefolders.
access
OptionalString.Setfileresourcetobeprivateregardlessof
theitemaccesslevel,orrevertitbysettingittoinherit
whichmakestheitemresourcehavethesameaccessastheitem.
Supportedvalues:privateorinherit.
properties
OptionalDictionary.Setthepropertiesfortheresourcessuch
astheeditInfo.
Returns
Pythondictionaryinthefollowingformat(ifsuccessful):
{
”success”:True,
“itemId”:“”,
“owner”:“”,
“folder”:“”}
elselikethefollowingifitfailed:
{“error”:{
”code”:400,
“messageCode”:“CONT_0093”,
“message”:“FiletypenotallowedforaddResources”,
“details”:[]
}}
#UsageExample
>>>Item.resources.add("file_path","folder_name","file_name",access="private")
export(save_path=None,file_name=None)¶
Theexportmethodexport’sthedata’sresourcesasazipfile
#UsageExample
>>>Item.resources.export("file_name")
Returns
A.zipfilecontainingthedata’sresources
get(file,try_json=True,out_folder=None,out_file_name=None)¶
Thegetmethodretrievesaspecificfileresourceofanexistingitem.
Note
Thisoperationisonlyavailabletotheitemownerandtheorganizationadministrator.
Argument
Description
file
Requiredstring.Thepathtothefiletobedownloaded.
Forfilesintheroot,justspecifythefilename.Forfilesin
folders(prefixes),specifyusingtheformat
/./../
try_json
Optionalboolean.IfTrue,willattempttoconvertJSONfilesto
Pythondictionaryobjects.DefaultisTrue.
out_folder
Optionalstring.Specifythefolderintowhichthefilehasto
besaved.Defaultisuser’stemporarydirectory.
out_file_name
Optionalstring.Specifythenametousewhendownloadingthe
file.Defaultistheresourcefile’sname.
Returns
Pathtothedownloadedfileifgettingabinaryfile(likeajpegorpngfile)orif
try_jon=FalsewhengettingaJSONfile.
IffileisaJSON,returnsasaPythondictionary.
#UsageExample
>>>Item.resources.get("file_path",try_json=True,out_folder="out_folder_name")
list()¶
Thelistmethodprovidesalistsallfileresourcesofanexistingitem.
Note
Thisresourceisonlyavailableto
theitemownerandtheorganizationadministrator.
Returns
APythonlistofdictionariesoftheform:
[
{“resource”:“”
},
{
”resource”:“”
},
{
”resource”:“”
}
]
remove(file=None)¶
Theremovemethodremovesasingleresourcefileorallresources.Theitemsizeisupdatedonce
resourcefilesaredeleted.
Note
Thisoperationisonlyavailabletotheitemowner
andtheorganizationadministrator.
Argument
Description
file
Optionalstring.Thepathtothefiletoberemoved.
Forfilesintheroot,justspecifythefilename.Forfilesin
folders(prefixes),specifyusingtheformat
/./../
Ifnotspecified,allresourcefileswillberemoved.
Returns
Ifsuccessful,abooleanofTruewillbereturned.
Else,adictionarywitherrorinformationwillbereturnedinthefollowingformat:
{“error”:{“code”:404,
”message”:“Resourcedoesnotexistorisinaccessible.”,
“details”:[]
}
}
#UsageExample
>>>Item.resources.remove("file_path")
update(file,folder_name=None,file_name=None,text=None)¶
Theupdateoperationallowsyoutoupdateexistingfileresourcesofanitem.
Fileresourcesusestoragespacefromyourquotaandarescannedforviruses.Theitemsize
isupdatedtoincludethesizeofupdatedresourcefiles.
Supportedfileformatsare:JSON,XML,TXT,PNG,JPEG,GIF,BMP,PDF,andZIP.
Thisoperationisonlyavailabletotheitemownerandtheorganizationadministrator.
Argument
Description
file
Requiredstring.Thepathtothefileondisktobeusedfor
overwritinganexistingfileresource.
folder_name
Optionalstring.Provideafoldernameifthefileresource
beingupdatedresidesinafolder.
file_name
Optionalstring.Thedestinationnameforthefileusedtoupdate
anexistingresource,ortobeusedtogetherwiththetextparameter
asfilenameforit.
Forexample,youcanusefileName=banner.pngtoupdateanexisting
resourcebanner.pngwithafilecalledbillboard.pngwithout
renamingthefilelocally.
text
Optionalstring.Textinputtobeaddedasafileresource,
usedtogetherwithfile_name.
Returns
Ifsuccessful,adictionarywithwillbereturnedinthefollowingformat:
{
”success”:True,
“itemId”:“”,
“owner”:“”,
“folder”:“”}
elseadictionarywitherrorinformationwillbereturnedinthefollowingformat:
{“error”:{
”code”:404,
“message”:“Resourcedoesnotexistorisinaccessible.”,
“details”:[]
}}
#UsageExample
>>>Item.resources.add("file_path","folder_name","file_name")
APIKeyManager¶
classarcgis.gis._impl.APIKeyManager(gis)¶
Bases:object
TheAPIKeyManagercreates,managesandupdatesAPIKeyobjectsforArcGISOnline.
create(title,tags,description=None,http_referers=None,redirect_uris=None,privileges=None)¶
ThecreatemethodgeneratesanewAPIKeyobjectsfortheOrganization.
Parameter
Description
title
RequiredString.ThenameoftheAPIKeyItem.
tags
RequiredString.Acommaseperatedlistofdescriptivewordsdescribingthe
APIKeyitem.
description
OptionalString.AdescriptionofwhattheAPIKeyisgoingtobeusedfor.
http_referers
OptionalList.Alistofthehttpreferrersforwhichusageofthe
APIKeywillberestrictedto.
Example
`
[
"https://foo.com",
"https://bar.com"
]
`
Note:HttpReferrerscanbeconfiguredfornonapiKeytypeappsas
well.Thelistconfiguredherewillbeusedtovalidatetheapp
tokenssentinwhileaccessingthesharingAPI.Thereferrerchecks
willnotbeappliedtousertokens.
redirect_uris
Optionallist.TheURIswheretheaccess_tokenorauthorization
codewillbedelivereduponsuccessfulauthorization.The
redirect_urispecifiedduringauthorizationmustmatchoneofthe
registeredURIs,otherwiseauthorizationwillberejected.
Aspecialvalueofurn:ietf:wg:oauth:2.0:oobcanalsobespecified
forauthorizationgrants.Thiswillresultintheauthorization
codebeingdeliveredtoaportalURL(/oauth2/approval).This
valueistypicallyusedbyappsthatdon’thaveawebserverora
customURIschemewherethecodecanbedelivered.
ThevalueisaJSONstringarray.
privileges
OptionalList.Alistoftheprivilegesthatwillbeavailablefor
thisAPIkey.
Note
PrivilegescanbeconfiguredfornonAPIKeytypeappsas
well.Thelistconfiguredherewillbeusedtograntaccesstoitems
whenitemendpointisaccessedwithapptokens.Thecheckswillnot
beappliedtousertokensandtheycancontinueaccessingitems
basedonthecurrentitemsharingmodel.Withapptokens,allitems
ofappownercanbeaccessediftheprivilegeslistisnot
configured.
Returns
AnAPIKeyobject
#UsageExample
>>>gis.api_keys.create(title="title_name",tags="tags,apiKey,Manager",
>>>http_referers=["https://foo.com","https://bar.com"],
>>>privleges=["portal:apikey:basemaps","portal:app:access:item:itemId",
>>>"premium:user:geocode","premium:user:networkanalysis"])
get(api_key=None,title=None)¶
ThegetmethodretrievesanAPIKey
objectbasedontheKeyValueoritstitle.
#UsageExample-GettingAPIKeyusingkeystring
>>>gis.api_keys.get(api_key='key_string')
#GettingapikeyusingkeyItem'stitle
>>>gis.api_keys.get(title='project1_key1')
Returns
AnAPIKeyobject
propertykeys¶
ThekeyspropertyretrievesatupleofAPIKeyobjectsregisteredwiththe
Organization.
Returns
Atupleof
APIKeyobjects
validate(api_key,privileges=None)¶
ThevalidatemethodchecksifanAPIKeyobjecthasaspecificprivilege.
Parameter
Description
api_key
RequiredAPIKey.Thekeytovalidateagainst.
privileges
OptionalList.Thelistoftheprivilegestocheckfor.Thelistconsistsof
alistofstringvalues.
Returns
Abooleanindicatingsuccess(True),orfailure(False)
#UsageExample
>>>gis.APIKeyManager.validate(ApiKey1)
APIKey¶
classarcgis.gis._impl.APIKey(item,gis)¶
Bases:object
TheAPIKeyclassisasingleinstanceofaregisteredaccesskeyfor
performingcertainoperationsbasedonpermissions.
UserscancreateanAPIKeyinstanceasshownbelow:
#Gettingfromalistofkeys
>>>key1=gis.api_keys.keys[0]
#Gettingakeyusing
>>>key2=gis.api_keys.get('key_value')
propertyapikey¶
TheapikeypropertyretrievestheAPIKeyvalueforthecurrentkey.
Returns
String
delete()¶
ThedeletemethoddeletesthecurrentAPIKeyobjectpermanently.
Returns
Abooleanindicatingsuccess(True),orfailure(False)
propertyproperties¶
ThepropertiespropertyretrievesthepropertiesofthecurrentAPIKeyobject.
Returns
Adictionarycontainintheproperties(ifany)ofthecurrentAPIKeyobject.
reset()¶
ResetstheAPIKeyfortheItem.Thecallwillreturntheinformation
withthenewAPIKeyinformation.
Returns
AdictionarywiththeAPIKeyobjectinformation
update(http_referers=None,privileges=None)¶
TheupdatemethodupdatesthecurrentAPIKeyobject’sproperties
Parameter
Description
http_referers
OptionalList.Alistofthehttpreferrersforwhichusageofthe
APIKeywillberestrictedto.
Example
`
[
"https://foo.com",
"https://bar.com"
]
`
Note:HttpReferrerscanbeconfiguredfornonapiKeytypeappsas
well.Thelistconfiguredherewillbeusedtovalidatetheapp
tokenssentinwhileaccessingthesharingAPI.Thereferrerchecks
willnotbeappliedtousertokens.
privileges
OptionalList.Alistoftheprivilegesthatwillbeavailablefor
thisAPIkey.
Example
```
[
“portal:apikey:basemaps”,
“portal:app:access:item:itemId”,
“premium:user:geocode”,
“premium:user:networkanalysis”
]
```
Note:PrivilegescanbeconfiguredfornonAPIKeytypeappsas
well.Thelistconfiguredherewillbeusedtograntaccesstoitems
whenitemendpointisaccessedwithapptokens.Thecheckswillnot
beappliedtousertokensandtheycancontinueaccessingitems
basedonthecurrentitemsharingmodel.Withapptokens,allitems
ofappownercanbeaccessediftheprivilegeslistisnot
configured.
Returns
Adictionary
#UsageExample
>>>key1=gis.api_keys.keys[0]
>>>key1.update(http_referers=["https://foo.com","https://bar.com"],
>>>privileges=["portal:apikey:basemaps",
>>>"portal:app:access:item:itemId",
>>>"premium:user:geocode",
>>>"premium:user:networkanalysis"])
ProfileManager¶
classarcgis.gis._impl._profile.ProfileManager¶
Bases:object
TheProfileManagerclassallowsforthecontrolsandmanagementofthe
profilesstoredonthelocaloperatingsystem.
create(profile,url=None,username=None,password=None,key_file=None,cert_file=None,client_id=None)¶
ThecreatemethodaddsanewentryintotheProfileStore.
Parameter
Description
profile
RequiredString.Thenameoftheprofiletoadd.
url
OptionalString.Thesiteurl.
username
OptionalString.Theloginusername.
password
OptionalString.Theloginuserpassword.
key_file
OptionalString.ThekeyfileforPKIsecurity.
cert_file
OptionalString.ThecertfileforPKIsecurity.
client_id
OptionalString.TheclientIDforoauthlogin.
Returns
Abooleanindicatingsuccess(True),orfailure(False)
#UsageExample
>>>gis.ProfileManager.create("profile_name",
>>>url="www.foo.com",
>>>username="User1234",
>>>password="Password1234",
>>>key_file="key_file",
>>>cert_fle="cert_file_name")
delete(profile)¶
Thedeletemethoddeletesaprofilepermanentlyfromthe.arcgisprofilefile
Parameter
Description
profile
RequiredString.Thenameoftheprofiletodelete.
Returns
Abooleanindicatingsuccess(True),orfailure(False)
#UsageExample
>>>gis.ProfileManager.delete("profile_name")
get(profile)¶
Thegetmethodretrievestheprofileinformationforagivenentry.
Parameter
Description
profile
RequiredString.Thenameoftheprofiletogettheinformationabout.
Returns
Adictionary
#UsageExample
>>>gis.ProfileManager.get("profile_name")
list(as_df=False)¶
Thelistmethodretrievesalistofprofilenamesintheconfigurationfile
Returns
Listifas_df=FalseorPandasDataFrameifas_df=True
save_as(profile,gis)¶
Thesave_asmethodsavesandaddstheprovidedGISobjecttotheprofile.
Parameter
Description
name
RequiredString.Thenameoftheprofiletosave.
gis
RequiredGIS.Theconnectionobjecttoupdatetheprofilewith.
Returns
Boolean.TrueifsuccessfulelseFalse
#UsageExample
>>>gis=GIS("pro")
>>>gis.ProfileManager.save_as("Profile_name",gis)
update(profile,url=None,username=None,password=None,key_file=None,cert_file=None,client_id=None)¶
Theupdatemethodupdatesanexistingprofileinthecredentialmanager.
Parameter
Description
profile
RequiredString.Thenameoftheprofiletoupdate.
url
OptionalString.Thesiteurl.
username
OptionalString.Theloginusername.
password
OptionalString.Theloginuserpassword.
key_file
OptionalString.ThekeyfileforPKIsecurity.
cert_file
OptionalString.ThecertfileforPKIsecurity.
client_id
OptionalString.TheclientIDforoauthlogin.
Returns
Abooleanindicatingsuccess(True),orfailure(False)
#UsageExample
>>>gis.ProfileManager.update(profile="profile_name1",
>>>username="User12345",
>>>key_file="new_key_file")
InvitationManager¶
classarcgis.gis._impl._invitations.InvitationManager(url,gis)¶
Bases:object
TheInvitationManagerprovidesfunctionalitytoseetheexistinginvitations
setoutviaemailtoyourorganization.
Note
Themanagerhastheabilitytodelete
anyinvitationsentoutbyanorganization.
delete(invite_id)¶
ThedeletemethoddeletesaninvitationbyID
Returns
Abooleanindicatingsuccess(True),orfailure(False)
get(invite_id)¶
Thegetmethodretrievesinformationaboutasingleinvitation.
Returns
Adictionary
list()¶
Thelistmethodretrievesalltheorganization’sinvitations.
Returns
AListoftheorganization’sinvitations
manage_invitations(accepts=None,declines=None)¶
Themanage_invitationsmethodallowsuserstoAccept/Declineinvitationsbyprovidingalistof
invitationIDs.
Returns
AListofinvitationIDs
CertificateManager¶
classarcgis.gis._impl.CertificateManager(gis)¶
Bases:object
TheCertificateManagerclassprovidestheadministratortheabilityto
registerandunregistercertificateswiththeGIS.
Note
Thisresourceis
availableviaHTTPSonly.
add(name,domain,certificate)¶
Theaddmethodallowsallowsadministratorsto
registercustomX.509HTTPScertificateswiththeirArcGISOnline
organizations.ThiswillallowArcGISOnlineorganizationtotrust
thecustomcertificatesusedbyaremoteserverwhenmakingHTTPS
requeststoit,i.e.storecredentialsrequiredtoaccessits
resourceandsharewithothers.
Note
Amaximumof5certificatescanberegisteredwithanorganization.
Parameter
Description
name
RequiredString.Thecertificatename.
domain
RequiredString.Serverdomainthatthecertificateisusedfor.
certificate
RequiredString.Base64-encodedcertificatetext,enclosedbetween
—–BEGINCERTIFICATE—–and—–ENDCERTIFICATE—–.
Returns
Abooleanindicatingsuccess(True),orfailure(False)
#UsageExample
>>>gis.admin.certificates.add(name="certificate_name",
>>>domain="domain_name",
>>>certificate="certificate_text")
propertycertificates¶
Thecertificatespropertyretrievesthelistofcertificatesregisteredwiththeorganization
Returns
AListcontainingtheinformationofregisteredcertificates
delete(cert_id)¶
Thedeletemethodunregistersthecertificatefromtheorganization.
Parameter
Description
cert_id
RequiredString.TheIDofthecertificatetodelete.
Returns
Abooleanindicatingsuccess(True),orfailure(False)
#UsageExample
>>>gis.admin.certificates.delete(cert_id="certificate_id")
get(cert_id)¶
Thegetmethodretrievesthecertificateinformationforasinglecertificate
Parameter
Description
cert_id
RequiredString.TheIDofthecertificatetodelete.
#UsageExample
>>>gis.admin.certificates.get(cert_id="certificate_id")
Returns
ADictionary(iffound),elseNone
Thedictionarycontainsthefollowinginformation:
Key
Value
id
TheIDoftheregisteredcertificate.
name
Thecertificatename.
domain
Serverdomainthatthecertificateisusedfor.
sslCertificate
Base64-encodedcertificatetext,enclosedbetween—–BEGINCERTIFICATE—–and—–ENDCERTIFICATE—–.
propertyproperties¶
Thepropertiesmethodretrievesthepropertiesofthecertificate
Returns
Alistofthecertificateproperties
update(cert_id,name=None,domain=None,certificate=None)¶
Theupdateoperationallowsorganization’s
administratorstoupdatearegisteredcustomX.509HTTPS
certificate.
Parameter
Description
cert_id
RequiredString.TheIDofthecertificatetodelete.
name
OptionalString.Thecertificatename.
domain
OptionalString.Serverdomainthatthecertificateisusedfor.
certificate
OptionalString.Base64-encodedcertificatetext,enclosedbetween`
—–BEGINCERTIFICATE—–`and—–ENDCERTIFICATE—–.
Returns
Abooleanindicatingsuccess(True),orfailure(False)
#UsageExample
>>>gis.admin.certificates.update(cert_id="certificate_id",
>>>name="certificate_name",
>>>domain="certificate_domain",
>>>certificate="certificate_text")
PortalDataStore¶
classarcgis.gis._impl._datastores.PortalDataStore(url,gis)¶
Bases:object
ThePortalDatastoreprovidesaccesstooperationsthatallowyoutodothe
following:
Validateadatastoreagainstyourserver.
Registeradatastoretoyourserver.
Retrievealistofserversyourdatastoreisregisteredto.
Refreshyourdatastoreregistrationinformationintheserver.
Unregisteradatastorefromyourserver.
Note
UsersalsohavetheabilitytobulkpublishlayersfromaDatastoreobject,
retrievealistofpreviouslypublishedlayers,anddeletebulk-publishedlayers.
delete_layers(item)¶
Thedelete_layersmethodremovesalllayerspublishedfromtheDatastoreobject.
Note
BeforeaDatastoreobjectcanbeunregisteredfromaserver,allofits
bulk-publishedlayersmustbedeleted.
Argument
Description
item
RequiredItem.TheDatastoretodeleteallpublishedlayers.
#UsageExample
>>>datastore_manager.delete_layers(datastore_object)
Returns
Abooleanindicatingsuccess(True),orfailure(False)
describe(item,server_id,path,store_type='datastore')¶
Thedescribemethodisusedtolistthecontentsofadatastore.A
clientcanuseitmultipletimestodiscoverthecontentsofthe
datastoreincrementally.Forexample,theclientcanrequesta
descriptionoftheroot,andthenrequestsub-folders.
Argument
Description
item
RequiredItem.TheItemtodescribe.
server_id
OptionalString.Theuniqueidoftheregisteredserver.
path
OptionalString.Thepathtoexaminethedatain.
store_type
OptionalString.Forrootresourcetheobjecttypeshouldbedatastore,
andforsub-folders,theobjecttypeshouldbelistedasfolder.
#UsageExample
>>>datastore_manager.describe(item=datastore_object1,server_id="server_name",path="path_name")
Returns
AStatusJobobject
layers(item)¶
Thelayersoperationreturnsalistoflayersbulkpublishedfroma
Datastorewiththe
publish_layersmethod.
Note
Thelayersmethodreturnsanlistoftuples,witheachtuplecontainingtwo
objects:alayerandthedatasetitwaspublishedfrom.
Argument
Description
item
RequiredItem.TheDataStoreItemtolistallpublishedlayers
andregistereddatasets.
#UsageExample
>>>datastore_manager.layers(datastore_object1)
Returns
AListofbulk-publishedLayerobjects
propertyproperties¶
ThepropertiespropertyretrievesthepropertiesofthecurrentDataStoreobject
Returns
AlistoftheDataStoreobjectproperties
publish(config,server_id,folder=None,description=None,tags=None)¶
Thepublishoperationisusedtopublishscenelayersbyreferencetodataina
Datastore.
Argument
Description
config
RequiredDictionary.Thisistheserviceconfigurationproperty
anditmustcontainthereferencetothedatainthedatastore.It
specifiesthedatastoreIdandthepathofthedata.Aclientcan
discovertheproperpathsofthedatabyusingthedescribemethod.
Example:{“type”:”SceneServer”,”serviceName”:”sonoma”,”properties”:{“pathInCachedStore”:”/v17_i3s/SONOMA_LiDAR.i3srest”,”cacheStoreId”:”d7b0722fb42c494392cb1845dacc00d9”}}
server_id
RequiredString.TheuniqueIdoftheservertopublishto.
folder
OptionalString.Thenameofthefolderonservertoplacetheservice.Ifnoneisprovided,itisplacedintheroot.
description
OptionalString.AnoptionalstringtoattachedtotheItemgenerated.
tags
Optionallist.Anarrayofdescriptivewordsthatdescribesthenewlypublisheddataset.ThiswillbeaddedtotheItem
#UsageExample
>>>datastore_manager.publish(config={"required":"dictionary"},server_id="server_name")
Returns
AStatusJobobject
publish_layers(item,srv_config,server_id,folder=None,server_folder=None,future=False)¶
Thepublish_layersoperationpublishes,orsyncs,thedatasetsfroma
DataStoreobjectontoyourArcGISServer,resultinginatleastone
Layerperdataset.Itisquitesimilartothe
publishmethod.
Note
Whenthisoperationiscalledforthefirsttime,everyparameterin
theoperationmustbepassedthrough.Onsubsequentcalls,
publish_layerswillsynchronizethedatasetsandcreatedlayers,which
includesbothpublishinglayersfromnewdatasetsandremovinglayers
fordatasetsnolongerfoundinthedatastore.
Argument
Description
item
RequiredItem.TheDataStoreItemtopublishfrom.
srv_config
RequiredDict.TheJSONthatwillbeusedasatemplateforallthe
servicesthatwillbepublishedorsynced.ThisJSONcanbeusedto
changethepropertiesofthedatastore’smapandfeatureservices.
Onlymapserviceconfigurationswithfeatureservicesenabledare
supportedbythisparameter.
server_id
RequiredString.TheserverIdthatthedatasetswillbepublishedto.
folder
OptionalString.Thefoldertowhichthedatasetswillbepublished.
server_folder
OptionalString.Thenameoftheserverfolder.
future
OptionalBoolean.IfFalse,thevalueisreturned,elsea
StatusJobisreturned.
#UsageExample
>>>datastore_manager.publish_layers(datastore_object1,srv_config={"required":"dictionary"})
Returns
Booleanwhenfuture=FalseelseaStatusJobobject
refresh_server(item,server_id)¶
Threfresh_servermethodupdatestheserverwithnewlyconfiguredinforamtion.
Note
AfteraDatastorehasbeenregistered,theremaybetimesinwhich
theDatastoreobject’sregistrationinformationmaybechanged.When
changesliketheseoccur,theserverwillneedtobeupdatedwith
thenewlyconfiguredinformationsothatyouruserswillstillbe
abletoaccessthedatastoreitemswithoutinterruption.
Warning
Thisoperationcanonlybeperformedafterthedata
storeinformationhasbeenupdated.
Argument
Description
item
RequiredItem/ItemId(asstring).TheitemIdorItemofthedata
storetoregisterwiththeserver.Notethatadatastorecanbe
registeredonmultipleservers.
server_id
RequiredString.Theuniqueidoftheserveryouwanttoregister
thedatastorewith.
#UsageExample
>>>datastore_manager.refresh_server(datastore_object1,"server_id")
Returns
Abooleanindicatingsuccess(True),orfailure(False)
register(item,server_id,bind=False)¶
TheregistermethodallowsforDatastoreobjectstobeaddedtoanArcGISServer
instance.
Note
BeforeregisteringaDatastore,itisrecommendedthatyouvalidateyour
Datastorewiththegivenserver.
Argument
Description
item
RequiredItemobjectorItemId(asstring).TheitemIdorItemof
thedatastoretoregisterwiththeserver.Notethatadatastorecanbe
registeredonmultipleservers.
server_id
RequiredString.Theuniqueidoftheserveryouwanttoregister
thedatastorewith.
bind
OptionalBoolean.Specifieswhethertobindthedatastoreitemto
thefederatedserver.Formoreinformationaboutbindingadata
storetoadditionalfederatedservers,seethenotebelow.
ThedefaultvalueisFalse.
#UsageExample
>>>datastore_manager.register(datastore_object1,"server_name")
Returns
Abooleanindicatingsuccess(True),orfailure(False)
Note
TocreateaDatastoreobjectfromanexistingdataStore,
seetheCreateadatastoreitemfromanexistingdatastore
pageintheArcGISOnlineresources.
servers(item)¶
Theserverspropertyreturnsalistofyourserversthatagiven
datastorehasbeenregisteredto.Thisoperationreturnsthe
serverId,theservername,boththeserverandadminURLs,and
whetherornottheserverishosted.
Argument
Description
item
RequiredItem.TheDataStoreItemobjecttolistallregisteredservers.
#UsageExample
>>>datastore_manager.servers(datastore_object1)
Returns
AListwiththeserverID,servername,serverURL,andadminURLs
unregister(item,server_id)¶
TheunregistermethodremovestheDatastoreassociationfromaserver.
#UsageExample
>>>datastore_manager.unregister(datastore_object1,"server_id")
Returns
Abooleanindicatingsuccess(True),orfailure(False)
validate(server_id,item=None,config=None,future=False)¶
ThevalidatemethodensuresthatyourArcGISServercanconnectanduse
thedatasetsstoredwithinagivendatastore.ADatastorecanbevalidatedbyusingeither
itsdatastoreIdortheJSONforanunregisteredDatastore.
Note
Whilethisoperation
canbecalledbeforeoraftertheDatastorehasbeenregistered
withyourserver,itisrecommendedthatthevalidateoperationis
performedbeforehand.
Argument
Description
server_id
RequiredString.Theuniqueidoftheserveryouwanttoregister
thedatastorewith.
item
OptionalItem/ItemId(asstring).TheitemIdorItemofthedata
storetoregisterwiththeserver.Notethatadatastorecanbe
registeredonmultipleservers.
config
Optionaldict.Theconnectioninformationforanewdatastore.
#UsageExample
>>>datastore_manager.validate("server_name")
Returns
Abooleanindicatingsuccess(True),orfailure(False)
Submodules¶
arcgis.gis.adminmodule
AGOLAdminManager
PortalAdminManager
KubernetesAdmin
AGOLUsageReports
Bundle
CategoryManager
CollaborationManager
Collaboration
CreditManager
License
LicenseManager
LivingAtlas
IdentityProviderManager
PasswordPolicy
PortalResourceManager
UX
EmailManager
Federation
Indexer
Logs
Machines
Security
OAuth
SSLCertificate
SSLCertificates
EnterpriseUsers
EnterpriseGroups
Site
System
Licenses(Deprecated10.7+)
PortalLicense
Directory
WebAdaptor
WebAdaptors
WebhookManager
Webhook
arcgis.gis.servermodule
Server
ServicesDirectory
Service
Extension
Machine
Report
Datastore
User
Role
ServerManager
ServiceManager
MachineManager
LogManager
ReportManager
DataStoreManager
UserManager
RoleManager
SystemManager
SiteManager
DirectoryManager
ConfigurationStore
Jobs
ServerDirectory
ServerProperties
ItemInformationManager
JobManager
Job
Mode
arcgis.gis.agoservermodule
AGOLServicesDirectory
AGOLServersManager
AGOLServerManager
arcgis.gis.missionmodule
MissionServer
Mission
MissionCatalog
MissionJob
DirectoryManager
LogManager
Machine
MachineManager
SecurityManager
SiteManager
SystemManager
WebAdaptor
WebAdaptorManager
arcgis.gis.nbmodule
NotebookServer
NotebookManager
Notebook
Runtime
SnapshotManager
SnapShot
SystemManager
Container
ContainerNotebook
DirectoryManager
WebAdaptor
WebAdaptorManager
SiteManager
LogManager
MachineManager
Machine
SecurityManager
NotebookDataAccess
NotebookFile
NBServicesManager
NBService
arcgis.gis.workflowmanagermodule
WorkflowManager
WorkflowManagerAdmin
JobManager
Job
JobDiagram
JobLocation
JobTemplate
Group
SavedSearchesManager
LookUpTable
WMRole
arcgis.gis.tasksmodule
TaskManager
Task
Run
arcgis.gis.sharingmodule
UserInvitationManager
Invitation
Wasthispagehelpful?YesNoWasthispagehelpful?YesNoYourbrowserisnolongersupported.Pleaseupgradeyourbrowserforthebestexperience.Seeourbrowserdeprecationpostformoredetails.