<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Export data from Map Service in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486380#M18851</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It comes back with a bit different error this time:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Users\Josh White\AppData\Roaming\ESRI\Desktop10.3\ArcToolbox\My Toolboxes\Download Service with Attachments.py", line 46, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; params = {'where': '1=1', 'returnIdsOnly': 'true', 'token': token, 'f': 'json'}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NameError: name 'token' is not defined&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Failed to execute (DownloadService).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have another question, is the intent to do one layer at a time?&amp;nbsp; If that is the case, I would need the ID number for the layer, is that correct?&amp;nbsp; I've tried it both ways and the error is the same for both methods so it is catching on something else first.&amp;nbsp; It appears it is still "catching" because of the secure service.&amp;nbsp; I'm afraid I don't know enough python to know what I am looking at. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Sep 2015 15:55:48 GMT</pubDate>
    <dc:creator>JoshWhite</dc:creator>
    <dc:date>2015-09-30T15:55:48Z</dc:date>
    <item>
      <title>Export data from Map Service</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486372#M18843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a tool (in ArcMap) to extract data from a map or feature service I am accessing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Clip_715.jpg" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/23883_Clip_715.jpg" style="width: 620px; height: 322px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Hani&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Oct 2014 10:35:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486372#M18843</guid>
      <dc:creator>HaniDraidi</dc:creator>
      <dc:date>2014-10-23T10:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Export data from Map Service</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486373#M18844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not specifically no.&amp;nbsp; If you can filter your search so that you want fewer records than the server's record limit, you can query the map service.&amp;nbsp; Open up the map service in a browser.&amp;nbsp; Navigate to the service you want and there should be a QUERY link at the bottom.&amp;nbsp; Fill out the form and request the results in json (if you want everything you can always try WHERE 1=1).&amp;nbsp; Copy paste them into a text file and you can use a JSON to features tool that will build the polygons with attributes for you.&amp;nbsp; It can be time consuming but it is possible.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 May 2015 23:32:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486373#M18844</guid>
      <dc:creator>AlexPerez</dc:creator>
      <dc:date>2015-05-12T23:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: Export data from Map Service</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486374#M18845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="text-align: left;"&gt;For image service if the download capability is checked (not default) you can use right click, Data, Download selected rasters.&lt;/P&gt;&lt;P style="text-align: left;"&gt;You must select some rasters before the option is enabled.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2015 05:56:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486374#M18845</guid>
      <dc:creator>ModyBuchbinder</dc:creator>
      <dc:date>2015-05-13T05:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: Export data from Map Service</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486375#M18846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hani,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take a look at the following tool:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://epro.maps.arcgis.com/home/item.html?id=16e5cc64178941839eca62837f168ec9" title="http://epro.maps.arcgis.com/home/item.html?id=16e5cc64178941839eca62837f168ec9"&gt;http://epro.maps.arcgis.com/home/item.html?id=16e5cc64178941839eca62837f168ec9&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2015 11:57:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486375#M18846</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-05-13T11:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: Export data from Map Service</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486376#M18847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for posting this tool Jake - REALLY HELPFUL.&amp;nbsp; I was trying to use ArcMap to export 120k+ features from an AGS feature service that one of our partnering agencies had set up....I kept getting a "client timeout/server not responding error".&amp;nbsp; I noticed that when I selected a small number of features the AGS feature service export would complete successfully.&amp;nbsp; I know that on our own AGS feature services that the max number of records returned by server is set at 1000 (default presumably).&amp;nbsp; And from looking at the code you have provided, this tool appears to dice up the download/extract in chunks of 1000 records by ObjectID.&amp;nbsp; Am I connecting the dots correctly here?&amp;nbsp; - That the 1000 record limit is expected per this client/server process and being accounted for in your code?&amp;nbsp; Or, let me know otherwise.... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Nick&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2015 18:57:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486376#M18847</guid>
      <dc:creator>NickHarvey</dc:creator>
      <dc:date>2015-07-08T18:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: Export data from Map Service</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486377#M18848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, that is correct. The script appends 1000 features at a time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2015 16:23:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486377#M18848</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-07-09T16:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Export data from Map Service</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486378#M18849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/8586" target="_blank"&gt;Jake Skinner&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;I was going to try using your tools.&amp;nbsp; It is a secure service so I entered my credentials.&amp;nbsp; The script acts as if it cannot generate a token.&amp;nbsp; One thing I notice is that when I type in my password and move on to the next box the number of characters change in the password box, I'm hoping it is not defaulting to another password that I cannot see.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Executing: DownloadService false true &lt;A href="http://&amp;lt;serviceurl&amp;gt;/countymap/rest/services/Clip_Ship/CL_ParcelData/FeatureServer/8" rel="nofollow noopener noreferrer" target="_blank"&gt;http://&amp;lt;serviceurl&amp;gt;/countymap/rest/services/Clip_Ship/CL_ParcelData/FeatureServer/8&lt;/A&gt; true false JWhite ***** "Database Connections\Connection to GIS-SERVER.sde\acgis.DBO.Address\acgis.DBO.AddressPoints" false #
