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
You can search for groups by their name in your portal. This feature allows you to quickly find groups that match specific keywords or titles making it easier to connect with relevant content and collaborate with others.
# Specify the group name you want to search for
group_name = "Your Group Name"
# Search for the group
groups = gis.groups.search(f'title:"{group_name}"')
# Check if any groups were found
if groups:
for group in groups:
print(f"Group found: {group.title}")
print(f"Group ID: {group.id}")
print(f"Owner: {group.owner}")
print(f"Description: {group.description}")
print("---")
Search for a group by username
You can search for groups using a specific member username in your portal. This feature allows you to find groups that are associated with or created by a particular member.
# Specify the username you want to search groups for
username = "username_to_search"
# Search for groups owned by the specified username
groups = gis.groups.search(query=f'owner:{username}')
# Check if any groups were found
if groups:
print(f"Groups owned by {username}:")
for group in groups:
print(f"- {group.title}")
print(f" ID: {group.id}")
print(f" Description: {group.description}")
print("---")
Search for groups by tags
You can search for groups using tags in your portal. Tags are descriptive keywords that are associated with groups to help categorize and identify them. By using tags, you can quickly narrow down your search results to find groups.
# Define the tags to search for
tags = ",".join(["tag1", "tag2", "tag3"])
# Perform the group search
groups = gis.groups.search(f'tags:"{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
You can search for groups using their summary text. The summary is a descriptive text that provides purpose, content, or focus area for a group. By searching using keywords, you can quickly locate groups.
# 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(f'snippet:"{summary_to_search}"')
# 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
You can search for groups based on their specific access type in your portal. The access type set for a group determines who can view and join the group. These access types are:
- Private: Only group members and administrators can view the group and its content.
- Organization: Only members of your portal can find and join the group.
- Public: Anyone including users outside your organization can find and join the group.
# Specify the access type you want to search for
# Valid options are: 'private', 'org', 'public'
access_type = "private"
# Search for groups with the specified access type
groups = gis.groups.search(f'access:{access_type}')
# Check if any groups were found
if groups:
print(f"Groups with {access_type} access:")
for group in groups:
print(f"- {group.title}")
print(f" ID: {group.id}")
print(f" Owner: {group.owner}")
print(f" Access: {group.access}")
print(f" Description: {group.description}")
print("---")
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.