Frequently asked question

Can an overwritten feature layer be recovered in ArcGIS Online?

Last Published: September 18, 2024

Answer

No, an overwritten feature layer cannot be recovered in ArcGIS Online. However, the changes made to a hosted feature layer can be extracted in JSON format via the ArcGIS REST Services Directory if the layer settings are configured to allow change tracking. The change tracking record can be obtained by using the Extract Changes operation in the ArcGIS REST Services Directory. The Extract Changes operation can return the added, updated, and deleted data. Querying for updated data returns the updated data for the features only, not the previous version. The pre-edited data cannot be recovered via this operation. However, deleted data can be recovered and re-added to the hosted feature layer.

The steps below describe the workflow to recover and re-add deleted data to the hosted feature layer via the ArcGIS REST Services Directory.

Note:
The deleted features' objectIDs are not retained when the features are re-added. The re-added features are assigned new objectIDs consecutively from the last value.
  1. In ArcGIS Online, open the hosted feature layer’s item details page.
  2. Copy the layerServerGens syntax from the JSON file.
    1. On the Overview tab, next to URL, click View to open the ArcGIS REST Services Directory.
    2. In the ArcGIS REST Services Directory, click JSON to open the JSON file.
The link to the JSON file in the ArcGIS REST Services Directory
  1. Press Ctrl + F to open the search box and type layerServerGens.
  2. Highlight the layerServerGens syntax and press Ctrl + C to copy it.
The layerServerGens syntax in the ArcGIS REST Services Directory JSON
  1. Open the Extract Changes page in the ArcGIS REST Services Directory.
    1. In the browser, click the back arrow The back arrow to return to the feature service page.
    2. At the bottom of the page, in the Supported Operations list, click Extract Changes.
  1. Specify the parameters in the Extract Changes page in the ArcGIS REST Services Directory.
    1. For Layers, specify the layer ID. In this example, 0 is specified.
    2. For Geometry Type, click the drop-down arrow and select the geometry type. In this example, Point is selected.
    3. For Return Deletes, ensure the True radio button is selected.
    4. For Return Deleted Features, click the True radio button. Leaving it set to False returns the globalID only.
    5. For Layer Server Gens, paste the layerServerGens syntax copied in Step 2.
    6. Leave the rest of the parameters as default.
    7. Click Extract Changes. This refreshes the page.
The Extract Changes configuration in the ArcGIS REST Services Directory
  1. Download the JSON file and copy the deleted feature syntax.
    1. On the Extract Changes page, click the statusURL link. The page redirects to the Extract Changes Status page.
    2. Click the Result URL link to download the JSON file.
The Extract Changes Status page in the ArcGIS REST Services Directory
  1. Open the JSON file and search for deletes.
  2. Highlight the deleted feature syntax and press Ctrl + C to copy it.
The deleted features data syntax in the downloaded JSON file
  1. Re-add the deleted features to the feature service using the Add Features operation.
    1. On the ArcGIS REST Services Directory feature service page, under Layers, click the layer name to redirect to the layer’s page.
The layer name in the ArcGIS REST Services Directory feature service page
  1. At the bottom of the page, in the Supported Operations list, click Add Features.
  2. On the Add Features page, for Features, paste the copied syntax from Step 5 into the text box.
  3. For Rollback on Failure, ensure the True radio button is selected.
  4. For Format, click the drop-down arrow and select JSON.
  5. Click Add Features.
The Add Features configuration in the ArcGIS REST Services Directory Add Features page

The image below shows the JSON response syntax when the deleted features are successfully added to the feature service.

The JSON syntax response in the ArcGIS REST Services Directory

Article ID:000033505

Software:
  • ArcGIS Online
  • ArcGIS REST API

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options