Access Archive Class with ArcGIS Server

I would like to know if there is a way to access the archive class in a Map Service on ArcGIS Server.

I have a Map Service with feature class stored in a SDE GeoDatabase with Archiving and Versionning enabled.

My questions are:

When features are added/updated/removed on a feature class with Archiving using the Feature Access capability of ArcGIS Server, does the Archive Class is updated?

Is it possible to query the Archive Class in order to retrieve features at a perticular moment using the Feature Access or Mapping capabilities through the REST API?

When I try to publish a Map Service containing an Archive Class to ArcGIS Server I have an error saying: Layer's data source is not registered with the geodatabase (Feature Service). Does it means it's not possible to publish an Archive Class?

1. Enabling Archiving is a database action, nothing to do with ArcGIS Server. When the feature is edited, the triggers put in place for Archiving to work take over, regardless if the edit came from ArcGIS Server or ArcDesktop.

2. Enable Time aware when creating ArcGIS Server Services

3. I dont quite understand why one would publish the archived tables directly. You dont add the archived tables directly in arcmap, you work with the archived items through the featureclass in which the archived was enabled.

The aim to publish an archived table through ArcGIS Server is simply to enable making queries on it. It could be interesting for a web application to allow user to see how the data changed for a period of time.

I realize that an archived table cannot be published into a map service if the Features Access capability is enabled, but there is no problem if it's desabled.

I'm experiencing the exact same issue. I would like to publish the archive table as a layer to allow a user to see what the data looked like at specific times in history, including data that has been deleted in the current version. I also tried to create a view with the archive table and publish that, but was also unsuccessful.

How would one use REST services to detect what features have been deleted during a certain period of time? More to the point, how would one synchronize two identical feature types using only REST services? The trouble I'm seeing is there is no way of querying for deleted features because, well, they're deleted. I would think archiving would provide a mechanism for seeing what was deleted within a time period.

The trouble I'm seeing is there is no way of querying for deleted features because, well, they're deleted.

First, no features are deleted. Archiving does not work this way.

Archiving is applied on the database level, before the GIS Web Stack. When you Archive enable a featureclass, what happens is a VIEW is created. it will be a table name ending with _EVW. The 'featureclass' table will have ALL records created / Inserted. Any current record is given a 9999 date stamp in an auto generated field when archiving. Any time a new feature is added, it is given this stamp. Any existing record that is EDITED or DELETED has its record / feature COPIED into the same table, the new record is given a 9999 stamp and the original record or 'deleted' record is given a real time stamp.

No records are ever deleted or edited, only created. This of course is something to be aware of for scaling the db size and performance.

when adding the layer in ArcGIS Desktop, add the feature layer, enable TIME on the layer, publish to ArcGIS Server. ALL records are accessible. You can also use the Feature Access Service and allow edits... and it will all work. Showing the layer will show only 9999 stamped records aka current. Enabling a time slider allows you to select Timestamped records...this would show records you have 'deleted' (which in the db, is not deleted) or edited changes.

thanks for your replies, I'm having trouble replicating some of the items you mentioned and am wondering what I'm misunderstanding.

If it makes a difference I'm talking about a SQL Server 2012 Geodatabase at ArcGIS 10.4.0 for my current DB environment, with ArcGIS Server 10.4.0 unfederated. I'm not sure it does, but you never know.

When I enable Archiving it looks to be creating a "FeatureClass"_H table. So if the feature class is GIPractice the historical (or archive table) is GIPractice_H (checking the source of the "Historical Archive" layer added with the Geodatabase History Toolbar backs this up). The time control fields in there seem to be GDB_FROM_DATE and GDB_TO_DATE, although the created_date and last_edited_date also appear.

When I look at the GIPractice_evw view query in SQL Server manager I don't see any reference to the GPIPractice_H table, and can't seem to find records that are deleted, but are visible in the "_H" table. Also, when I pull the feature class into ArcMap and make it time aware the GDB_FROM_DATE and GDB_TO_DATE fields are missing, only the created_date and last_edited_date fields are available, and they only seem to show the current data.

what am I missing here? I felt like I was finally getting a hold on some of this background DB stuff and it seems like I'm missing something important here.

ahh - I think the confusion might be that the data I'm talking about is versioned - which, based on the link you added, works differently than non-versioned data when archiving. I didn't know they were treated differently.

Add the Archived featureclass. This contains the current view of the features, i.e. the latest version. You don't have GDB_FROM_DATE and GDB_TO_DATE.

Open the Geodatabase History toolbar

Select the featureclass in the TOC and click on the Add Historical Archive button

This will add a new layer to the TOC, containing all features, including both time fields

Optionally, enable time on that layer and specify the start time and end time fields. If you do this, you can specify the time field in a REST call to ArcGIS Server. If you don't, you can still query the history, but you need to build the where clause including a date manually

Publish as a mapservice

As far as I know, _H tables are created the moment you disable archiving and choose to maintain the history. Enable and disable again will create _H1, _H2 et cetera.

that's all working great for me except for the last point - my publishing keeps failing and I can't figure out why. maybe I'll try putting together a new from scratch geodatabase and give it another go. I'll let you guys know if there is any progress.

To answer your questions in reverse order I'm using a SQL Server Enterprise Geodatabase. ArcGIS 10.4, SQL 2012 SP3. for the initial testing I was using an Enterprise database that I had previously created for some data work, but wanted to create a new one "from scratch" just for this testing, sorry for the confusion.

for the failure - after publishing (no errors during analyze) - I get:

"Packaging succeeded, but publishing failed. ERROR 001487: Failed to update the published server with the server-side data location. Please see the server's log for more details. Please conuslt the GP Results Window for enhanced error description or contact your administrator for the server logs."

The GP Results Window shows a successful Stage Service, but a failure to upload the service definition (I have published other services while this issue has persisted so it shouldn't be a standard publishing issue). The GP window shows errors 001487 (as above) and Error 001369: "Failed to create the service."

the 2nd error seems to be the diagnostic one here to me, although I don't understand why its happening. The connection string that is registered with Server is the same connection string the data is added with so access shouldn't be an issue.