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?

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
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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