You can use the portal service to access and manage groups in an organization. A group is a container for items available to a specific set of users in the portal.
Working with groups
Groups are used to organize and share items and define which users can access and view specified content. You can create groups of hosted layers, web maps, or any other item type. Or you can create a group and add users to it, allowing them to collaborate and share items within the group.
The typical workflow for using groups is to:
- Define a group in the portal.
- Add items the group.
- Add users to the group.
- Manage the group properties.
Code examples
Search for a group
Find a one or more groups in the portal using a query.
APIs
portal = new Portal(); // Default is "https://www.arcgis.com/sharing/rest"
portal.load().then(()=>{
const query = {
query: "water"
};
portal.queryGroups(query).then((response)=>{
console.log(response);
});
});
REST API
curl https://www.arcgis.com/sharing/rest/community/groups \
-d 'q=water' \
-d 'f=pjson'
{
"query": "water",
"total": 3206,
"start": 1,
"num": 10,
"nextStart": 11,
"results": [
{
"id": "b2e2fce2ab304ff38c27b811b1784b23",
"title": "Wyoming WRDS WDO - Water",
Create a new group
Define a new group and how it can be accessed.
APIs
from arcgis.gis import GIS
gis = GIS(username="USERNAME", password="PASSWORD")
group = gis.groups.create(title="Traffic issues", tags="traffic", access="public")
print(group)
REST API
curl https://www.arcgis.com/sharing/rest/community/createGroup \
-d 'title=Traffic issues' \
-d 'access=public' \
-d 'f=pjson' \
-d 'token=<ACCESS_TOKEN>'
{ "success": true,
"group": {
"id": "GROUP_ID",
"title": "Traffic issues",
"access": "public"
}
}
Invite users to a group
Invite users by their user names.
APIs
from arcgis.gis import GIS
gis = GIS(username="USERNAME", password="PASSWORD")
group = gis.groups.get("GROUP_ID")
results = group.invite_users(usernames=["USER_TO_INVITE"])
print(results)
REST API
curl https://www.arcgis.com/sharing/rest/community/groups/<GROUP_ID>/invite \
-d 'users=<USER_TO_INVITE>' \
-d 'role=group member' \
-d 'expiration=20160' \
-d 'f=pjson' \
-d 'token=<ACCESS_TOKEN>'
{
"success":true,
"groupId": "GROUP_ID"
}
Add items to a group
Add an item to group to be shared with a set of users.
APIs
from arcgis.gis import GIS
gis = GIS(username="USERNAME", password="PASSWORD")
item = gis.content.get("ITEM_ID")
results = item.share(groups="GROUP_ID")
print(results)
REST API
curl https://www.arcgis.com/sharing/rest/content/users/<USERNAME>/items/<ITEM_ID>/share \
-d 'f=json' \
-d 'groups=<GROUP_ID>' \
-d 'token=<ACCESS_TOKEN>'
{"results": [{"itemId": "ITEM_ID",
"success": true,
"notSharedWith": []}]} // Groups item not shared with
Search for group content
Find items shared with a group using a query.
APIs
const portal = new Portal();
portal.url = "https://www.arcgis.com/"
portal.load()
.then(()=> {
const portalGroup = new PortalGroup({
id: "d6340748701d4ccfb18ad3c42b7feb9e",
portal: portal
});
const queryParameters = {
query: "bike"
};
portalGroup.queryItems(queryParameters).then((response)=>{
console.log(response);
});
});
REST API
curl https://www.arcgis.com/sharing/rest/content/groups/d6340748701d4ccfb18ad3c42b7feb9e/search \
-d 'q=bike' \
-d 'f=pjson'
{
"query": "bike",
"total": 2,
"start": 1,
"num": 10,
"nextStart": -1,
"results": [
{
"id": "37695c689cbe4e87aa1877ef12c7bf3b",
"owner": "esri_devlabs",
Update properties
Change the properties of a group such as the name, description, and permissions.
APIs
from arcgis.gis import GIS
gis = GIS(username="USERNAME", password="PASSWORD")
group = gis.groups.get("GROUP_ID")
results = group.update("new") # new title
print(results)
REST API
curl https://www.arcgis.com/sharing/rest/community/groups/GROUP_ID/update \
-d 'title=new' \
-d 'f=pjson' \
-d 'token=<ACCESS_TOKEN>'
{
"success": "true",
"groupId": "GROUP_ID"
}
Tutorials
Use tools to create different types of content and build content-driven applications.
Web maps
Create a web map
Use Map Viewer to create a web map for your application.
Style layers in a web map
Use Map Viewer to style layers in a web map.
Display a web map
Create and display a map from a web map.
Web scenes
Create a web scene
Use Scene Viewer to create a web scene for your application.
Style layers in a web scene
Use Scene Viewer to style layers in a web scene.
Display a web scene
Create and display a scene from a web scene.
Feature layers
Import data to create a feature layer
Use data management tools to import files and create a feature layer in a feature service.
Manage a feature layer
Use a hosted feature layer item to set the properties and settings of a feature layer in a feature service.
Add a feature layer
Access and display point, line, and polygon features from a feature service.
Vector tile layers
Create a vector tile service
Use data management tools to create a new vector tile service from a feature service.
Add a vector tile layer
Access and display a vector tile layer in a map.
Basemap layers
Create a custom basemap style
Use the Vector tile style editor to style a vector tile basemap layer.
Display a custom basemap style
Add and display a styled vector tile basemap layer.
Services
Portal service
Store, manage, and access private and public content.
API support
- 1. Limited operations, use HTTP requests.
- 2. Access via ArcGIS REST JS.
Tools
Use tools to access the portal and create and manage content for applications.
Developer dashboard
Manage API keys, service usage, and data with the ArcGIS Developers website.
ArcGIS.com
Create, manage, and share content and data with GIS tools.
ArcGIS Enterprise
Create, manage, analyze, and share data, maps, and applications in your organization.
Map Viewer
Create, explore, and share web maps for 2D applications.
Scene Viewer
Create, explore, and share web scenes for 3D applications.
Vector tile style editor
Style vector tile basemap layers for applications.
ArcGIS Pro
Explore, visualize, and analyze both 2D and 3D data with desktop GIS tools.