AnsweredAssumed Answered

Keys in SDdraft file (AGOL)

Question asked by mwawryk on Jun 29, 2016
Latest reply on Jul 1, 2016 by JQuinn-esristaff

Does anyone know how to find the keys in the SDdraft file? They are used in the scripts that are posted for updating AGOL by Esri and used by many people. See here: arcrest.common.servicedef — ArcREST 3.5.4 documentation  The script uses the keys to set up  things like feature access and turning off caching but Esri support will not give me list of the keys. I am pretty sure some of the other settings I would like to set are in as keys but I don't know how to figure out what they are. Does anyone either know how to read the keys from the SDfile or have a list of what the keys are?

   For example,

 root_elem = doc.getroot()
    if root_elem.tag != "SVCManifest":
        raise ValueError("Root tag is incorrect. Is {} a .sddraft file?".format(SDDraft))

    # The following 6 code pieces modify the SDDraft from a new MapService
    # with caching capabilities to a FeatureService with Query,Create,
    # Update,Delete,Uploads,Editing capabilities as well as the ability
    # to set the max records on the service.
    # The first two lines (commented out) are no longer necessary as the FS
    # is now being deleted and re-published, not truly overwritten as is the
    # case when publishing from Desktop.
    # The last three pieces change Map to Feature Service, disable caching
    # and set appropriate capabilities. You can customize the capabilities by
    # removing items.
    # Note you cannot disable Query from a Feature Service.

    # doc.find("./Type").text = "esriServiceDefinitionType_Replacement"
    # doc.find("./State").text = "esriSDState_Published"

    # Change service type from map service to feature service
    for config in doc.findall("./Configurations/SVCConfiguration/TypeName"):
        if config.text == "MapServer":
            config.text = "FeatureServer"

    # Turn off caching
    for prop in doc.findall("./Configurations/SVCConfiguration/Definition/" +
                            "ConfigurationProperties/PropertyArray/" +
                            "PropertySetProperty"):
        if prop.find("Key").text == 'isCached':
            prop.find("Value").text = "false"
        if prop.find("Key").text == 'maxRecordCount':
            prop.find("Value").text = maxRecords

    # Turn on feature access capabilities
    for prop in doc.findall("./Configurations/SVCConfiguration/Definition/Info/PropertyArray/PropertySetProperty"):
        if prop.find("Key").text == 'WebCapabilities'
            prop.find("Value").text = "Query,Create,Update,Delete,Uploads,Editing"

Outcomes