This Python script turns an MXD into a service definition (SD) file. Your ArcGIS.com account is searched for a matching service. The SD file is uploaded to your ArcGIS.com account, the existing service is deleted, and the uploaded SD file is published. See more information on the [associated ArcGIS Blog post](http://blogs.esri.com/esri/arcgis/2014/01/22/ updating-your-hosted-feature-service-–-version-2/). The original blog post for ArcGIS 10.1 can be found here.
- Download the update.py and settings.ini files. (Hint: Click the "Download Zip" button on the right)
- Save these files to your local working directory
- Download the Python module, 'requests'. You can see it on GitHub here or directly download the zip file here 3a. Open the zip file and save the 'requests' folder to your working directory or deploy to your Python installation
- Update the settings.ini file to values for your service.
- Run the python script
.. code-block:: pycon
c:\>c:\Python27\ArcGIS10.2\python.exe c:\myLocalDirectory\update.py
...
Starting Feature Service publish process
found Feature Service : 7ac9e68e9cd341e0a0a217590e4f6265
found Service Definition : bb2261fe2d684e7cb950c6d29372642e
Created D:\myLocalFolder\MyMaps\tempDir\MyMapService.sd
updated SD: bb2261fe24684e7cb950c6d29372642e
successfully deleted...7ac9e68e9cd34fe0a0f217590e4f6265...
successfully updated...[{u'encodedServiceURL': u'http://services1.arcgis.com/hLJbHVsas2rDIzK0I/arcgis/rest/services/MyMapService/FeatureServer', u'jobId': u'c886b86c-46d4-4be2-95ab-32b284b72dfb', u'serviceurl': u'http://services1.arcgis.com/hLJbHVsas2rDIzK0I/arcgis/rest/services/MyMapService/FeatureServer', u'type': u'Feature Service', u'serviceItemId': u'7df087dfea1b4c7bad2ba372faeefc1c', u'size': 75344}]...
successfully shared...7df087dfea1b4c7bad2ba372faeefc1c...
finished.
- ArcGIS 10.2 (or 10.2.1)
Find a bug or want to request a new feature? Please let us know by submitting an issue.
Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.
Copyright 2013 Esri
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
A copy of the license is available in the repository's license.txt file.
[](Esri Tags: ArcGIS.com Online Update Hosted Feature Services Automate Python Publish) [](Esri Language: Python)