Closed FeralCatColonist closed 1 year ago
Thanks for bringing this to our attention, we will take a look
We fixed this for the next release, the parameter was there but never used in the method so we removed it because it cannot be implemented at this time
Hi @nanaeaubry,
When I ran the publish_layers()
without the Future
parameter I was still unable to get a successful run-- --the function just returned True.
@FeralCatColonist
In the method we wait for the response to say it is completed and then we return True once that is done. So if you are getting True back it means the post call to the rest endpoint was successful.
If you try doing it through the rest endpoint in the browser do you get the same results?
Here is the rest API doc for it: https://developers.arcgis.com/rest/users-groups-and-items/publish-layers.htm
I'll have to re-test and get back to you on that. In the interim, is there any additional documentation on the templateSvcConfig
parameter? The REST API documentation in your link also does not expound on what are the minimum requirements for that.
@FeralCatColonist I didn't forget about this but I am just waiting on a response. Will update once I have one
@FeralCatColonist
Here is the response I got:
In the doc those should cover all the key examples--I believe you can just edit the maxRecordCount value, and then the capabilities for the map and feature services. When you bulk publish from the home app, it uses the following template service config json:
{
"serviceName": null,
"type": "MapServer",
"capabilities": "Map,Query,Data",
"extensions": [
{
"typeName": "FeatureServer",
"capabilities": "Query",
"enabled": "true",
"properties": {"maxRecordCount": "4000"}
}
]
}
At 11.1, it can also contain date-time information:
"properties": {
"datesInUnknownTimeZone": false,
"dateFieldsTimezoneID": "Pacific Standard Time",
"dateFieldsRespectsDayLightSavingTime": true,
"preferredTimeZoneID": "Pacific Standard Time",
"preferredTimeZoneRespectsDayLightSavingTime": true
},
Based on that, I'm wondering, if you omit certain properties, will those be filled out according to some default parameters?
I'd really like to understand what is the minimum required to enable a service with sync capability.
service_template_with_sync = {
"serviceName": None,
"type": "MapServer",
"capabilities": "Map,Query,Data",
"extensions": [{"typeName": "FeatureServer",
"capabilities": "Query,Sync",
"enabled": "true",
"properties": {
"enableZDefaults": "false",
"allowUpdateWithoutMValues": "false",
"allowGeometryUpdates": "true",
"editorTrackingTimeInUTC": "true",
"allowOthersToQuery": "true",
"includeTopologyLayer": "false",
"syncBranchVersionCreationRule": "versionPerDownloadedMap",
"enableOwnershipBasedAccessControl": "false",
"onlyAllowTrueCurveUpdatesByTrueCurveClients": "false",
"editorTrackingRespectsDayLightSavingTime": "false",
"syncEnabled": "true",
"syncVersionCreationRule": "versionPerDownloadedMap",
"allowOthersToUpdate": "false",
"zDefaultValue": "0",
"allowTrueCurvesUpdates": "false",
"xssPreventionEnabled": "true",
"allowOthersToDelete": "false",
"editorTrackingTimeZoneID": "UTC",
"realm": ""
}}]
}
service_template = {"serviceName": None,
"type": "MapServer",
"capabilities":"Map,Query",
"extensions": [{"typeName": "FeatureServer",
"capabilities":"Query,Create,Update,Delete",
"enabled": "true",
"properties": {"maxRecordCount": 3500}}]}
@FeralCatColonist
I asked for further clarification and received this from the team in charge of the doc for it: As far as I am aware, Sync (and to that extent, Editing as well) cannot be enabled on feature services with the initial bulk publish. It can be enabled after, however, in ArcGIS Server Manager. That's discussed in the front-end user help, but I see where that same information and clarification is missing in the API.
They went on to say they will make sure to update the doc to include these limitations.
Hope this is able to answer your questions!
@nanaeaubry just to make sure I'm not misreading this, the team is saying there is not currently a programmatic way to set service capabilities such as sync or edit?
If not, is that capability on a development road map?
@FeralCatColonist Yes you are correct. You cannot currently do this on the bulk publish (publishLayers) it has to be done afterwards.
I don't know about development for this. The best thing to do is put in a feature request with support for this so the team has a user story they can address. Sorry for the inconvenience on that
@nanaeaubry outside of the bulk publish, are those capabilities able to be set utilizing the API for Python on an individual basis? I wouldn't mind looping through services and setting those if I'm able. I've been button clicking through ArcGIS Server Manager and it is a beat down.
So you can set them afterwards with the python API This is a good guide to show you how to update the service definition: https://developers.arcgis.com/python/guide/updating-feature-layer-properties/
Describe the bug
PortalDatastore.publish_layers()
returns a boolean instead of aStatusJob
object when the parameterfuture
is set to true.To Reproduce
Steps to reproduce the behavior:
bulk_publish_job
returns asbool
instead ofStatusJob
object. This occurs in both instances of theservice_template_with_sync
and theservice_template
from the API sample.https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis._impl._datastores.PortalDataStore.publish_layers
Screenshots
Expected behavior
publish_layers()
should return aStatusJob
object when parameterfuture
is set to true; otherwise an error should raise to explain the failure.Platform (please complete the following information):
Additional context
The goal of this process is to automate a bulk publish to enable a Portal to ArcGIS Online collaboration with a full copy of the feature layers, which requires sync to be enabled.
The provided code was based on the API sample: