This article explains how to undelete an asset through the API. If you only want to undelete an asset, the simpler approach is to use Search and the Asset Detail page in the application's user interface.
Deleted is just one system-defined asset state. When you have the asset's OID Token, undelete is the same as setting any other asset state via the
Undelete operation. However, since the UI and the API will both hide deleted assets by default, there are some special steps to find a deleted asset.
- Have an HTTP Client.
- Obtain an API token.
1. Query for Deleted Assets
Normally, we could use the asset state in a query to reduce the set of items we worry about. For example, send an HTTP GET with
where parameter of
AssetState='0' and a modest
page parameter to prevent returning too many results.
<Server Base URI>/rest-1.v1/Data/BaseAsset?where=AssetState='0'&page=100,0
However, deleted assets are automatically filtered from query results so trying the same thing with
AssetState='255' will return no results. We need to use the special filter token for deleted,
<Server Base URI>/rest-1.v1/Data/BaseAsset?where=IsDeleted='true'&page=100,0
2. Execute Undelete
POST /VersionOne/rest-1.v1/Data/Timebox/14636?op=Undelete HTTP/1.1 Host: www14.v1host.com Content-Type: application/xml
The response should be similar to the following.
<?xml version="1.0" encoding="UTF-8" ?> <Asset href="/v1sdktesting/rest-1.v1/Data/Timebox/14636/22331" id="Timebox:14636:22331" />
Asset node indicates the asset was properly updated.