<?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: Using API doesn't return all data in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/using-api-doesn-t-return-all-data/m-p/1600315#M11273</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/894776"&gt;@jaskainth&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Probably a few other options here too, see with ArcPy below. No multiple calls and will export all records. If exporting to a file geodatabase it would also hold domains and export attachments if the service had any.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

## the filepath for the output shapefile
out_shp = r'C:\Path\to\folder\wildfires.shp'

## the url to the feature layer
url = 'https://services3.arcgis.com/T4QMspbfLg3qTGWY/arcgis/rest/services/WFIGS_Interagency_Perimeters/FeatureServer/0'

arcpy.conversion.ExportFeatures(url, out_shp)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a &lt;A href="https://learn.finaldraftmapping.com/extracting-from-an-arcgis-online-feature-service-to-a-file-geodatabase/" target="_blank" rel="noopener"&gt;blog post&lt;/A&gt; with other options using the ArcGIS API for Python / ArcPy (focuses on file geodatabases but you can switch out for a shapefile in a folder). Exporting to shapefiles can sometimes cause issues with field truncation and some other limitations associated with a shapefile.&lt;/P&gt;&lt;P&gt;While the above with ArcPy works nicely, converting a pandas spatially enabled dataframe will fail as per the below. It is not truncating the field names.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.features import FeatureLayer

## the filepath for the output shapefile
shp_path = r"C:\Path\to\shapefile\folder\wildfires.shp"

## the url to the feature layer
url = 'https://services3.arcgis.com/T4QMspbfLg3qTGWY/arcgis/rest/services/WFIGS_Interagency_Perimeters/FeatureServer/0'

## access feature layer of choice, here we are accessing the first layer
fl = FeatureLayer(url)

## use query to return a FeatureSet object
feature_set = fl.query()

print(feature_set.sdf.shape)

## attempt to create a shapefile
feature_set.sdf.spatial.to_featureclass(location=shp_path)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The shape is correct&lt;/P&gt;&lt;LI-CODE lang="python"&gt;(27997, 121)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Errors&lt;/P&gt;&lt;LI-CODE lang="python"&gt;cannot add field: 'poly_featu2'
cannot add field: 'poly_sourc2'
cannot add field: 'attr_ff_re2'
cannot add field: 'attr_fire_9'
cannot add field: 'attr_ics202'
cannot add field: 'attr_incid6'
cannot add field: 'attr_poo_j2'
cannot add field: 'attr_poo_l6'

ValueError: tuple.index(x): x not in tuple&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can probably manipulate the dataframe to overcome these.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Mar 2025 07:34:37 GMT</pubDate>
    <dc:creator>Clubdebambos</dc:creator>
    <dc:date>2025-03-28T07:34:37Z</dc:date>
    <item>
      <title>Using API doesn't return all data</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/using-api-doesn-t-return-all-data/m-p/1599976#M11266</link>
      <description>&lt;P&gt;Hi, I'm trying to use the API in python to get all wildfires from this source -&amp;nbsp;&lt;A href="https://data-nifc.opendata.arcgis.com/datasets/nifc::wfigs-interagency-fire-perimeters/about" target="_blank"&gt;https://data-nifc.opendata.arcgis.com/datasets/nifc::wfigs-interagency-fire-perimeters/about&lt;/A&gt;&amp;nbsp;(they use esri for their API). In the details it shows there are&amp;nbsp;&lt;SPAN&gt;27,977 rows. On the right side, after scrolling down on their page slightly, it shows&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;View API Resources&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and I'm using the GeoJSON URL.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When I use this in python, doing something like this,&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import geopandas as gpd
import requests
import os
url = "https://services3.arcgis.com/T4QMspbfLg3qTGWY/arcgis/rest/services/WFIGS_Interagency_Perimeters/FeatureServer/0/query?where=1%3D1&amp;amp;outFields=*&amp;amp;outSR=4326&amp;amp;f=json"
cur_path = os.path.abspath(os.getcwd())
local_filepath = os.path.join(cur_path, 'wildfires.shp')
resp = requests.get(url, stream=True)
resp.raise_for_status()
chunks_iter = resp.iter_content(chunk_size=1024 * 4)
with open(local_filepath, 'wb') as file:
    for chunk in chunks_iter:
        file.write(chunk)
