Esri / ArcREST

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

Updating underlying data of the Feature Service #187

Closed SergStol closed 8 years ago

SergStol commented 8 years ago

Is it possible to update existing Feature Service without having to first upload an Item and then Publish it again?

zipped_FGDB = "path to zipped File Geodatabase with changed features" fs_id = 15851a30111048e0a195bf8ebd28b69f ### Existing Feature Service

securityinfo = {} securityinfo['security_type'] = 'Portal' securityinfo['username'] = username securityinfo['password'] = password securityinfo['org_url'] = org_url securityinfo['proxy_url'] = None
securityinfo['proxy_port'] = None securityinfo['referer_url'] = None securityinfo['token_url'] = None securityinfo['certificatefile'] = None securityinfo['keyfile'] = None securityinfo['client_id'] = None securityinfo['secret_id'] = None

token = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) admin = arcrest.manageorg.Administration(securityHandler=token.securityhandler) content = admin.content

item = content.getItem(itemId = fs_id).userItem ip = arcrest.manageorg.ItemParameter() ip.filename = zipped_FGDB ip.overwrite = True newItem = item.updateItem(itemParameters=ip, data = zipped_FGDB, clearEmptyFields=True, multipart=True)

Process completes without errors, however, upon inspection of feature service on AGOL, there are no underlying changes in the features, as in features are in the same state as previously.

This works only if I addItem() first and then publishItem() with the new uploaded FGDB.

Is there something I am missing or this is how it should work?

achapkowski commented 8 years ago

@SergStol - So this is a FGDB and you are updating the FGDB item? Did you try to publish with overwrite=True

SergStol commented 8 years ago

Yes publish works with first updating the FGDB item. I thought there was a way of updating Feature Service using updateItem() I guess not.