Esri / ArcREST

python package for REST API (AGS, AGOL, webmap JSON, etc..)
Apache License 2.0
192 stars 155 forks source link

Create Replica FS problem #323

Closed dwaggenspack closed 7 years ago

dwaggenspack commented 7 years ago

ArcRest or ArcRestHelper

Version or date of download

1/19/2017 v3.5.9

Bug or Enhancement

create_replica_fs.py

I created an empty copy of the ArcGIS Online feature and was able to create a replica, but the original will not let me download it.

I believe the script fails due to the large size of the data or a timeout with the request.

I am unsure how to fix the script to deal with this problem, but our feature has attachments and we wish to be able to automate creating a file geodatabase for local use and as a backup.
Alternately, if there was a way to automate the sync to get all the new features collected by the field crew into a replica GDB, that would work too.

Repo Steps or Enhancement details

spiskula commented 7 years ago

Hi I am hitting a problems with creating a replica too. The problem seems to occur with 'createReplica' method of FeatureService class(arcrest\agol\services.py).

I think the issue is that towards the end of the method in this code

            if 'resultUrl' in res:
                dlURL = res["resultUrl"]
            elif 'responseUrl' in res:
                dlURL = res["responseUrl"]

It should actually be / or include different parameter:

            if 'resultUrl' in res:
                dlURL = res["resultUrl"]
            elif 'responseUrl' in res:
                dlURL = res["responseUrl"]
            elif 'URL' in res:
                dlURL = res["URL"]

It seems this is how doco specifies how location (at least of JSON clone) of replica is available on the server http://resources.arcgis.com/en/help/rest/apiref/fscreatereplica.html

JSON Response Example - Data contains attachments

{"URL": "http://machinename:6080/arcgis/rest/directories/arcgisoutput/Canada/test113c26d11b80f049c09aef1e6c1327641c.json"}