# 适用于依赖项评审的 REST API 终结点

使用 REST API 与依赖项更改交互。

## 关于依赖项评审

在将依赖项更改添加到环境之前，可使用 REST API 查看这些更改以及它们的安全影响。 可以查看存储库的两次提交之间的依赖项差异，包括具有已知漏洞的任何版本更新的漏洞数据。 有关依赖项评审的详细信息，请参阅“[依赖项审查](/zh/enterprise-server@3.22/code-security/concepts/supply-chain-security/dependency-review)”。

> \[!NOTE]
> Most endpoints use `Authorization: Bearer <YOUR-TOKEN>` and `Accept: application/vnd.github+json` headers, plus `X-GitHub-Api-Version: 2026-03-10`. Curl examples below omit these standard headers for brevity.

## Get a diff of the dependencies between commits

```
GET /repos/{owner}/{repo}/dependency-graph/compare/{basehead}
```

Gets the diff of the dependency changes between two commits of a repository, based on the changes to the dependency manifests made in those commits.

### Parameters

#### Headers

* **`accept`** (string)
  Setting to `application/vnd.github+json` is recommended.

#### Path and query parameters

* **`owner`** (string) (required)
  The account owner of the repository. The name is not case sensitive.

* **`repo`** (string) (required)
  The name of the repository without the .git extension. The name is not case sensitive.

* **`basehead`** (string) (required)
  The base and head Git revisions to compare. The Git revisions will be resolved to commit SHAs. Named revisions will be resolved to their corresponding HEAD commits, and an appropriate merge base will be determined. This parameter expects the format {base}...{head}.

* **`name`** (string)
  The full path, relative to the repository root, of the dependency manifest file.

### HTTP response status codes

* **200** - OK

* **400** - Bad Request

* **403** - Response for a private repository when GitHub Advanced Security is not enabled, or if used against a fork

* **404** - Resource not found

* **500** - Internal Error

* **503** - Service unavailable

### Code examples

#### Example

**Request:**

```curl
curl -L \
  -X GET \
  http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/dependency-graph/compare/BASEHEAD
```

**Response schema (Status: 200):**

Array of objects:

* `change_type`: required, string, enum: `added`, `removed`
* `manifest`: required, string
* `ecosystem`: required, string
* `name`: required, string
* `version`: required, string
* `package_url`: required, string or null
* `license`: required, string or null
* `source_repository_url`: required, string or null
* `vulnerabilities`: required, array of objects:
  * `severity`: required, string
  * `advisory_ghsa_id`: required, string
  * `advisory_summary`: required, string
  * `advisory_url`: required, string
* `scope`: required, string, enum: `unknown`, `runtime`, `development`