curl --request POST \
--url https://app.trustivan.com/api/v1/assets/{id}/sbom \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://app.trustivan.com/api/v1/assets/{id}/sbom"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://app.trustivan.com/api/v1/assets/{id}/sbom', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/assets/{id}/sbom"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{}{
"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"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}Import a bill of materials onto an asset
The request body is the DOCUMENT itself, not a JSON envelope containing it. An envelope would mean base64-encoding a file that may be tens of megabytes and parsing it twice.
The format is detected from the content when format is omitted. A
document declaring BOTH CycloneDX and SPDX is refused rather than
guessed at, and a declared format that disagrees with the content is
refused naming the field that disagreed.
An import ADDS and CORRECTS; it never removes. Components written by an import carry no scan reference, and scan reconciliation only removes what a scan stamped, so a container scan cannot erase an inventory a customer supplied, and an import cannot erase one a scan found.
Entries that cannot be stored are DROPPED and COUNTED rather than
aborting the import: one absurd row in a ten-thousand-component document
must not cost the customer the other 9,999. partial in the response is
true whenever anything was refused, and document.drop_reasons says
why. An inventory that is silently partial is worse than one that is
refused, because nothing in it says it is incomplete.
Authorised by scans:create: an import causes the tenant’s inventory to
change, which is what that permission already governs.
curl --request POST \
--url https://app.trustivan.com/api/v1/assets/{id}/sbom \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'import requests
url = "https://app.trustivan.com/api/v1/assets/{id}/sbom"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://app.trustivan.com/api/v1/assets/{id}/sbom', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trustivan.com/api/v1/assets/{id}/sbom"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{}{
"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"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}{
"error": "<string>",
"code": "validation_failed",
"required_scope": "<string>",
"principal": "user"
}Authorizations
Query Parameters
Body
A CycloneDX 1.5 or SPDX 2.3 document.
The body is of type object.
Response
The provenance record and what was applied. 200 rather than 201:
an import corrects an asset's inventory rather than creating a
resource at a new location.
The response is of type object.