1

I'm working on an ArcPy script to test layers. I have either an arcpy mapping module layer object, or a feature service URL as a text string. I wish to get the feature service's capabilities, in particular the syncCapabilities to ascertain if it's sync enabled.

I'm not sure what API to use. I assume you can import JSON in Python, and use it to get the capabilities? The REST API is not very day 1 noob friendly. I could not find a real working example in my context.

"capabilities": "Create,Delete,Query,Sync,Update,Uploads,Editing"

My hack attempts to integrate it into Python results in failure

ArcGIS REST API: Sync-enabled feature services

import arcpy
import json
URL = "https://services.myserver.com/ERmEceOGq5cHrItq/ArcGIS/rest/services/USA/FeatureServer/jobs/jf90d6386f7494cd59c024f749773fe7b"
print URL
{
 "syncCapabilities" : {
 "supportsSyncEnabled"
}

How do I get the true or false this back from this?

Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked Apr 18, 2019 at 4:44

2 Answers 2

1

You can get the service capabilities from the info of the specific layer you want to edit. Assuming you only have one layer on your FeatureServer service, it would be the layer with the index 0.

Access the capabilities info through python like this:

import urllib2
import json
fs_url = "https://yourarcgisserver.com/arcgis/rest/services/service_name/FeatureServer/0?f=json"
response = urllib2.urlopen(fs_url)
res_json = json.load(response)
print res_json["capabilities"]
Query,Create,Update,Delete,Uploads,Editing
answered Sep 9, 2019 at 10:43
0

You can use the ArcGIS Python API to do this now: https://developers.arcgis.com/python/guide/updating-feature-layer-properties/

answered Oct 5, 2021 at 1:46

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.