Recovering soft deleted records
This MR adds 2 APIs as follows
Fetch Inactive Records API
This API fetches all the inactive records from repository based on descending order of modifyTime field. This API is a paginated API returning max 100 records at a time.
- URI -
/records/inactive - Method - GET
- Access - service.storage.admin role
- Max records - 100
- Filter criteria - kind, fromDate, toDate. (All the filters are optional)
Request
https://{{storageHost}}/api/storage/v2/records/inactive?kind=tenant1:public:well:1.0.2&fromDate=2025-01-01&toDate=2025-12-12&limit=50
Response
The response will be a list of soft deleted records along with cursor for next page details. Record Metadata will be returned to user.{
"records": [
{
"id": "tenant1:public:well:8bcab5c3-f1a4-4c70-a216-7ca11ca76bd5",
"kind": "tenant1:public:well:1.0.2",
"acl": {
"viewers": [
"data.viewer@tenant1.dataservices.energy",
"service.search@tenant1.dataservices.energy"
],
"owners": [
"data.owner@tenant1.dataservices.energy",
"service.legal@tenant1.dataservices.energy"
]
},
"legal": {
"legaltags": [
"tenant1-public-well-data",
"tenant1-geology-survey-2023"
],
"otherRelevantDataCountries": [
"US",
"CA"
],
"status": "compliant"
},
"ancestry": {
"parents": [
"tenant1:public:wellbore:parent-record-id"
]
},
"tags": {
"region": "north-america",
"operator": "company-abc",
"classification": "exploration"
},
"status": "deleted",
"user": "user@tenant1.com",
"createTime": "2024-01-15T10:30:00.000Z",
"createUser": "system@tenant1.com",
"modifyTime": 1705316400000,
"modifyUser": "user@tenant1.com",
"latestVersion": 3,
"gcsVersionPaths": [
"tenant1/public/well/8bcab5c3-f1a4-4c70-a216-7ca11ca76bd5/1",
"tenant1/public/well/8bcab5c3-f1a4-4c70-a216-7ca11ca76bd5/2",
"tenant1/public/well/8bcab5c3-f1a4-4c70-a216-7ca11ca76bd5/3"
],
"hash": "sha256:a5f2c8b9e1d3f7a4b2e8c9d0f1a3b5c7e9f2a4b6c8d0e2f4"
},
{
"id": "tenant1:public:seismic:9dcef7d4-g2b5-5d81-b327-8db22db87ce6",
"kind": "tenant1:public:seismic:2.1.0",
....
}
],
"cursor": "ABCXZX"
}
Recover Records API
This API would reactivate the record, features are as discussed below
- URI -
/records/recover - Method - POST
- Access - service.storage.admin role
- Max records - 500
Request
[
"ID1",
"ID2",
"ID3",
....
]
Response
{
"successfulRecords": [
"ID1",
"ID2"
],
"unsuccessfulRecords": [
{
"record_id": "ID3",
"message": "Invalid ACL"
}
]
}
Edited by Vihar Mamania