<?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: API Fails to get Sublayers to a Feature Layer (the second time in a loop) in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/api-fails-to-get-sublayers-to-a-feature-layer-the/m-p/1145890#M7143</link>
    <description>&lt;LI-CODE lang="python"&gt;lyr = gis.content.get('87acff1ba86c40098b59472292de3d11')

[l.query(return_all_records=False, result_record_count=5, return_ids_only=True) for l in lyr.layers]&lt;/LI-CODE&gt;&lt;P&gt;Returns&lt;/P&gt;&lt;PRE&gt;[{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 4, 5, 6, 7]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 6]}]&lt;/PRE&gt;&lt;P&gt;Run on AGOL, too. Perhaps it's specific to the layer(s) you're trying to query? Any chance it's public for someone else to test?&lt;/P&gt;</description>
    <pubDate>Fri, 18 Feb 2022 22:55:20 GMT</pubDate>
    <dc:creator>jcarlson</dc:creator>
    <dc:date>2022-02-18T22:55:20Z</dc:date>
    <item>
      <title>API Fails to get Sublayers to a Feature Layer (the second time in a loop)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/api-fails-to-get-sublayers-to-a-feature-layer-the/m-p/1145802#M7140</link>
      <description>&lt;P&gt;Hello and greetings:&lt;/P&gt;&lt;P&gt;Executing the code below will explain everything (I hope).&lt;/P&gt;&lt;P&gt;When the API consumes a Feature Layer with multiple sublayers, it fails to execute a query on the second thru nth sublayer. The API complains that there it cannot perform the operation because I'm using invalid query parameters.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DirkVandervoort_0-1645292775751.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/34459i3B7A1B3ECF39498B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DirkVandervoort_0-1645292775751.png" alt="DirkVandervoort_0-1645292775751.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;More importantly, I just want to perform a query on a sublayer and to be able to specify the which sublayer to query. Any thoughts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def main():
    target_item_string = "_USE_AN_ITEM_ID_TO_GET_A_FEATURE_LAYER_"
    gis = GIS("https://YOUR_DOMAIN.maps.arcgis.com", "superuser", "T0p5Ecr3T")
    result = gis.content.get(target_item_string)
    for layer in result.layers:
        query_result = layer.query()
        # do something with the query_result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TIA&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 17:46:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/api-fails-to-get-sublayers-to-a-feature-layer-the/m-p/1145802#M7140</guid>
      <dc:creator>DirkVandervoort</dc:creator>
      <dc:date>2022-02-19T17:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: API Fails to get Sublayers to a Feature Layer (the second time in a loop)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/api-fails-to-get-sublayers-to-a-feature-layer-the/m-p/1145804#M7141</link>
      <description>&lt;P&gt;Why not use &lt;STRONG&gt;gis.content.get('itemidforyourfeaturelayer')&lt;/STRONG&gt;? You'll be assured that the response is the single Item you want, where searching is not always 100% reliable.&lt;/P&gt;&lt;P&gt;Have you tried supplying other parameters to the query?&lt;/P&gt;&lt;P&gt;Edit to add: I tested this and don't see the same behavior. What version of the API are you using? And is this AGOL, or Portal? And if Portal, what version?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 21:32:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/api-fails-to-get-sublayers-to-a-feature-layer-the/m-p/1145804#M7141</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-02-18T21:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: API Fails to get Sublayers to a Feature Layer (the second time in a loop)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/api-fails-to-get-sublayers-to-a-feature-layer-the/m-p/1145808#M7142</link>
      <description>&lt;P&gt;Thanks Josh, cleaner code (updated above), but it didn't solve the issue.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Yes, I've tried providing parameters, including 1=1&lt;/LI&gt;&lt;LI&gt;This is on AGOL. I haven't tried it on a Portal instance&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 21:43:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/api-fails-to-get-sublayers-to-a-feature-layer-the/m-p/1145808#M7142</guid>
      <dc:creator>DirkVandervoort</dc:creator>
      <dc:date>2022-02-18T21:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: API Fails to get Sublayers to a Feature Layer (the second time in a loop)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/api-fails-to-get-sublayers-to-a-feature-layer-the/m-p/1145890#M7143</link>
      <description>&lt;LI-CODE lang="python"&gt;lyr = gis.content.get('87acff1ba86c40098b59472292de3d11')

[l.query(return_all_records=False, result_record_count=5, return_ids_only=True) for l in lyr.layers]&lt;/LI-CODE&gt;&lt;P&gt;Returns&lt;/P&gt;&lt;PRE&gt;[{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 4, 5, 6, 7]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 5]},&lt;BR /&gt;{'objectIdFieldName': 'OBJECTID', 'objectIds': [1, 2, 3, 4, 6]}]&lt;/PRE&gt;&lt;P&gt;Run on AGOL, too. Perhaps it's specific to the layer(s) you're trying to query? Any chance it's public for someone else to test?&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 22:55:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/api-fails-to-get-sublayers-to-a-feature-layer-the/m-p/1145890#M7143</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-02-18T22:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: API Fails to get Sublayers to a Feature Layer (the second time in a loop)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/api-fails-to-get-sublayers-to-a-feature-layer-the/m-p/1145943#M7144</link>
      <description>&lt;P&gt;change&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;l.query(return_all_records=False, result_record_count=5, return_ids_only=True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;l.query(return_all_records=True, return_ids_only=False)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and it does not work&lt;/P&gt;</description>
      <pubDate>Sat, 19 Feb 2022 16:38:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/api-fails-to-get-sublayers-to-a-feature-layer-the/m-p/1145943#M7144</guid>
      <dc:creator>DirkVandervoort</dc:creator>
      <dc:date>2022-02-19T16:38:49Z</dc:date>
    </item>
  </channel>
</rss>

