Skip to main content
Die REST-API verfügt jetzt über eine Versionskontrolle. Weitere Informationen findest du unter Informationen zur API-Versionsverwaltung.

REST-API-Endpunkte für Software-Stückliste (SBOM)

Verwende die REST-API, um die Software-Stückliste (SBOM) für ein Repository zu exportieren.

Wenn du mindestens Lesezugriff auf das Repository hast, kannst du das Abhängigkeitsdiagramm für das Repository als SPDX-kompatible Softwarestückliste (Bill of Materials, SBOM) über die GitHub-Benutzeroberfläche oder die GitHub-REST-API exportieren. Weitere Informationen findest du unter Exportieren einer Software-Stückliste (Software Bill of Materials, SBOM) für dein Repository.

Dieser Artikel enthält Details zum REST-API-Endpunkt.

Export a software bill of materials (SBOM) for a repository.

Exports the software bill of materials (SBOM) for a repository in SPDX JSON format.

Differenzierte Zugriffstoken für "Export a software bill of materials (SBOM) for a repository."

Dieser Endpunkt funktioniert mit den folgenden Tokentypen.:

Das Token muss einen der folgenden Berechtigungssätze aufweisen.:

  • contents:read

Dieser Endpunkt kann ohne Authentifizierung oder die zuvor erwähnten Berechtigungen verwendet werden, wenn nur öffentliche Ressourcen angefordert werden.

Parameter für „Export a software bill of materials (SBOM) for a repository.“

Header
Name, type, BESCHREIBUNG
accept string

Setting to application/vnd.github+json is recommended.

Pfadparameter
Name, type, BESCHREIBUNG
owner string Erforderlich

The account owner of the repository. The name is not case sensitive.

repo string Erforderlich

The name of the repository without the .git extension. The name is not case sensitive.

HTTP-Antwortstatuscodes für „Export a software bill of materials (SBOM) for a repository.“

StatuscodeBESCHREIBUNG
200

OK

403

Forbidden

404

Resource not found

Codebeispiele für „Export a software bill of materials (SBOM) for a repository.“

Beispiel für eine Anfrage

get/repos/{owner}/{repo}/dependency-graph/sbom
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/OWNER/REPO/dependency-graph/sbom

Response

Status: 200
{ "sbom": { "SPDXID": "SPDXRef-DOCUMENT", "spdxVersion": "SPDX-2.3", "creationInfo": { "created": "2021-09-01T00:00:00Z", "creators": [ "Tool: GitHub.com-Dependency-Graph" ] }, "name": "github/example", "dataLicense": "CC0-1.0", "documentDescribes": [ "github/example" ], "documentNamespace": "https://github.com/github/example/dependency_graph/sbom-abcdef123456", "packages": [ { "SPDXID": "SPDXRef-Package", "name": "rubygems:rails", "versionInfo": "1.0.0", "downloadLocation": "NOASSERTION", "filesAnalyzed": false, "licenseConcluded": "MIT", "licenseDeclared": "MIT" } ] } }