Dependencies API

原文:https://docs.gitlab.com/ee/api/dependencies.html

Dependencies API

警告:此 API 处于 alpha 阶段,被认为是不稳定的. 响应有效载荷可能会在 GitLab 版本之间发生更改或损坏.

对此端点的每次调用都需要身份验证. 要执行此调用,应授权用户读取存储库. 要查看响应中的漏洞,应授权用户阅读Project Security Dashboard .

List project dependencies

获取项目依赖项列表. 该 API 部分镜像了依赖项列表功能. 只能为 Gemnasium 支持的语言和程序包管理器生成此列表.

  1. GET /projects/:id/dependencies
  2. GET /projects/:id/dependencies?package_manager=maven
  3. GET /projects/:id/dependencies?package_manager=yarn,bundler
Attribute Type Required Description
id integer/string yes 项目的 ID 或URL 编码的路径 .
package_manager 字符串数组 no 返回属于指定程序包管理器的依赖项. 有效值: bundlercomposermavennpmpipyarn .
  1. curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/4/dependencies"

响应示例:

  1. [ { "name": "rails", "version": "5.0.1", "package_manager": "bundler", "dependency_file_path": "Gemfile.lock", "vulnerabilities": [{ "name": "DDoS", "severity": "unknown" }] }, { "name": "hanami", "version": "1.3.1", "package_manager": "bundler", "dependency_file_path": "Gemfile.lock", "vulnerabilities": [] } ]