<?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 Query for Service Definition in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/query-for-service-definition/m-p/1561289#M73224</link>
    <description>&lt;P&gt;I am attempting to query for a service definition and getting list index out of range errors... not sure why.&lt;/P&gt;&lt;P&gt;Is it because it cant read it... the Service Definition is shared publicly so should not be permissions...&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any thoughts&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;sd_fs_name = "NeighborhoodUtilityPermits"
portal = "https://www.arcgis.com"
user = "username" # username that has permissions to the Feature Layer

sdItem = gis.content.search(query="title:"+ sd_fs_name + " AND owner: " + user, item_type="Service Definition")[0]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Search for original SD on portal…&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:\Users\Desktop\Portal_to_AGOL_Processing\ProcessingtoAGOL\AGOL_Module.py", line 96, in &amp;lt;module&amp;gt;&lt;BR /&gt;sdItem = gis.content.search(query="title:"+ sd_fs_name + " AND owner: " + user, item_type="Service Definition")[0]&lt;BR /&gt;IndexError: list index out of range&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Nov 2024 16:03:24 GMT</pubDate>
    <dc:creator>kapalczynski</dc:creator>
    <dc:date>2024-11-21T16:03:24Z</dc:date>
    <item>
      <title>Query for Service Definition</title>
      <link>https://community.esri.com/t5/python-questions/query-for-service-definition/m-p/1561289#M73224</link>
      <description>&lt;P&gt;I am attempting to query for a service definition and getting list index out of range errors... not sure why.&lt;/P&gt;&lt;P&gt;Is it because it cant read it... the Service Definition is shared publicly so should not be permissions...&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any thoughts&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;sd_fs_name = "NeighborhoodUtilityPermits"
portal = "https://www.arcgis.com"
user = "username" # username that has permissions to the Feature Layer

sdItem = gis.content.search(query="title:"+ sd_fs_name + " AND owner: " + user, item_type="Service Definition")[0]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Search for original SD on portal…&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:\Users\Desktop\Portal_to_AGOL_Processing\ProcessingtoAGOL\AGOL_Module.py", line 96, in &amp;lt;module&amp;gt;&lt;BR /&gt;sdItem = gis.content.search(query="title:"+ sd_fs_name + " AND owner: " + user, item_type="Service Definition")[0]&lt;BR /&gt;IndexError: list index out of range&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 16:03:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/query-for-service-definition/m-p/1561289#M73224</guid>
      <dc:creator>kapalczynski</dc:creator>
      <dc:date>2024-11-21T16:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Query for Service Definition</title>
      <link>https://community.esri.com/t5/python-questions/query-for-service-definition/m-p/1561359#M73225</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/633156"&gt;@kapalczynski&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you remove the [0] is the GIS search returning an empty list, or a list at all? You may try print(type(sdItem)) to see if it's returning a certain type that isn't a list.&lt;/P&gt;&lt;P&gt;If it isn't returning anything in the list or is an empty list, check your content.search to be sure it's querying correctly.&lt;/P&gt;&lt;P&gt;Cody&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 17:48:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/query-for-service-definition/m-p/1561359#M73225</guid>
      <dc:creator>CodyPatterson</dc:creator>
      <dc:date>2024-11-21T17:48:09Z</dc:date>
    </item>
  </channel>
</rss>

