<?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: How to access the ID of a published service on ArcGIS Portal? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-access-the-id-of-a-published-service-on/m-p/1268499#M67117</link>
    <description>&lt;P&gt;Scratch that, I inadvertently answered my own question. For anyone else that arrives here:&lt;BR /&gt;&lt;BR /&gt;The derived parameters listed in the help are accessed in the order they're listed. So&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/192850"&gt;@DonMorrison1&lt;/a&gt;&amp;nbsp;solution [2] is correct for gaining the&amp;nbsp;&lt;SPAN&gt;out_mapServiceItemID parameter as it's third on the list.&lt;BR /&gt;&lt;BR /&gt;Because I am using this on a hosted feature layer, I needed the fourth item on the list i.e. [3]&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Mar 2023 13:58:49 GMT</pubDate>
    <dc:creator>RichardHowe</dc:creator>
    <dc:date>2023-03-16T13:58:49Z</dc:date>
    <item>
      <title>How to access the ID of a published service on ArcGIS Portal?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-access-the-id-of-a-published-service-on/m-p/1118084#M62999</link>
      <description>&lt;P&gt;I have created an image service through a python script by first creating the draft and then staging and uploading the service definittion to the portal using these three function from arcpy in the same order "CreateImageSDDraft", "StageService_server", "UploadServiceDefinition_server".&lt;/P&gt;&lt;P&gt;Now i want to access the ID of the service that has been created so i can modify the contents or delete the service. How can i access the ID through python?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Nov 2021 10:09:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-access-the-id-of-a-published-service-on/m-p/1118084#M62999</guid>
      <dc:creator>RehanChaudhary</dc:creator>
      <dc:date>2021-11-18T10:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to access the ID of a published service on ArcGIS Portal?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-access-the-id-of-a-published-service-on/m-p/1118114#M63001</link>
      <description>&lt;P&gt;You can get that from the "Derived Output" which is described in the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/server/upload-service-definition.htm" target="_self"&gt;documentation&lt;/A&gt;.&amp;nbsp; Here is a snippet of my code that gets the item of the published image service&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    rsp = arcpy.UploadServiceDefinition_server(&amp;lt;sd_output_filename&amp;gt;, "HOSTING_SERVER")
    gis_item = gis.content.get(rsp[2])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Nov 2021 12:50:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-access-the-id-of-a-published-service-on/m-p/1118114#M63001</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2021-11-18T12:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to access the ID of a published service on ArcGIS Portal?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-access-the-id-of-a-published-service-on/m-p/1118140#M63002</link>
      <description>&lt;P&gt;Also note that you can access the ID of anything in your portal using the ArcGIS Python API. If you're running it from Pro, it might look like:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
gis = GIS("home")

search = gis.content.search('some service name or search term', max_items=-1)

[f'{i.id}  |  {i.title[:32]:32}  |  {i.type}' for i in search]&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1637243151704.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/27761iF6F2BB06A91874A9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1637243151704.png" alt="jcarlson_0-1637243151704.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I think &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/192850"&gt;@DonMorrison1&lt;/a&gt;&amp;nbsp; has the proper solution to this, but if you needed to find the ID after the fact, being able to quickly search the portal and return it is useful as well.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Nov 2021 13:47:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-access-the-id-of-a-published-service-on/m-p/1118140#M63002</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-11-18T13:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to access the ID of a published service on ArcGIS Portal?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-access-the-id-of-a-published-service-on/m-p/1268490#M67116</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/192850"&gt;@DonMorrison1&lt;/a&gt;&amp;nbsp;I arrived at this post after searching for this very solution. Unfortunately you code doesn't seem to work for me&lt;BR /&gt;&lt;BR /&gt;When I use it as it is there for my newly uploaded hosted feature layer it throws:&lt;BR /&gt;&lt;BR /&gt;Exception: Invalid URL&lt;BR /&gt;(Error Code: 400)&lt;BR /&gt;&lt;BR /&gt;Has something changed since you posted this? If not, and just as an aside, I'm curious as to why you're accessing the [2] from your rsp item. This implies to me rsp is returning a list and you;re requesting the third item in that list&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 13:49:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-access-the-id-of-a-published-service-on/m-p/1268490#M67116</guid>
      <dc:creator>RichardHowe</dc:creator>
      <dc:date>2023-03-16T13:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to access the ID of a published service on ArcGIS Portal?</title>
      <link>https://community.esri.com/t5/python-questions/how-to-access-the-id-of-a-published-service-on/m-p/1268499#M67117</link>
      <description>&lt;P&gt;Scratch that, I inadvertently answered my own question. For anyone else that arrives here:&lt;BR /&gt;&lt;BR /&gt;The derived parameters listed in the help are accessed in the order they're listed. So&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/192850"&gt;@DonMorrison1&lt;/a&gt;&amp;nbsp;solution [2] is correct for gaining the&amp;nbsp;&lt;SPAN&gt;out_mapServiceItemID parameter as it's third on the list.&lt;BR /&gt;&lt;BR /&gt;Because I am using this on a hosted feature layer, I needed the fourth item on the list i.e. [3]&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 13:58:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-access-the-id-of-a-published-service-on/m-p/1268499#M67117</guid>
      <dc:creator>RichardHowe</dc:creator>
      <dc:date>2023-03-16T13:58:49Z</dc:date>
    </item>
  </channel>
</rss>

