Managed Licenses API

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

Managed Licenses API

List managed licenses

获取给定项目的所有托管许可证.

  1. GET /projects/:id/managed_licenses
Attribute Type Required Description
id integer/string yes 项目的 ID 或URL 编码的路径
  1. curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/managed_licenses"

响应示例:

  1. [ { "id": 1, "name": "MIT", "approval_status": "approved" }, { "id": 3, "name": "ISC", "approval_status": "blacklisted" } ]

Show an existing managed license

显示现有的托管许可证.

  1. GET /projects/:id/managed_licenses/:managed_license_id
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
managed_license_id integer/string yes 属于项目的许可证的 ID 或 URL 编码名称
  1. curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/managed_licenses/6"

响应示例:

  1. { "id": 1, "name": "MIT", "approval_status": "blacklisted" }

Create a new managed license

使用给定的名称和批准状态为给定的项目创建一个新的托管许可证.

  1. POST /projects/:id/managed_licenses
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
name string yes 托管许可证的名称
approval_status string yes 批准状态. “批准”或”列入黑名单”
  1. curl --data "name=MIT&approval_status=blacklisted" --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/managed_licenses"

响应示例:

  1. { "id": 1, "name": "MIT", "approval_status": "approved" }

Delete a managed license

删除具有给定 ID 的托管许可证.

  1. DELETE /projects/:id/managed_licenses/:managed_license_id
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
managed_license_id integer/string yes 属于项目的许可证的 ID 或 URL 编码名称
  1. curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/managed_licenses/4"

成功后,它将以 HTTP 204 响应进行回复.

Edit an existing managed license

使用新的批准状态更新现有的托管许可证.

  1. PATCH /projects/:id/managed_licenses/:managed_license_id
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
managed_license_id integer/string yes 属于项目的许可证的 ID 或 URL 编码名称
approval_status string yes 批准状态. “批准”或”列入黑名单”
  1. curl --request PATCH --data "approval_status=blacklisted" --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/managed_licenses/6"

响应示例:

  1. { "id": 1, "name": "MIT", "approval_status": "blacklisted" }