{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":44196,"path":"security-management/sbom-core/vr-sbom-preparing-upload.md","title":"Uploading Software Bill of Materials files using a REST API","bundle":null,"doc_type":null,"release":"australia","body":"\n# Uploading Software Bill of Materials files using a REST API\n\nReview the following information prior to uploading Software Bill of Materials files using an API.\n\n## Using the REST API\n\nTo upload an SBOM file with an API, the sn\\_sbom\\_core.sbom\\_ingest role is required.\n\nUpload API.\n\nThis API is used for uploading and ingesting an SBOM file \\(CycloneDX/SPDX\\) into your instance.\n\nVersion 4.0 of SBOM Core supports:\n\n-   XML and JSON in CycloneDx \\(versions 1.0 - 1.6\\).\n-   JSON in SPDX \\(versions 2.2-2.3\\)\n-   **Note:** Files over 32 MB might not load properly.\n\n\nHTTP method: \\(POST\\)\n\nAPI URL: &lt;host\\_name&gt;/api/sbom/core/upload\n\n**Note:** &lt;host\\_name&gt; is your ServiceNow instance name.\n\nRequest headers.\n\nThe Content-Type header is required when calling the Upload API. Set the Content-Type value to match the SBOM file content submitted in the request body. Supported values include:\n\n-   Content-Type: text/xml\n-   Content-Type: application/json\n-   Content-Type: application/xml\n\nIf the Content-Type header is missing, the API rejects the request with a `HTTP 400` error and returns the following code:\n\n```\n{\n  \"status\": \"failure\",\n  \"message\": \"Content-Type header is missing\"\n}\n```\n\nIf the Content-Type header is unsupported, the API rejects the request with an HTTP 400 error and returns the following code:\n\n```\n{\n  \"status\": \"error\",\n  \"message\": \"Unsupported Content-Type. BOM data must be in JSON or XML.\"\n}\n```\n\nAll the following request parameters are optional; the request body is the SBOM file content. If you're using DevOps as part of your development process, the value of 'requestedBy' should be 'devops'. See [Uploading Software Bill of Materials for DevOps SBOM files](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/security-management/sbom-core/vr-sbom-uploading-devops.md) for more general information about DevOps. If the value for 'requestedby' is \"devops\" \\(devlopment operations\\), these parameters are mandatory:\n\n-   buildId\n-   lifecycleStage\n\nIn addition, if 'requestedBy' is 'devops', data for fetchVulenrabilityInfo, and fetchPackageInfo is included.\n\n-   buildId- string you send\n-   lifecycleStage- two values, production or pre\\_production\n-   fetchVulenrabilityInfo- t/f\n-   fetchPackageInfo-t/f\n\n|Request parameters|Possible values|Description|\n|------------------|---------------|-----------|\n|productModelId|Sys id|Sys id of product model to map with the root application of given SBOM.|\n|businessApplicationId|Sys id|Sys id of business application to map with the root application of given SBOM.|\n|businessApplicationName \\(deprecated\\)|Your business application name|Name of business application to map with the root application of given SBOM.|\n|sbomSource|A product such as Veracode, for example|The source for your SBOM file.|\n|requestedBy|A tool, or name of a methodology, Jenkins. If you use \"devops\", buildId and lifecycleStage are mandatory.|Upload requested by|\n|buildId|A string requester sends.|Build ID of the SBOM build.|\n|lifecycleStage|production or pre\\_production|Life cycle stage of the entity.|\n|fetchVulenrabilityInfo|t/f|If true, triggers vulnerability intelligence integration.|\n|fetchPackage Info|t/f|If true, triggers package intelligence integration.|\n\nUpload API Response: included 'status' success/fail, 'message' \\(string\\), 'bomRecordId' \\(this is the sys id of the SBOM that is returned through the upload API for a successful SBOM upload\\).\n\n```\n{\n\n\"result\": {\n\n\"status\": \"success\",\n\n\"message\": \"Queued for processing.\",\n\n\"bomRecordId\": \"f207059b4393c290629aa597cbb8f247\"\n\n}\n\n}\n```\n\n## Status API\n\nThis API gets the status and summary of an SBOM that Is queued for ingestion.\n\n-   API URL: /api/sbom/core/upload/status\n-   HTTP method \\(GET\\)\n\n|Request parameters|Possible values|Description|\n|------------------|---------------|-----------|\n|bomRecordId|Sys id|SBOM record ID that is returned the through the upload API for a successful SBOM upload.|\n\nStatus API default response example.\n\n```\n\n{\n   \"result\": {\n      \"bomRecordId\": \"0407c0fea3e70a505df340f5251e617e\",\n      \"uploadStatus\": \"processed\",\n      \"additionalInfoStatus\": \"not_requested\",\n      \"uploadSummary\": {\n         \"components\": {\n            \"added\": 0,\n            \"removed\": 0,\n            \"total\": 70\n         }\n       }\n    } \n}\n```\n\nStatus API response with additional parameters example. If you requested fetchVulenrabilityInfo for that SBOM, you get the vulnerability breakdown as part of the response.\n\n```\n\n{\n \"result\": {\n\n  \"bomRecordId\": \"93af349b4393c290629aa597cbb8f258\",\n\n  \"uploadStatus\": \"processed\",\n\n  \"additionalInfoStatus\": \"complete\",\n\n  \"uploadSummary\": {\n\n    \"components\": {\n \n     \"added\": 0,\n\n     \"removed\": 0,\n\n     \"total\": 3\n\n   },\n\n   \"vulnerabilityInfo\": {\n\n    \"critical\": 0,\n\n    \"high\": 0,\n\n    \"medium\": 0,\n\n    \"low\": 0,\n\n    \"none\": 0\n\n   }\n\n  },\n\n  \"buildId\": \"1\"\n\n }\n\n}\n```\n\nIf you requested fetchPackageInfo for that SBOM, you get stale and abandoned counts as part of the response.\n\nAfter an SBOM is successfully processed, where you view the uploaded records depends on the applications you’re using.\n\n-   If you’re using SBOM Response, the BOM Entity record is displayed on the SBOM Ingestion Status list in the BOM Queue module in the SBOM Workspace.\n-   If you’re using SBOM Core, navigate to **SBOM Core** &gt; **BOM Ingestion Status**.\n\n## Enhancements to supported SBOM standards and general usage information\n\nVersion 4.0 of SBOM Core supports:\n\n-   XML and JSON in CycloneDx \\(versions 1.0 - 1.6\\).\n-   JSON in SPDX \\(versions 2.2-2.3\\)\n-   **Note:** Files over 32 MB might not load properly.\n\n\nStarting with v4.0 of SBOM Core, the following enhancements were made to support CycloneDx standards for versions 1.0 - 1.6:\n\n-   Import additional information in CycloneDX SBOM files with the \\(sn\\_sbom\\_core.collect\\_properties\\) property. This property is deactivated by default. Activate the property to import information that is generally not supported. Any information imported from these properties is uploaded to the SBOM Component Property \\[sn\\_sbom\\_comp\\_property\\] table for the following:\n    -   Uploaded SBOM files\n    -   Metadata\n    -   Individual vulnerabilities\n    -   Components\n-   View imported component data for declared and concluded licenses for SBOM files in versions 1.4 and later of CycloneDX in two new license fields:\n    -   **Declared**\n    -   **Concluded**\n-   SBOM parsing support is extended for the following CycloneDX component types:\n    -   Version 1.5: Platform, Data, Device driver, Machine Learning model\n    -   Version 1.6: Cryptographic\n\nVersion 3.0 of SBOM Core supports:\n\n-   XML and JSON in CycloneDx \\(up to and including version 1.4\\).\n-   JSON in SPDX \\(up to and including v2.3\\).\n\nIf the calling user is successfully authenticated and has the sn\\_sbom\\_core.sbom\\_ingest role in your ServiceNow instance, you can access the API from outside of your instance to upload the SBOM data.\n\nAfter data is uploaded, it is parsed. Before data is parsed, the following requirements are verified:\n\n-   Incoming data is checked that it is valid JSON or XML.\n-   The BOM format is supported. Starting with v2.1 of SBOM Core, CycloneDX \\(JSON and XML\\) and SPDX \\(XML\\) formats are supported.\n-   The minimum fields are available so that data can be parsed.\n\nAfter these checks are verified, an entry is made into the Bill of Materials \\[sn\\_sbom\\_doc\\] table with incoming SBOM data as an attachment.\n\nThe **Process BOM file** business rule is triggered automatically as a result of the record insertion and data parsing.\n\n**Note:** This business rule is activated during installation of SBOM Core by default.\n\nAll the components listed in an SBOM have a defined `type`.\n\n-   Components for which SBOM files were uploaded are considered BOM Entities.\n-   Components listed as `type=library` are considered third-party components.\n\n**Related topics**  \n\n\n[View upload status for Software Bill of Materials files](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/security-management/sbom-core/vr-sbom-bom-queue.md)\n\n[Viewing reports and dashboards in the Software Bill of Materials workspace](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/security-management/sbom-core/vr-sbom-viewing-data-overview.md)\n\n"}}