Is there any way to programmatically access the 'Data Last Updated' value on the ArcGIS Online Item Details page, e.g., through the Python API? If not, are there any plans to make it available?
I am fairly sure that is a dynamically generated date based on the maximum value of last edit dates for all of layers and tables that make up the feature service:
<SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> id <SPAN class="operator token">=</SPAN> <SPAN class="comment token"># id of the item to retrieve</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> item <SPAN class="operator token">=</SPAN> gis<SPAN class="punctuation token">.</SPAN>content<SPAN class="punctuation token">.</SPAN>get<SPAN class="punctuation token">(</SPAN>id<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> data_modified <SPAN class="operator token">=</SPAN> max<SPAN class="punctuation token">(</SPAN> <SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN> i<SPAN class="punctuation token">.</SPAN>properties<SPAN class="punctuation token">.</SPAN>editingInfo<SPAN class="punctuation token">.</SPAN>lastEditDate <SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN> <SPAN class="keyword token">for</SPAN> i <SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN> <SPAN class="keyword token">in</SPAN> item<SPAN class="punctuation token">.</SPAN>layers <SPAN class="operator token">+</SPAN> item<SPAN class="punctuation token">.</SPAN>tables <SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="punctuation token">.</SPAN> <SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> datetime<SPAN class="punctuation token">.</SPAN>datetime<SPAN class="punctuation token">.</SPAN>fromtimestamp<SPAN class="punctuation token">(</SPAN>data_modified<SPAN class="operator token">/</SPAN><SPAN class="number token">1000</SPAN><SPAN class="punctuation token">)</SPAN> datetime<SPAN class="punctuation token">.</SPAN>datetime<SPAN class="punctuation token">(</SPAN><SPAN class="number token">2020</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">9</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">6</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">9</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">31</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">46</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">299000</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Use the modified property of the item:
<SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> id <SPAN class="operator token">=</SPAN> <SPAN class="comment token"># id of the item to retrieve</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> item <SPAN class="operator token">=</SPAN> gis<SPAN class="punctuation token">.</SPAN>content<SPAN class="punctuation token">.</SPAN>get<SPAN class="punctuation token">(</SPAN>id<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> datetime<SPAN class="punctuation token">.</SPAN>datetime<SPAN class="punctuation token">.</SPAN>fromtimestamp<SPAN class="punctuation token">(</SPAN>item<SPAN class="punctuation token">.</SPAN>modified<SPAN class="operator token">/</SPAN><SPAN class="number token">1000</SPAN><SPAN class="punctuation token">)</SPAN> datetime<SPAN class="punctuation token">.</SPAN>datetime<SPAN class="punctuation token">(</SPAN><SPAN class="number token">2019</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">6</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">17</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">17</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">50</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Last Updated date</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Hey Joshua,
Unfortunately this only gives the Modified Date, i.e., the date item details were changed (tags, title, etc.), not the date the data was last changed. The below screenshots are all for the same item.
Here's the modified/updated date:
And the Data Last Updated date:
And the script output, which shows the modified/updated date, not the Data Last Updated date:
Excellent, that does exactly what I was looking for. Thanks Joshua.
I'll just add that this date is apparently also updated any time a setting/capability is updated. Sync, extract, editing, etc. Which is unfortunate - it would be nice to have access to a date that always reflected the last time the data itself changed. I doubt that's possible without querying features on an editor tracking-enabled service.
Thanks very much for this. I will use this as a function, and pass item values to it, working through all items in a rest end point.
Works like a charm.
Is it possible something has changed in the API? When I try to access the lastEditDate via properties, there is an error. The item properties only provides this as a result:
{'indexJobId': '', 'indexJobUrl': ''}
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.