Search groups

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:

  1. Define the URL to the portal service: https://www.arcgis.com/sharing/rest/community/groups.
  2. Provide the text for your search. For example, username or fullName.
  3. Set the sort order for your return results.
  4. Any additional fields, such as description, tags, created or modified.

URL request

Use dark colors for code blocksCopy
1
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.

ItemsGroups
titletitle
tagstags
descriptiondescription
tagKeywordsowner

Key parameters

NameDescriptionExamples
qThe text or formatted query with text.q="streets"
q="john+smith"
q=(firstName:"john" OR lastName:"smith")
filterApply structured filtering using field name.filter=tags:"transportation"
filter=type:"Feature Service"
sortFieldThe primary sort field.sortField=title
sortField=created
sortField=type
sortField=modified
sortOrderReturn results in ascending or descending order.sortOrder=asc
sortOrder=desc
searchUserAccessGroups a user owns and groups where a user is a member.searchUserAccess=groupMember

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, and NOT operators.
  • Use () to group operators.

For example:

Use dark colors for code blocksCopy
1
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.

ArcGIS API for PythonArcGIS API for PythonArcGIS REST JS
Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 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.

ArcGIS API for PythonArcGIS API for PythonArcGIS REST JS
Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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}')
Expand

Search for groups by tags

Find groups based on the specified tags

ArcGIS API for PythonArcGIS API for PythonArcGIS REST JS
Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 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.

ArcGIS API for PythonArcGIS API for PythonArcGIS REST JS
Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 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.

ArcGIS API for PythonArcGIS API for PythonArcGIS REST JS
Expand
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 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.

Services

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.