I'm trying to figure out how I can tell, looking at the metadata on a FeatureLayer (or a FeatureServer or MapServer), how recently the data for that asset has changed, like an "updated_at" field.
I know some FeatureLayers after version 10 have an "editFieldsInfo" with a possible "editDateField" that can indicate the last time a particular feature changed, but is there anything else that can indicate that on the asset as a whole?
Solved! Go to Solution.
The json file that describes your feature has the "last edit date" as a UTC timestamp (assuming AGOL). The time is the date/time of the last item added to the feature/table OR when its definition was last changed/updated.
"editingInfo" : {
"lastEditDate" : 1528926651042
},
If edit tracking is enabled, you can query the feature/table's "EditDate" field for the most recent update.
The json file that describes your feature has the "last edit date" as a UTC timestamp (assuming AGOL). The time is the date/time of the last item added to the feature/table OR when its definition was last changed/updated.
"editingInfo" : {
"lastEditDate" : 1528926651042
},
If edit tracking is enabled, you can query the feature/table's "EditDate" field for the most recent update.
Here's an old python script to get the "lastEditDate" of a feature from AGOL: Obtain last edit date from REST API using Python
As I mentioned previously, I will also query the layer/table for the "EditDate" field (when edit tracking is enabled). If the layer definition was updated (adding/modifying a domain, for example), then lastEditDate would reflect these updates, even if it has been some time since a feature was added to the layer.
Thank you Randy, that was really helpful! I was able to find a little more documentation about it on the documentation page as well: Layer (Feature Service)—ArcGIS REST API: Services Directory | ArcGIS for Developers (search 'editingInfo'). This is exactly the sort of field I was looking for.
Do you know if there is any backup field I can use, for cases when the 'editingInfo' is not provided?
I have always found lastEditDate to be in the json file and a reliable method of knowing when updates have occured. I have only on a few rare occasions found this value to be None; however, it would quickly become a date once a record was added or edited. The only backup I could suggest would be with editor tracking and examine the EditDate field. My experience has been with AGOL. I assume server/portal would be much the same.