Return an archived asset to service
curl --request POST \
--url https://app.trustivan.com/api/v1/assets/{id}/restore \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.trustivan.com/api/v1/assets/{id}/restore"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.trustivan.com/api/v1/assets/{id}/restore', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/assets/{id}/restore"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "container_image",
"identity": "<string>",
"name": "<string>",
"registry": "<string>",
"repository": "<string>",
"tag": "<string>",
"last_digest": "<string>",
"operating_system": "<string>",
"attributes": {},
"discovery_source": "scan",
"environment": "unknown",
"criticality": "unknown",
"owner": "<string>",
"first_seen_at": "2023-11-07T05:31:56Z",
"last_seen_at": "2023-11-07T05:31:56Z",
"last_scanned_at": "2023-11-07T05:31:56Z",
"archived_at": "2023-11-07T05:31:56Z",
"archived_reason": "<string>",
"archived_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}Return an archived asset to service
A separate route rather than a PATCH clearing the archive fields, because un-archiving has a billing consequence (the asset re-enters the entitlement count) and should read as a decision at the call site. So it must fit: at the plan’s asset limit the answer is 402.
Requires assets:write.
POST
/
assets
/
{id}
/
restore
Return an archived asset to service
curl --request POST \
--url https://app.trustivan.com/api/v1/assets/{id}/restore \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.trustivan.com/api/v1/assets/{id}/restore"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.trustivan.com/api/v1/assets/{id}/restore', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/assets/{id}/restore"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "container_image",
"identity": "<string>",
"name": "<string>",
"registry": "<string>",
"repository": "<string>",
"tag": "<string>",
"last_digest": "<string>",
"operating_system": "<string>",
"attributes": {},
"discovery_source": "scan",
"environment": "unknown",
"criticality": "unknown",
"owner": "<string>",
"first_seen_at": "2023-11-07T05:31:56Z",
"last_seen_at": "2023-11-07T05:31:56Z",
"last_scanned_at": "2023-11-07T05:31:56Z",
"archived_at": "2023-11-07T05:31:56Z",
"archived_reason": "<string>",
"archived_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}Authorizations
Response
The restored asset.
The thing being protected. Not a scan and not a build: if a rebuild produced a new asset, every finding would look new and every triage decision would be discarded on deploy.