<?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 arcgis.gis.Item.get_data() returns None in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-gis-item-get-data-returns-none/m-p/832273#M3219</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am adding a hosted feature layer by zipping a file geodatabase, adding it using gis.content.add, then publishing the layer. I am then retrieving the layer using gis.content.search, getting the item, and then trying to use item.get_data(try_json=True). It is returning None, which from the documentation I can see says that 'Zero byte files will return None'. I am unsure why there is no data returning. I can add the layer to a map, display it, etc...but cannot get the data to return for the layer. Has anyone else dealt with this issue?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;layer_title&amp;nbsp;= &amp;lt;title&amp;gt;&lt;/P&gt;&lt;P&gt;url = "https://www.arcgis.com"&lt;BR /&gt;username = &amp;lt;username&amp;gt;&lt;BR /&gt;password = &amp;lt;password&amp;gt;&lt;BR /&gt;gis = GIS(url, username, password)&lt;/P&gt;&lt;P&gt;layer_properties = {'type': 'File Geodatabase', 'title': &amp;lt;title&amp;gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#add file gdb&lt;BR /&gt;layer = gis.content.add(item_properties=layer_properties, data=outfile) # outfile is the zipped file gdb&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#publish item&lt;BR /&gt;layer_item = layer.publish()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#delete zipped folder&lt;BR /&gt;layer.delete()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;layer_search = gis.content.search("title: {}".format(&lt;SPAN&gt;layer_title&lt;/SPAN&gt;), item_type="Feature Layer")&lt;BR /&gt;item = layer_search[0]&lt;/P&gt;&lt;P&gt;item_data = item.get_data(try_json=True)&lt;BR /&gt;print(item_data)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Oct 2019 22:20:25 GMT</pubDate>
    <dc:creator>TraceStanford1</dc:creator>
    <dc:date>2019-10-23T22:20:25Z</dc:date>
    <item>
      <title>arcgis.gis.Item.get_data() returns None</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-gis-item-get-data-returns-none/m-p/832273#M3219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am adding a hosted feature layer by zipping a file geodatabase, adding it using gis.content.add, then publishing the layer. I am then retrieving the layer using gis.content.search, getting the item, and then trying to use item.get_data(try_json=True). It is returning None, which from the documentation I can see says that 'Zero byte files will return None'. I am unsure why there is no data returning. I can add the layer to a map, display it, etc...but cannot get the data to return for the layer. Has anyone else dealt with this issue?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;layer_title&amp;nbsp;= &amp;lt;title&amp;gt;&lt;/P&gt;&lt;P&gt;url = "https://www.arcgis.com"&lt;BR /&gt;username = &amp;lt;username&amp;gt;&lt;BR /&gt;password = &amp;lt;password&amp;gt;&lt;BR /&gt;gis = GIS(url, username, password)&lt;/P&gt;&lt;P&gt;layer_properties = {'type': 'File Geodatabase', 'title': &amp;lt;title&amp;gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#add file gdb&lt;BR /&gt;layer = gis.content.add(item_properties=layer_properties, data=outfile) # outfile is the zipped file gdb&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#publish item&lt;BR /&gt;layer_item = layer.publish()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#delete zipped folder&lt;BR /&gt;layer.delete()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;layer_search = gis.content.search("title: {}".format(&lt;SPAN&gt;layer_title&lt;/SPAN&gt;), item_type="Feature Layer")&lt;BR /&gt;item = layer_search[0]&lt;/P&gt;&lt;P&gt;item_data = item.get_data(try_json=True)&lt;BR /&gt;print(item_data)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Oct 2019 22:20:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-gis-item-get-data-returns-none/m-p/832273#M3219</guid>
      <dc:creator>TraceStanford1</dc:creator>
      <dc:date>2019-10-23T22:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis.gis.Item.get_data() returns None</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-gis-item-get-data-returns-none/m-p/832274#M3220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been trying to do the same thing which is to get the feature layer into a json format but still unsuccessful.. Is there an update for this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;item = gis.content.get(hosted_feature_layer_id)&lt;BR /&gt;jsonItem = item.get_data(try_json=True)&lt;BR /&gt;print(jsonItem)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Output:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;None&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Pauline&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2020 03:36:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-gis-item-get-data-returns-none/m-p/832274#M3220</guid>
      <dc:creator>Pauline_Low_Pui_Ling</dc:creator>
      <dc:date>2020-02-25T03:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: arcgis.gis.Item.get_data() returns None</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-gis-item-get-data-returns-none/m-p/832275#M3221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;Hi &lt;A href="https://community.esri.com/migrated-users/225856"&gt;Trace Stanford&lt;/A&gt;‌,&amp;nbsp;&lt;/P&gt;&lt;P style="background-color: #ffffff; border: 0px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;You can use the get_data() to get JSON format for the WebMaps and WebScenes items. But it has various results for other items.&amp;nbsp;&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.Item.get_data" title="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.Item.get_data"&gt;arcgis.gis module — arcgis 1.7.1 documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="border: 0px;"&gt;The get_data returns an object based on the content type of the data.&amp;nbsp;&lt;SPAN style="color: #404040; background-color: #fcfcfc;"&gt;For non-JSON/text data, binary files are returned and the path to the downloaded file. For JSON/text files, a Python dictionary or a string. All others will be a byte array, that can be converted to string using data.decode(‘utf-8’). &lt;STRONG&gt;Zero byte files will return None.&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;You can check this post if you want to download the Feature Service item use extract_data tool.&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;A href="https://community.esri.com/thread/187930"&gt;Download Item Data&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;There is an example page with different usage for get_data() on different item types.&amp;nbsp;&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/python/sample-notebooks/clone-portal-users-groups-and-content/" title="https://developers.arcgis.com/python/sample-notebooks/clone-portal-users-groups-and-content/"&gt;Clone Portal users, groups and content | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2020 09:05:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-gis-item-get-data-returns-none/m-p/832275#M3221</guid>
      <dc:creator>VickyWang</dc:creator>
      <dc:date>2020-02-25T09:05:42Z</dc:date>
    </item>
  </channel>
</rss>

