Generating a list of all publicly shared feature services with the editing capabilities turned on in our Portal

1315
2
Jump to solution
09-28-2021 03:30 PM
JennieCatalano1
New Contributor III

I'm looking for a way to find all the Feature Layers in our Portal that are shared publicly (with everyone) and have editing capabilities enabled.  I'm using Jupyter notebook and Portal 10.8.1. 

1 Solution

Accepted Solutions
MehdiPira1
Esri Contributor

@JennieCatalano1 ,

The following code snippet extracts a list of publicly shared items which are also editable:

 

items = gis.content.search("*", item_type='Feature Service', max_items=1000, outside_org=True,)
for item in items:
    try:
        layers = item.layers
        if 'Editing' in layers[0].properties.capabilities:
            print(f"Editable Layer: {item.title}, Capabilities: {layers[0].properties.capabilities}, Share Type: {item.shared_with}")
            continue
    except:
        pass

 

 This is set to 1000 items and you can also change it.

I hope that's helpful.

View solution in original post

2 Replies
IhabHassan
Esri Contributor

Hi @JennieCatalano1 
The code sample here is a good guide for how to search for "FeatureService" from a Jupyter notebook:
https://developers.arcgis.com/python/guide/accessing-and-creating-content/

Also, from the API for Python doco, adding here link to the "Item" class property "shared_with" which can indicate how the Feature Service item is shared: https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html?highlight=item#arcgis.gis.Ite...

So, the typical workflow would be to query Portal content and get all feature services, then loop over the list and find which is shared publicly. 

 

Regards
Ihab
0 Kudos
MehdiPira1
Esri Contributor

@JennieCatalano1 ,

The following code snippet extracts a list of publicly shared items which are also editable:

 

items = gis.content.search("*", item_type='Feature Service', max_items=1000, outside_org=True,)
for item in items:
    try:
        layers = item.layers
        if 'Editing' in layers[0].properties.capabilities:
            print(f"Editable Layer: {item.title}, Capabilities: {layers[0].properties.capabilities}, Share Type: {item.shared_with}")
            continue
    except:
        pass

 

 This is set to 1000 items and you can also change it.

I hope that's helpful.