0

I have a script that accesses an APRX and publishes a feature service to AGOL. I cannot figure out how to enable editing in the script or any other of the Operations and Properties in the screenshot below (with exception of the Export Data which is a property of getWebLayerSharingDraft)

default properties

Is there a way to Enable editing, choose one of the radio buttons, Enable Sync, and check on or off the Properties such as Preserve editor tracking info using ArcPy? Essentially I want the script to perform enable the below options.

wanted properties via arcpy

I am using ArcGIS Pro version 2.7 and the standard install of python that comes with it.

1 Answer 1

0

I figured this out using the arcgis API for Online/Enterprise that can update the setting after the item has been published.

import json
from arcgis import GIS
from arcgis.features import FeatureLayer

conn = GIS("home")

item = conn.content.get('feature servide id')

with open(r"filepath\to\json_file.json") as json_data:
    data = json.load(json_data)

layer = FeatureLayer(item.url)
layer.manager.update_definition(data)

The JSON file contains the below.

{
    "hasStaticData": false,
    "capabilities": "Create,Query,Update,Editing,Extract,Sync,ChangeTracking",
    "editorTrackingInfo": {
        "enableEditorTracking": true,
        "enableOwnershipAccessControl": false,
        "allowOthersToQuery": true,
        "allowOthersToUpdate": true,
        "allowOthersToDelete": true,
        "allowAnonymousToQuery": true,
        "allowAnonymousToUpdate": true,
        "allowAnonymousToDelete": true
  }
}

Results in the below capabilities being set on the feature service.

Updated Feature Service Capabilities

1
  • Your original question mentioned "Preserve Editor Tracking Info." There are additional parameters you can use to control that: {"editorTrackingInfo" : {"enableEditorTracking":'true', "preserveEditUsersAndTimestamps":'true'}} See Publishing to AGOL overwrites editor tracking data for more info.
    – Andy
    Commented Mar 11 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.