HOW TO

Change the capabilities of a hosted feature service using ArcGIS API for Python

Last Published: February 2, 2023

Summary

An ArcGIS Server feature service can be configured to include different capabilities for various operations. These capabilities can be selected by accessing the ArcGIS REST Service Directory of the hosted service. Individual layers are accessed through the REST directory and the capabilities of the hosted service are identified through the details listed in the directory.

The image below shows the ArcGIS REST Service Directory page of a feature with full capabilities.

List of capabilities before editing

This article describes the workflow to change the capabilities using ArcGIS API for Python. The script can be run using a stand-alone .py file or Jupyter Notebook.

Procedure

  1. Import the necessary modules.
from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection
  1. Specify the required credentials and connect to the portal.
gis = GIS('portal url', 'user name', 'password', verify_cert=False)
  1. Search for the service.
search_result= gis.content.search(query="title: Layer Name", item_type="Feature Layer")
test_item= search_result[0]
test_flc = FeatureLayerCollection.fromitem(test_item)
  1. Update the capabilities using an update dictionary.
update_dict = {"capabilities": "Create,Editing,Uploads,Delete,Query"}
test_flc.manager.update_definition(update_dict)
The code block below demonstrates the full script.
from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection

gis = GIS('https://domain.esri.com/portal', 'username123', 'password123', verify_cert=False)

search_result= gis.content.search(query="title: Mosaic", item_type="Feature Layer")
test_item= search_result[0]
test_flc = FeatureLayerCollection.fromitem(test_item)
 
update_dict = {"capabilities": "Create,Delete,Query,Update,Editing,Extract"}
test_flc.manager.update_definition(update_dict)

The image below shows the changed capabilities after running the script.

The Capabilities after editing

Article ID: 000027057

Software:
  • Portal for ArcGIS
  • ArcGIS Server

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options