<?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 Python to extract all web services's last modified date in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-python-to-extract-all-web-services-s-last/m-p/1343272#M69067</link>
    <description>&lt;P&gt;Do you mean "last modified" for the ArcGIS Item or for the associated data? I have some code that tries to find the last time the data was changed. It only works for hosted feature layers. It does not work on feature layers proxied to an ArcGIS server REST service. For those I resort to detecting when the record count changes - not perfect but good enough.&amp;nbsp; Of course if edit tracking is turned on then that makes it easy but I don't own the feature layers so I can't do that.&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;datetime.datetime.fromtimestamp(int(arcgis.features.FeatureLayer(&amp;lt;feature_layer_url&amp;gt;).properties['editingInfo']['dataLastEditDate'])/1000)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Oct 2023 22:17:46 GMT</pubDate>
    <dc:creator>DonMorrison1</dc:creator>
    <dc:date>2023-10-30T22:17:46Z</dc:date>
    <item>
      <title>Using Python to extract all web services's last modified date</title>
      <link>https://community.esri.com/t5/python-questions/using-python-to-extract-all-web-services-s-last/m-p/1341745#M69035</link>
      <description>&lt;P class=""&gt;As I explore the ArcGIS API for Python, I'm trying to find a way to extract specific details from all my web services at once. Despite my efforts, I haven't found a straightforward solution. This may &lt;SPAN class=""&gt;sound a little bit silly&lt;/SPAN&gt; on my end, but my primary objective is to retrieve the 'last modified' dates of each service under my purview. While &lt;SPAN class=""&gt;I've been able to access this data through the admin REST endpoint, I'm unsure how to extract this&lt;/SPAN&gt; using Python. Any insights or guidance on how to accomplish this in Python would be greatly &lt;SPAN class=""&gt;appreicated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Thanks in advance&lt;/P&gt;&lt;P class=""&gt;Sam&lt;/P&gt;&lt;P class=""&gt;Python learner&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 18:25:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-to-extract-all-web-services-s-last/m-p/1341745#M69035</guid>
      <dc:creator>SH013</dc:creator>
      <dc:date>2024-04-15T18:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to extract all web services's last modified date</title>
      <link>https://community.esri.com/t5/python-questions/using-python-to-extract-all-web-services-s-last/m-p/1341809#M69041</link>
      <description>&lt;P&gt;Hi Sam,&lt;/P&gt;&lt;P&gt;you could do something like this in the Python API (untested and written from memory, check the docs)&lt;/P&gt;&lt;DIV&gt;from arcgis.gis import GIS&lt;/DIV&gt;&lt;DIV&gt;from datetime import datetime&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;gis = GIS(.......)&lt;/DIV&gt;&lt;DIV&gt;items = gis.content.search("*")&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;for item in items:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; d = datetime.fromtimestamp(item.modified/1000)&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;print(f"Item {item.title} was modified {d}")&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternatively you can call the REST interface using the requests module in Python. I usually do a mix of both, but using RESTmore and more!&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Carsten&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 06:48:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-to-extract-all-web-services-s-last/m-p/1341809#M69041</guid>
      <dc:creator>CarstenB_orsted</dc:creator>
      <dc:date>2023-10-26T06:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to extract all web services's last modified date</title>
      <link>https://community.esri.com/t5/python-questions/using-python-to-extract-all-web-services-s-last/m-p/1343272#M69067</link>
      <description>&lt;P&gt;Do you mean "last modified" for the ArcGIS Item or for the associated data? I have some code that tries to find the last time the data was changed. It only works for hosted feature layers. It does not work on feature layers proxied to an ArcGIS server REST service. For those I resort to detecting when the record count changes - not perfect but good enough.&amp;nbsp; Of course if edit tracking is turned on then that makes it easy but I don't own the feature layers so I can't do that.&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;datetime.datetime.fromtimestamp(int(arcgis.features.FeatureLayer(&amp;lt;feature_layer_url&amp;gt;).properties['editingInfo']['dataLastEditDate'])/1000)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2023 22:17:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-to-extract-all-web-services-s-last/m-p/1343272#M69067</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2023-10-30T22:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to extract all web services's last modified date</title>
      <link>https://community.esri.com/t5/python-questions/using-python-to-extract-all-web-services-s-last/m-p/1409866#M70314</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I apologize for leaving this discussion open for a while. To give you more context, I am attempting to go through all of the services to extract a bulk attribute called 'lastModified'. This attribute will provide me with information on when each service was last published. I was initially trying to accomplish this task through the ArcGIS API, but I'm still struggling to figure it out.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 18:25:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-to-extract-all-web-services-s-last/m-p/1409866#M70314</guid>
      <dc:creator>SH013</dc:creator>
      <dc:date>2024-04-15T18:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to extract all web services's last modified date</title>
      <link>https://community.esri.com/t5/python-questions/using-python-to-extract-all-web-services-s-last/m-p/1409902#M70315</link>
      <description>&lt;P&gt;It looks like the "modified" property on each service item aligns with when it was last updated. You'll get some false positives for items that were edited after the service was overwritten but this should be good enough for most purposes. Take another look at Carsten's code for tips on getting the date out in a readable format.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 20:23:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-python-to-extract-all-web-services-s-last/m-p/1409902#M70315</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2024-04-15T20:23:23Z</dc:date>
    </item>
  </channel>
</rss>

