Skip to main content
REST API はバージョン化されました。 詳細については、「API のバージョン管理について」を参照してください。

ソフトウェア部品表 (SBOM) 用の REST API エンドポイント

REST API を使って、リポジトリのソフトウェア部品表 (SBOM) をエクスポートします。

少なくともリポジトリへの読み取りアクセス権がある場合は、GitHub UI または GitHub REST API を使って、リポジトリの依存関係グラフを SPDX 互換のソフトウェア部品表 (SBOM) としてエクスポートできます。 詳しくは、「リポジトリのソフトウェア部品表のエクスポート」をご覧ください。

この記事では、REST API エンドポイントの詳細について説明します。

メモ

GitHub Enterprise Server では、依存関係のライセンス情報は取得されず、あるリポジトリに依存する依存アイテム、リポジトリ、パッケージに関する情報は計算されません。 応答の中では、これらのフィールドは空欄です。

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

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

fine_grained_access

works_with_fine_grained_tokens:

permission_set:

  • "Contents" repository permissions (read)

allows_public_read_access

"Export a software bill of materials (SBOM) for a repository." のパラメーター

ヘッダー
名前, タイプ, 説明
accept string

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

パスパラメーター
名前, タイプ, 説明
owner string 必須

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

repo string 必須

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

http_status_code

status_code説明
200

OK

403

Forbidden

404

Resource not found

code_samples

request_example

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" \ http(s)://HOSTNAME/api/v3/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", "documentNamespace": "https://spdx.org/spdxdocs/protobom/15e41dd2-f961-4f4d-b8dc-f8f57ad70d57", "packages": [ { "SPDXID": "SPDXRef-Package", "name": "rubygems:rails", "versionInfo": "1.0.0", "downloadLocation": "NOASSERTION", "filesAnalyzed": false, "licenseConcluded": "NOASSERTION", "licenseDeclared": "NOASSERTION" } ], "relationships": [ { "relationshipType": "DEPENDS_ON", "spdxElementId": "SPDXRef-Repository", "relatedSpdxElement": "SPDXRef-Package" }, { "relationshipType": "DESCRIBES", "spdxElementId": "SPDXRef-DOCUMENT", "relatedSpdxElement": "SPDXRef-Repository" } ] } }