You can use the portal service to search for groups. This operation allows authenticated users to search for specific groups in the portal. The portal search index is updated whenever groups are created, content updated in a group, or a group is deleted. The results from a group search are limited to searching for groups that are accessible in the portal. This is based on group permissions managed by adjusting the access settings.
You can search for groups based on:
- Keywords such as name, description, or tags.
- Groups created or owned by a specific member or organization in the portal.
- Specific tags that indicate the purpose of the group.
- Categories or themes to filter results based on topic or industry.
Search parameters
The general steps to search for groups are:
- Define the URL to the portal service:
https
.://www.arcgis.com/sharing/rest/community/groups - Provide the text for your search. For example,
username
orfull
.Name - Set the sort order for your return results.
- Any additional fields, such as description, tags, created or modified.
URL request
https://www.arcgis.com/sharing/rest/community/groups?<parameters>
Default fields
When searching for text in items or groups, if you do not provide fields, the following default fields are searched.
Items | Groups |
---|---|
title | title |
tags | tags |
description | description |
tagKeywords | owner |
Key parameters
Name | Description | Examples |
---|---|---|
q | The text or formatted query with text. | q="streets" q="john+smith" q=(firstName:"john" OR lastName:"smith") |
filter | Apply structured filtering using field name. | filter=tags filter=type |
sort | The primary sort field. | sort sort sort sort |
sort | Return results in ascending or descending order. | sortOrder=asc sortOrder=desc |
search | Groups a user owns and groups where a user is a member. | search |
Query structure
Here are a some of the general rules for formatting queries:
- For an open search, specify the text at the beginning. e.g.
q="utilities"
- To search specific fields, use a colon
:
after the field name. - Use double quotes
"text"
around all user search text. - Capitalize all
AND
,OR
, andNOT
operators. - Use
()
to group operators.
For example:
https://www.arcgis.com/sharing/rest/community/groups?f=json&q="john"
Code examples
Search for a group by name
Find group with the keyword name
.
# Search for groups by name
group_name = "Your Group Name"
search_results = gis.groups.search(query=f"name:{group_name}")
if search_results:
print("Found matching groups:")
for group in search_results:
print(f"Group Name: {group.title}")
print(f"Group ID: {group.id}")
print(f"Group Owner: {group.owner}")
print(f"Group Description: {group.description}")
Search for a group by username
Find groups a member belongs to.
# Enter the username you want to search for
search_username = "username_to_search"
# Search for groups owned by the specified username
groups_owned = gis.groups.search(query=f'owner:{username}')
# Search for groups where the specified username is a member
groups = gis.groups.search(query=f'members: {username}')
Search for groups by tags
Find groups based on the specified tags
# Define the tags to search for
tags = ["tag1", "tag2", "tag3"]
# Perform the group search
groups = gis.groups.search(query="", tags=",".join(tags))
# Print the results
for group in groups:
print("Group Name:", group.title)
print("Group ID:", group.id)
print("Group Owner:", group.owner)
print("Group Tags:", group.tags)
print("\n")
Search for group by summary text
Find groups based on text in the summary
field.
# Enter the summary you want to search for
summary_to_search = "Enter summary here"
# Perform a search for groups based on the summary field
results = gis.groups.search(query=f'summary:"{summary}"')
# Print the search results
print("Search Results:")
for group in results:
print(f"Group Name: {group.title}, Group ID: {group.id}")
Search for groups with a specific access type
Find groups based on specific access types.
# Specify the access type to search for
access_type = 'public' # Change this to 'org' or 'private' as needed
# Define the search query
query = f"type:group access:{access_type}"
# Search for groups
groups = gis.groups.search(query=query)
# Print the results
if groups:
print(f"Groups with '{access_type}' access type:")
for group in groups:
print(f" - {group.title} ({group.owner})")
else:
print(f"No groups found with '{access_type}' access type.")
Tools
Use tools to access the portal and create and manage content for applications.
ArcGIS Enterprise
Create, manage, analyze, and share data, maps, and applications in your organization.
Portal
Create, manage, and access content and data services for applications.
Map Viewer
Create, explore, and share web maps for 2D applications.
Scene Viewer
Create, style, and explore web scenes.
Vector Tile Style Editor
Create styles for basemap and vector tile layers.
Content management tools
Create, manage, organize, and share items in a portal.
Data management tools
Import data and create hosted layers and data services. Upload and manage documents, images, and other files.
Spatial analysis tools
Perform feature and raster analysis to create new datasets with the Map Viewer.
Developer credentials tool
Create API key and OAuth 2.0 developer credentials for custom applications.
Items
Manage and share items.
ArcGIS Pro
Create, style, and explore maps and scenes.
Geoprocessing tools
Import, manage, and analyze data.