df = gpd.read_file("wildfires.shp")
df.shape # Returns (2000, 121)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm only getting 2000 rows returned when there should be ~28,000 rows. Does anyone know what the issue might be here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Mar 2025 15:32:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/using-api-doesn-t-return-all-data/m-p/1599976#M11266</guid>
      <dc:creator>jaskainth</dc:creator>
      <dc:date>2025-03-27T15:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using API doesn't return all data</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/using-api-doesn-t-return-all-data/m-p/1600009#M11269</link>
      <description>&lt;P&gt;Look at the layer's property page, it states "Max Record Count: 2000", which is typical.&amp;nbsp; You will need to make multiple calls to retrieve all of the data.&amp;nbsp; You should read the REST API documentation about how to use the Result Offset and Result Record Count parameters.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Mar 2025 17:04:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/using-api-doesn-t-return-all-data/m-p/1600009#M11269</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2025-03-27T17:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using API doesn't return all data</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/using-api-doesn-t-return-all-data/m-p/1600315#M11273</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/894776"&gt;@jaskainth&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Probably a few other options here too, see with ArcPy below. No multiple calls and will export all records. If exporting to a file geodatabase it would also hold domains and export attachments if the service had any.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

## the filepath for the output shapefile
out_shp = r'C:\Path\to\folder\wildfires.shp'

## the url to the feature layer
url = 'https://services3.arcgis.com/T4QMspbfLg3qTGWY/arcgis/rest/services/WFIGS_Interagency_Perimeters/FeatureServer/0'

arcpy.conversion.ExportFeatures(url, out_shp)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a &lt;A href="https://learn.finaldraftmapping.com/extracting-from-an-arcgis-online-feature-service-to-a-file-geodatabase/" target="_blank" rel="noopener"&gt;blog post&lt;/A&gt; with other options using the ArcGIS API for Python / ArcPy (focuses on file geodatabases but you can switch out for a shapefile in a folder). Exporting to shapefiles can sometimes cause issues with field truncation and some other limitations associated with a shapefile.&lt;/P&gt;&lt;P&gt;While the above with ArcPy works nicely, converting a pandas spatially enabled dataframe will fail as per the below. It is not truncating the field names.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.features import FeatureLayer

## the filepath for the output shapefile
shp_path = r"C:\Path\to\shapefile\folder\wildfires.shp"

## the url to the feature layer
url = 'https://services3.arcgis.com/T4QMspbfLg3qTGWY/arcgis/rest/services/WFIGS_Interagency_Perimeters/FeatureServer/0'

## access feature layer of choice, here we are accessing the first layer
fl = FeatureLayer(url)

## use query to return a FeatureSet object
feature_set = fl.query()

print(feature_set.sdf.shape)

## attempt to create a shapefile
feature_set.sdf.spatial.to_featureclass(location=shp_path)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The shape is correct&lt;/P&gt;&lt;LI-CODE lang="python"&gt;(27997, 121)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Errors&lt;/P&gt;&lt;LI-CODE lang="python"&gt;cannot add field: 'poly_featu2'
cannot add field: 'poly_sourc2'
cannot add field: 'attr_ff_re2'
cannot add field: 'attr_fire_9'
cannot add field: 'attr_ics202'
cannot add field: 'attr_incid6'
cannot add field: 'attr_poo_j2'
cannot add field: 'attr_poo_l6'

ValueError: tuple.index(x): x not in tuple&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can probably manipulate the dataframe to overcome these.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2025 07:34:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/using-api-doesn-t-return-all-data/m-p/1600315#M11273</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2025-03-28T07:34:37Z</dc:date>
    </item>
  </channel>
</rss>