Start Time: Thu Sep 24 09:33:31 2015
Running script DownloadService...
Generating Token
　
URL is incorrect.&amp;nbsp; Or, Service is secure, please enter username and password.
Failed script DownloadService...
Traceback (most recent call last):
&amp;nbsp; File "C:\Users\Josh White\AppData\Roaming\ESRI\Desktop10.3\ArcToolbox\My Toolboxes\Download Service with Attachments.py", line 53, in &amp;lt;module&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; iteration = int(data['objectIds'][-1])
KeyError: 'objectIds'
&lt;SPAN style="font-size: 10pt;"&gt;
&lt;/SPAN&gt;
Failed to execute (DownloadService).
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:25:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486378#M18849</guid>
      <dc:creator>JoshWhite</dc:creator>
      <dc:date>2021-12-11T21:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Export data from Map Service</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486379#M18850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Josh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe I fixed the issue, and updated the tool:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://countysandbox.maps.arcgis.com/home/item.html?id=2b1f198be4ea44288418fd39f1d0aff0" title="http://countysandbox.maps.arcgis.com/home/item.html?id=2b1f198be4ea44288418fd39f1d0aff0"&gt;http://countysandbox.maps.arcgis.com/home/item.html?id=2b1f198be4ea44288418fd39f1d0aff0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Re-download the tool and let me know if you run into the same issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Sep 2015 16:51:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486379#M18850</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-09-24T16:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Export data from Map Service</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486380#M18851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It comes back with a bit different error this time:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Users\Josh White\AppData\Roaming\ESRI\Desktop10.3\ArcToolbox\My Toolboxes\Download Service with Attachments.py", line 46, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; params = {'where': '1=1', 'returnIdsOnly': 'true', 'token': token, 'f': 'json'}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NameError: name 'token' is not defined&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Failed to execute (DownloadService).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have another question, is the intent to do one layer at a time?&amp;nbsp; If that is the case, I would need the ID number for the layer, is that correct?&amp;nbsp; I've tried it both ways and the error is the same for both methods so it is catching on something else first.&amp;nbsp; It appears it is still "catching" because of the secure service.&amp;nbsp; I'm afraid I don't know enough python to know what I am looking at. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2015 15:55:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486380#M18851</guid>
      <dc:creator>JoshWhite</dc:creator>
      <dc:date>2015-09-30T15:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: Export data from Map Service</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486381#M18852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, the tool is designed to download a feature layer, so you will need to specify the index of the layer you wish to download.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try running the tool with the following service URL below.&amp;nbsp; I just tested it, and it worked successfully.&amp;nbsp; Be sure that you download the most recent version of the tool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://54.209.148.150:6080/arcgis/rest/services/Voting_Districts/MapServer/0" title="http://54.209.148.150:6080/arcgis/rest/services/Voting_Districts/MapServer/0"&gt;http://54.209.148.150:6080/arcgis/rest/services/Voting_Districts/MapServer/0&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;username:&amp;nbsp; viewer1&lt;/P&gt;&lt;P&gt;password:&amp;nbsp; viewer1&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Sep 2015 18:19:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486381#M18852</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-09-30T18:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Export data from Map Service</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486382#M18853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jake Skinner, I found your tool very useful and helpful but I still get the error below;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;iteration = int(data['OBJECTIDS'][-1])&lt;/P&gt;&lt;P&gt;KeyError: 'OBJECTIDS'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See my code block below as well;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;username = "ASDERT"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; password = "@######"&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; baseURL = '&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fservices5.arcgis.com%2Fb23aIR8OqGRlfJlE%2Farcgis%2Frest%2Fservices%2FPropertyEnumerationForm%2FFeatureServer%2F0" rel="nofollow" target="_blank"&gt;http://services5.arcgis.com/b23aIR8OqGRlfJlE/arcgis/rest/services/PropertyEnumerationForm/FeatureServer/0&lt;/A&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage('\nGenerating Token\n')&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tokenURL = '&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fwww.arcgis.com%2Fsharing%2Frest%2FgenerateToken" rel="nofollow" target="_blank"&gt;https://www.arcgis.com/sharing/rest/generateToken&lt;/A&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params = {'f': 'pjson', 'username': username, 'password': password, 'referer': '&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fwww.arcgis.com" rel="nofollow" target="_blank"&gt;http://www.arcgis.com&lt;/A&gt;&lt;SPAN&gt;'}&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; req = urllib2.Request(tokenURL, urllib.urlencode(params))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; response = urllib2.urlopen(req)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data = json.load(response)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; token = data['token']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Return largest objectIds&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params = {'where': '1=1', 'returnIdsOnly': 'true', 'token': token, 'f': 'json'}&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; req = urllib2.Request(baseURL, urllib.urlencode(params))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; response = urllib2.urlopen(req)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data = json.load(response)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data['objectIds'].sort()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddWarning("\nURL is incorrect.&amp;nbsp; Or, Service is secure, please enter username and password.\n")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iteration = int(data['OBJECTIDS'][-1])&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; minOID = int(data['OBJECTIDS'][0]) - 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OID = data['objectIdsFieldName']&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly assist me with this, Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Oct 2015 23:42:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486382#M18853</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2015-10-16T23:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: Export data from Map Service</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486383#M18854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Olaniyan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When running the tool on the service, I did not receive any errors.&amp;nbsp; Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="screen1.PNG" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/132201_screen1.PNG" style="width: 620px; height: 411px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="screen2.PNG" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/132202_screen2.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Oct 2015 11:42:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486383#M18854</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-10-19T11:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Export data from Map Service</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486384#M18855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Jake,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was trying to run the script behind a button, see script below;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import pythonaddins
import os
import datetime
import time
import os, sys
import urllib, urllib2, arcpy, json
import uuid
arcpy.env.overwriteOutput = True
class AGOLClass1(object):
&amp;nbsp;&amp;nbsp;&amp;nbsp; """Implementation for AGOL_addin.button (Button)"""
&amp;nbsp;&amp;nbsp;&amp;nbsp; def __init__(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.enabled = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; self.checked = False
&amp;nbsp;&amp;nbsp;&amp;nbsp; def onClick(self):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; username = "TAXXXX"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; password = "#######"
&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; baseURL = '&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fservices5.arcgis.com%2Fb23aIR8OqGRlfJlE%2Farcgis%2Frest%2Fservices%2FPropertyEnumerationForm%2FFeatureServer%2F0" target="_blank"&gt;http://services5.arcgis.com/b23aIR8OqGRlfJlE/arcgis/rest/services/PropertyEnumerationForm/FeatureServer/0&lt;/A&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage('\nGenerating Token\n')
&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tokenURL = '&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fwww.arcgis.com%2Fsharing%2Frest%2FgenerateToken" target="_blank"&gt;https://www.arcgis.com/sharing/rest/generateToken&lt;/A&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;
&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params = {'f': 'pjson', 'username': username, 'password': password, 'referer': '&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fwww.arcgis.com" target="_blank"&gt;http://www.arcgis.com&lt;/A&gt;&lt;SPAN&gt;'}&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; req = urllib2.Request(tokenURL, urllib.urlencode(params))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; response = urllib2.urlopen(req)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data = json.load(response)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; token = data['token']
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Return largest objectIds
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; params = {'where': '1=1', 'returnIdsOnly': 'true', 'token': token, 'f': 'json'}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; req = urllib2.Request(baseURL, urllib.urlencode(params))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; response = urllib2.urlopen(req)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data = json.load(response)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data['objectIds'].sort()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddWarning("\nURL is incorrect.&amp;nbsp; Or, Service is secure, please enter username and password.\n")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iteration = str(data['objectIds'][-1])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; minOID = str(data['objectIds'][0]) - 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OID = data['objectIdsFieldName']&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and I get the error below;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Users\KUNLE\AppData\Local\ESRI\Desktop10.2\AssemblyCache\{322E160C-A3DE-48C9-BEBC-86802FD9C785}\AGOL_addin.py", line 40, in onClick&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iteration = str(data['objectIds'][-1])&lt;/P&gt;&lt;P&gt;KeyError: 'objectIds'&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the script runs well as a script tool under a toolbox. Kindly assist, thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:25:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486384#M18855</guid>
      <dc:creator>OLANIYANOLAKUNLE</dc:creator>
      <dc:date>2021-12-11T21:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: Export data from Map Service</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486385#M18856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks &lt;A href="https://community.esri.com/migrated-users/8586"&gt;Jake Skinner&lt;/A&gt;‌ for the python script. This is awesome!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just an FYI for all - in ArcGIS Pro, you can use geoprocessing tools such as 'Feature Class to Feature Class' to export data from a layer off a map service. And you can download all data not just first 1,000 or whatever is MaxRecordCount is set to (as long as the server is not an older version).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steps&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Copy the url of the layer - make sure to the url ends with '&lt;SPAN style="color: #0000ff;"&gt;/MapServer/&amp;lt;number&amp;gt;&lt;/SPAN&gt;' not '/MapServer'&lt;BR /&gt;e.g. &lt;A class="link-titled" href="https://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer/0" title="https://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer/0"&gt;https://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer/0&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Click Data From Path &lt;BR /&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/487907_pastedImage_2.png" /&gt;&lt;/LI&gt;&lt;LI&gt;Paste the url&lt;/LI&gt;&lt;LI&gt;OK&lt;/LI&gt;&lt;LI&gt;Open &lt;STRONG&gt;Feature Class to Feature Class&lt;/STRONG&gt; gp tool&lt;/LI&gt;&lt;LI&gt;Select the layer&lt;/LI&gt;&lt;LI&gt;Specify output&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Run&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Apr 2020 15:02:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486385#M18856</guid>
      <dc:creator>TanuHoque</dc:creator>
      <dc:date>2020-04-08T15:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Export data from Map Service</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486386#M18857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to fetch data from a map server that I do not manage and I am receiving the following error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proxy server got bad address from remote server (verify the server is running). (status code 504).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jul 2020 19:37:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/export-data-from-map-service/m-p/486386#M18857</guid>
      <dc:creator>Esad</dc:creator>
      <dc:date>2020-07-16T19:37:25Z</dc:date>
    </item>
  </channel>
</rss>

