Find specific items using queries in the arcgis.gis module with ArcGIS API for Python

Last Published: June 29, 2022


When using ArcGIS API for Python in various workflows such as Clone, Export, and so forth, it may be necessary to find specific items in ArcGIS Online or Portal for ArcGIS and perform the action on only those items. To do this, the search function in arcgis.gis module can be used. It is also possible to use different queries or a combination of queries to find and use certain items.

This article shows some examples to use queries to find items in ArcGIS Online or Portal for ArcGIS using ArcGIS API for Python.


Examples to use query in Search function to return specific items in ArcGIS Online

  • Search for all content:
items ='')
  • Search for content by keyword:
items ='KEYWORD')
  • Search for content by owner:
items ='owner:YOUR USERNAME')
items ='NOT owner:YOUR USERNAME')
  • Search for content by owner when username is already provided as a parameter:
username = "YOUR USERNAME"
items ='owner:'+username)
items ='owner:{}'.format(username)
  • Search for Feature Layers owned by the logged-in user:
items ="owner:" +
  • Search for content by title:
items ='title:TITLE')
  • Search for content that begin with a prefix:

items ='title:TITLE*')
  • Search for content by item type
items ='', item_type='Feature Service')
items ='', item_type='Web Map')
items ='', item_type='Web Mapping Application')
  • The following query returns both Web Maps and Web Mapping Applications
items ='', item_type='Map')
  • Search for content outside the organization (query cannot be blank)
items ='title:TITLE', outside_org=True)
  • Combine query parameters
items ='title:TITLE, owner:YOUR USERNAME', item_type='Feature Layer')
items ='title:TITLE, type:map, owner:YOUR USERNAME')

Article ID:000024383

  • ArcGIS Online
  • Portal for ArcGIS
  • ArcGIS API for Python 1 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic