{{< details >}}

  • Tier: 专业版, 旗舰版
  • Offering: JihuLab.com, 私有化部署

{{< /details >}}

通过使用 REST API 与群组 webhooks 交互。也称为群组 hooks。 这些与系统范围内的 系统 hooks 和仅限于一个项目的 项目 webhooks 不同。

前提条件:

  • 您必须是管理员或拥有该群组的所有者角色。

列出群组 hooks

获取群组 hooks 列表。

GET /groups/:id/hooks

支持的属性:

属性 类型 必需 描述
id integer/string yes 群组的 ID 或 URL 编码路径

示例请求:

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/3/hooks"

示例响应:

[
  {
    "id": 1,
    "url": "http://example.com/hook",
    "name": "Test group hook",
    "description": "This is a test group hook.",
    "created_at": "2024-09-01T09:10:54.854Z",
    "push_events": true,
    "tag_push_events": false,
    "merge_requests_events": false,
    "repository_update_events": false,
    "enable_ssl_verification": true,
    "alert_status": "executable",
    "disabled_until": null,
    "url_variables": [],
    "push_events_branch_filter": null,
    "branch_filter_strategy": "all_branches",
    "group_id": 99,
    "issues_events": false,
    "confidential_issues_events": false,
    "note_events": false,
    "confidential_note_events": false,
    "pipeline_events": false,
    "wiki_page_events": false,
    "job_events": false,
    "deployment_events": false,
    "feature_flag_events": false,
    "releases_events": false,
    "subgroup_events": false,
    "emoji_events": false,
    "resource_access_token_events": false,
    "member_events": false,
    "custom_webhook_template": "{\"event\":\"{{object_kind}}\"}",
    "custom_headers": [
      {
        "key": "Authorization"
      }
    ]
  }
]

获取一个群组 hook

获取群组的特定 hook。

GET /groups/:id/hooks/:hook_id

支持的属性:

属性 类型 必需 描述
id integer/string yes 群组的 ID 或 URL 编码路径
hook_id integer yes 群组 hook 的 ID。

示例请求:

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/3/hooks/1"

示例响应:

{
  "id": 1,
  "url": "http://example.com/hook",
  "name": "Hook name",
  "description": "Hook description",
  "group_id": 3,
  "push_events": true,
  "push_events_branch_filter": "",
  "branch_filter_strategy": "wildcard",
  "issues_events": true,
  "confidential_issues_events": true,
  "merge_requests_events": true,
  "tag_push_events": true,
  "note_events": true,
  "confidential_note_events": true,
  "job_events": true,
  "pipeline_events": true,
  "wiki_page_events": true,
  "deployment_events": true,
  "feature_flag_events": false,
  "releases_events": true,
  "subgroup_events": true,
  "member_events": true,
  "enable_ssl_verification": true,
  "repository_update_events": false,
  "alert_status": "executable",
  "disabled_until": null,
  "url_variables": [ ],
  "created_at": "2012-10-12T17:04:47Z",
  "resource_access_token_events": true,
  "custom_webhook_template": "{\"event\":\"{{object_kind}}\"}",
  "custom_headers": [
    {
      "key": "Authorization"
    }
  ]
}

获取群组 hook 事件

{{< history >}}

  • 引入于极狐GitLab 17.3。

{{< /history >}}

获取特定群组 hook 在过去七天中的事件列表。

GET /groups/:id/hooks/:hook_id/events

支持的属性:

属性 类型 必需 描述
id integer/string yes 群组的 ID 或 URL 编码路径
hook_id integer Yes 项目 hook 的 ID。
status integer or string No 事件的响应状态码,例如:200500。您可以按状态类别搜索:successful(200-299)、client_failure(400-499)和 server_failure(500-599)。
page integer No 要检索的页面。默认为 1
per_page integer No 每页返回的记录数。默认为 20

示例请求:

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/3/hooks/1/events"

示例响应:

[
  {
    "id": 1,
    "url": "https://example.net/",
    "trigger": "push_hooks",
    "request_headers": {
      "Content-Type": "application/json",
      "User-Agent": "GitLab/17.1.0-pre",
      "Idempotency-Key": "a5461c4d-9c7f-4af9-add6-cddebe3c426f",
      "X-Gitlab-Event": "Push Hook",
      "X-Gitlab-Webhook-UUID": "3c5c0404-c866-44bc-a5f6-452bb1bfc76e",
      "X-Gitlab-Instance": "https://gitlab.example.com",
      "X-Gitlab-Event-UUID": "9cebe914-4827-408f-b014-cfa23a47a35f",
      "X-Gitlab-Token": "[REDACTED]"
    },
    "request_data": {
      "object_kind": "push",
      "event_name": "push",
      "after": "f15b32277d2c55c6c595845a87109b09c913c556",
      "ref": "refs/heads/master",
      "ref_protected": true,
      "checkout_sha": "f15b32277d2c55c6c595845a87109b09c913c556",
      "message": null,
      "user_id": 1,
      "user_name": "Administrator",
      "user_username": "root",
      "user_email": null,
      "user_avatar": "https://www.gravatar.com/avatar/13efe0d4559475ba84ecc802061febbdea6e224fcbffd7ec7da9cd431845299c?s=80&d=identicon",
      "project_id": 7,
      "project": {
        "id": 7,
        "name": "Flight",
        "description": "Incidunt ea ab officia a veniam.",
        "web_url": "https://gitlab.example.com/flightjs/Flight",
        "avatar_url": null,
        "git_ssh_url": "ssh://git@gitlab.example.com:2222/flightjs/Flight.git",
        "git_http_url": "https://gitlab.example.com/flightjs/Flight.git",
        "namespace": "Flightjs",
        "visibility_level": 10,
        "path_with_namespace": "flightjs/Flight",
        "default_branch": "master",
        "ci_config_path": null,
        "homepage": "https://gitlab.example.com/flightjs/Flight",
        "url": "ssh://git@gitlab.example.com:2222/flightjs/Flight.git",
        "ssh_url": "ssh://git@gitlab.example.com:2222/flightjs/Flight.git",
        "http_url": "https://gitlab.example.com/flightjs/Flight.git"
      },
      "commits": [
        {
          "id": "f15b32277d2c55c6c595845a87109b09c913c556",
          "message": "v1.5.2\n",
          "title": "v1.5.2",
          "timestamp": "2017-06-19T14:39:53-07:00",
          "url": "https://gitlab.example.com/flightjs/Flight/-/commit/f15b32277d2c55c6c595845a87109b09c913c556",
          "author": {
            "name": "Andrew Lunny",
            "email": "[REDACTED]"
          },
          "added": [],
          "modified": [
            "package.json"
          ],
          "removed": []
        },
        {
          "id": "8749d49930866a4871fa086adbd7d2057fcc3ebb",
          "message": "Merge pull request #378 from flightjs/alunny/publish_lib\n\npublish lib and index to npm",
          "title": "Merge pull request #378 from flightjs/alunny/publish_lib",
          "timestamp": "2017-06-16T10:26:39-07:00",
          "url": "https://gitlab.example.com/flightjs/Flight/-/commit/8749d49930866a4871fa086adbd7d2057fcc3ebb",
          "author": {
            "name": "angus croll",
            "email": "[REDACTED]"
          },
          "added": [],
          "modified": [
            "package.json"
          ],
          "removed": []
        },
        {
          "id": "468abc807a2b2572f43e72c743b76cee6db24025",
          "message": "publish lib and index to npm\n",
          "title": "publish lib and index to npm",
          "timestamp": "2017-06-16T10:23:04-07:00",
          "url": "https://gitlab.example.com/flightjs/Flight/-/commit/468abc807a2b2572f43e72c743b76cee6db24025",
          "author": {
            "name": "Andrew Lunny",
            "email": "[REDACTED]"
          },
          "added": [],
          "modified": [
            "package.json"
          ],
          "removed": []
        }
      ],
      "total_commits_count": 3,
      "push_options": {},
      "repository": {
        "name": "Flight",
        "url": "ssh://git@gitlab.example.com:2222/flightjs/Flight.git",
        "description": "Incidunt ea ab officia a veniam.",
        "homepage": "https://gitlab.example.com/flightjs/Flight",
        "git_http_url": "https://gitlab.example.com/flightjs/Flight.git",
        "git_ssh_url": "ssh://git@gitlab.example.com:2222/flightjs/Flight.git",
        "visibility_level": 10
      }
    },
    "response_headers": {
      "Date": "Sun, 26 May 2024 03:03:17 GMT",
      "Content-Type": "application/json; charset=utf-8",
      "Content-Length": "16",
      "Connection": "close",
      "X-Powered-By": "Express",
      "Access-Control-Allow-Origin": "*",
      "X-Pd-Status": "sent to primary"
    },
    "response_body": "{\"success\":true}",
    "execution_duration": 1.0906479999999874,
    "response_status": "200"
  },
  {
    "id": 2,
    "url": "https://example.net/",
    "trigger": "push_hooks",
    "request_headers": {
      "Content-Type": "application/json",
      "User-Agent": "GitLab/17.1.0-pre",
      "Idempotency-Key": "1f0a54f0-0529-408d-a5b8-a2a98ff5f94a",
      "X-Gitlab-Event": "Push Hook",
      "X-Gitlab-Webhook-UUID": "a753eedb-1d72-4549-9ca7-eac8ea8e50dd",
      "X-Gitlab-Instance": "https://gitlab.example.com:3000",
      "X-Gitlab-Event-UUID": "842d7c3e-3114-4396-8a95-66c084d53cb1",
      "X-Gitlab-Token": "[REDACTED]"
    },
    "request_data": {
      "object_kind": "push",
      "event_name": "push",
      "before": "468abc807a2b2572f43e72c743b76cee6db24025",
      "after": "f15b32277d2c55c6c595845a87109b09c913c556",
      "ref": "refs/heads/master",
      "ref_protected": true,
      "checkout_sha": "f15b32277d2c55c6c595845a87109b09c913c556",
      "message": null,
      "user_id": 1,
      "user_name": "Administrator",
      "user_username": "root",
      "user_email": null,
      "user_avatar": "https://www.gravatar.com/avatar/13efe0d4559475ba84ecc802061febbdea6e224fcbffd7ec7da9cd431845299c?s=80&d=identicon",
      "project_id": 7,
      "project": {
        "id": 7,
        "name": "Flight",
        "description": "Incidunt ea ab officia a veniam.",
        "web_url": "https://gitlab.example.com/flightjs/Flight",
        "avatar_url": null,
        "git_ssh_url": "ssh://git@gitlab.example.com:2222/flightjs/Flight.git",
        "git_http_url": "https://gitlab.example.com/flightjs/Flight.git",
        "namespace": "Flightjs",
        "visibility_level": 10,
        "path_with_namespace": "flightjs/Flight",
        "default_branch": "master",
        "ci_config_path": null,
        "homepage": "https://gitlab.example.com/flightjs/Flight",
        "url": "ssh://git@gitlab.example.com:2222/flightjs/Flight.git",
        "ssh_url": "ssh://git@gitlab.example.com:2222/flightjs/Flight.git",
        "http_url": "https://gitlab.example.com/flightjs/Flight.git"
      },
      "commits": [
        {
          "id": "f15b32277d2c55c6c595845a87109b09c913c556",
          "message": "v1.5.2\n",
          "title": "v1.5.2",
          "timestamp": "2017-06-19T14:39:53-07:00",
          "url": "https://gitlab.example.com/flightjs/Flight/-/commit/f15b32277d2c55c6c595845a87109b09c913c556",
          "author": {
            "name": "Andrew Lunny",
            "email": "[REDACTED]"
          },
          "added": [],
          "modified": [
            "package.json"
          ],
          "removed": []
        },
        {
          "id": "8749d49930866a4871fa086adbd7d2057fcc3ebb",
          "message": "Merge pull request #378 from flightjs/alunny/publish_lib\n\npublish lib and index to npm",
          "title": "Merge pull request #378 from flightjs/alunny/publish_lib",
          "timestamp": "2017-06-16T10:26:39-07:00",
          "url": "https://gitlab.example.com/flightjs/Flight/-/commit/8749d49930866a4871fa086adbd7d2057fcc3ebb",
          "author": {
            "name": "angus croll",
            "email": "[REDACTED]"
          },
          "added": [],
          "modified": [
            "package.json"
          ],
          "removed": []
        },
        {
          "id": "468abc807a2b2572f43e72c743b76cee6db24025",
          "message": "publish lib and index to npm\n",
          "title": "publish lib and index to npm",
          "timestamp": "2017-06-16T10:23:04-07:00",
          "url": "https://gitlab.example.com/flightjs/Flight/-/commit/468abc807a2b2572f43e72c743b76cee6db24025",
          "author": {
            "name": "Andrew Lunny",
            "email": "[REDACTED]"
          },
          "added": [],
          "modified": [
            "package.json"
          ],
          "removed": []
        }
      ],
      "total_commits_count": 3,
      "push_options": {},
      "repository": {
        "name": "Flight",
        "url": "ssh://git@gitlab.example.com:2222/flightjs/Flight.git",
        "description": "Incidunt ea ab officia a veniam.",
        "homepage": "https://gitlab.example.com/flightjs/Flight",
        "git_http_url": "https://gitlab.example.com/flightjs/Flight.git",
        "git_ssh_url": "ssh://git@gitlab.example.com:2222/flightjs/Flight.git",
        "visibility_level": 10
      }
    },
    "response_headers": {
      "Date": "Sun, 26 May 2024 03:03:19 GMT",
      "Content-Type": "application/json; charset=utf-8",
      "Content-Length": "16",
      "Connection": "close",
      "X-Powered-By": "Express",
      "Access-Control-Allow-Origin": "*",
      "X-Pd-Status": "sent to primary"
    },
    "response_body": "{\"success\":true}",
    "execution_duration": 1.0716120000000728,
    "response_status": "200"
  }
]

重新发送群组 hook 事件

{{< history >}}

  • 引入于极狐GitLab 17.4。

{{< /history >}}

重新发送特定 hook 事件。

此端点对于每个 hook 和经过身份验证的用户的速率限制为每分钟五个请求。要在极狐GitLab 私有化部署和极狐GitLab Dedicated 上禁用此限制,管理员可以禁用名为 web_hook_event_resend_api_endpoint_rate_limit 的功能标志。

POST /groups/:id/hooks/:hook_id/events/:hook_event_id/resend

支持的属性:

属性 类型 必需 描述
id integer/string yes 群组的 ID 或 URL 编码路径
hook_id integer Yes 群组 hook 的 ID。
hook_event_id integer Yes hook 事件的 ID。

示例请求:

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/3/hooks/1/events/1/resend"

示例响应:

{
  "response_status": 200
}

添加一个群组 hook

向指定群组添加 hook。

POST /groups/:id/hooks

支持的属性:

属性 类型 必需 描述
id integer/string yes 群组的 ID 或 URL 编码路径
url string yes hook 的 URL。
name string no hook 的名称(在极狐GitLab 17.1 中引入)。
description string no hook 的描述(在极狐GitLab 17.1 中引入)。
push_events boolean no 在推送事件时触发 hook。
push_events_branch_filter string no 仅对匹配分支的推送事件触发 hook。
branch_filter_strategy string no 通过分支过滤推送事件。可能的值为 wildcard(默认)、regexall_branches
issues_events boolean no 在议题事件时触发 hook。
confidential_issues_events boolean no 在机密议题事件时触发 hook。
merge_requests_events boolean no 在合并请求事件时触发 hook。
tag_push_events boolean no 在标签推送事件时触发 hook。
note_events boolean no 在注释事件时触发 hook。
confidential_note_events boolean no 在机密注释事件时触发 hook。
job_events boolean no 在作业事件时触发 hook。
pipeline_events boolean no 在流水线事件时触发 hook。
wiki_page_events boolean no 在 wiki 页面事件时触发 hook。
deployment_events boolean no 在部署事件时触发 hook。
feature_flag_events boolean no 在功能标志事件时触发 hook。
releases_events boolean no 在发布事件时触发 hook。
subgroup_events boolean no 在子群组事件时触发 hook。
member_events boolean no 在成员事件时触发 hook。
enable_ssl_verification boolean no 在触发 hook 时进行 SSL 验证。
token string no 用于验证接收到的有效负载的密钥;不会在响应中返回。
resource_access_token_events boolean no 在项目访问令牌到期事件时触发 hook。
custom_webhook_template string no hook 的自定义 webhook 模板。
custom_headers array No hook 的自定义头。

示例请求:

curl --request POST \
  --header "content-type: application/json" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/3/hooks" \
  --data '{"url": "https://example.com/hook", "name": "My Hook", "description": "Hook description"}'

示例响应:

{
  "id": 42,
  "url": "https://example.com/hook",
  "name": "My Hook",
  "description": "Hook description",
  "group_id": 3,
  "push_events": true,
  "push_events_branch_filter": "",
  "branch_filter_strategy": "wildcard",
  "issues_events": true,
  "confidential_issues_events": true,
  "merge_requests_events": true,
  "tag_push_events": true,
  "note_events": true,
  "confidential_note_events": true,
  "job_events": true,
  "pipeline_events": true,
  "wiki_page_events": true,
  "deployment_events": true,
  "feature_flag_events": true,
  "releases_events": true,
  "subgroup_events": true,
  "member_events": true,
  "enable_ssl_verification": true,
  "repository_update_events": false,
  "alert_status": "executable",
  "disabled_until": null,
  "url_variables": [ ],
  "created_at": "2012-10-12T17:04:47Z",
  "resource_access_token_events": true,
  "custom_webhook_template": "{\"event\":\"{{object_kind}}\"}",
}

编辑群组 hook

编辑指定群组的 hook。

PUT /groups/:id/hooks/:hook_id

支持的属性:

属性 类型 必需 描述
id integer or string yes 群组的 ID 或 URL 编码路径
hook_id integer yes 群组 hook 的 ID。
url string yes hook 的 URL。
name string no hook 的名称(在极狐GitLab 17.1 中引入)。
description string no hook 的描述(在极狐GitLab 17.1 中引入)。
push_events boolean no 在推送事件时触发 hook。
push_events_branch_filter string no 仅对匹配分支的推送事件触发 hook。
branch_filter_strategy string no 通过分支过滤推送事件。可能的值为 wildcard(默认)、regexall_branches
issues_events boolean no 在议题事件时触发 hook。
confidential_issues_events boolean no 在机密议题事件时触发 hook。
merge_requests_events boolean no 在合并请求事件时触发 hook。
tag_push_events boolean no 在标签推送事件时触发 hook。
note_events boolean no 在注释事件时触发 hook。
confidential_note_events boolean no 在机密注释事件时触发 hook。
job_events boolean no 在作业事件时触发 hook。
pipeline_events boolean no 在流水线事件时触发 hook。
wiki_page_events boolean no 在 wiki 页面事件时触发 hook。
deployment_events boolean no 在部署事件时触发 hook。
feature_flag_events boolean no 在功能标志事件时触发 hook。
releases_events boolean no 在发布事件时触发 hook。
subgroup_events boolean no 在子群组事件时触发 hook。
member_events boolean no 在成员事件时触发 hook。
enable_ssl_verification boolean no 在触发 hook 时进行 SSL 验证。
service_access_tokens_expiration_enforced boolean no 需要服务帐户访问令牌具有过期日期。
token string no 用于验证接收到的有效负载的密钥。不会在响应中返回。当您更改 webhook URL 时,密钥会被重置且不会保留。
resource_access_token_events boolean no 在项目访问令牌到期事件时触发 hook。
custom_webhook_template string no hook 的自定义 webhook 模板。
custom_headers array no hook 的自定义头。

示例请求:

curl --request POST \
  --header "content-type: application/json" \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/groups/3/hooks/1" \
  --data '{"url": "https://example.com/hook", "name": "New hook name", "description": "Changed hook description"}'

示例响应:

{
  "id": 1,
  "url": "https://example.com/hook",
  "name": "New hook name",
  "description": "Changed hook description",
  "group_id": 3,
  "push_events": true,
  "push_events_branch_filter": "",
  "branch_filter_strategy": "wildcard",
  "issues_events": true,
  "confidential_issues_events": true,
  "merge_requests_events": true,
  "tag_push_events": true,
  "note_events": true,
  "confidential_note_events": true,
  "job_events": true,
  "pipeline_events": true,
  "wiki_page_events": true,
  "deployment_events": true,
  "feature_flag_events": true,
  "releases_events": true,
  "subgroup_events": true,
  "member_events": true,
  "enable_ssl_verification": true,
  "repository_update_events": false,
  "alert_status": "executable",
  "disabled_until": null,
  "url_variables": [ ],
  "created_at": "2012-10-12T17:04:47Z",
  "resource_access_token_events": true,
  "custom_webhook_template": "{\"event\":\"{{object_kind}}\"}",
  "custom_headers": [
    {
      "key": "Authorization"
    }
  ]
}

删除一个群组 hook

从群组中删除 hook。这是一个幂等方法,可以多次调用。无论 hook 是否可用。

DELETE /groups/:id/hooks/:hook_id

支持的属性:

属性 类型 必需 描述
id integer/string yes 群组的 ID 或 URL 编码路径
hook_id integer yes 群组 hook 的 ID。

示例请求:

curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/3/hooks/1"

成功时不返回信息。

触发一个测试群组 hook

{{< history >}}

  • 引入于极狐GitLab 17.1。
  • 特殊的速率限制引入于极狐GitLab 17.1,使用名为 web_hook_test_api_endpoint_rate_limit功能标志。默认启用。

{{< /history >}}

为指定群组触发测试 hook。

此端点对于每个群组和经过身份验证的用户的速率限制为每分钟五个请求。要在极狐GitLab 私有化部署和极狐GitLab Dedicated 上禁用此限制,管理员可以禁用名为 web_hook_test_api_endpoint_rate_limit 的功能标志。

POST /groups/:id/hooks/:hook_id/test/:trigger
属性 类型 必需 描述
hook_id integer Yes 群组 hook 的 ID。
id integer or string Yes 群组的 ID 或 URL 编码路径
trigger string Yes push_eventstag_push_eventsissues_eventsconfidential_issues_eventsnote_eventsmerge_requests_eventsjob_eventspipeline_eventswiki_page_eventsreleases_eventsemoji_eventsresource_access_token_events 中的一个。

示例请求:

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/3/hooks/1/test/push_events"

示例响应:

{"message":"201 Created"}

设置自定义头

{{< history >}}

  • 引入于极狐GitLab 17.1。

{{< /history >}}

设置自定义头。

PUT /groups/:id/hooks/:hook_id/custom_headers/:key

支持的属性:

属性 类型 必需 描述
id integer or string Yes 群组的 ID 或 URL 编码路径
hook_id integer Yes 群组 hook 的 ID。
key string Yes 自定义头的键。
value string Yes 自定义头的值。

示例请求:

curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/3/hooks/1/custom_headers/header_key?value='header_value'"

成功时不返回信息。

删除自定义头

{{< history >}}

  • 引入于极狐GitLab 17.1。

{{< /history >}}

删除自定义头。

DELETE /groups/:id/hooks/:hook_id/custom_headers/:key

支持的属性:

属性 类型 必需 描述
id integer or string Yes 群组的 ID 或 URL 编码路径
hook_id integer Yes 群组 hook 的 ID。
key string Yes 自定义头的键。

示例请求:

curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/3/hooks/1/custom_headers/header_key"

成功时不返回信息。

设置 URL 变量

{{< history >}}

  • 引入于极狐GitLab 15.2.

{{< /history >}}

PUT /groups/:id/hooks/:hook_id/url_variables/:key

支持的属性:

属性 类型 必需 描述
id integer or string Yes 群组的 ID 或 URL 编码路径
hook_id integer Yes 群组 hook 的 ID。
key string Yes URL 变量的键。
value string Yes URL 变量的值。

示例请求:

curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/3/hooks/1/url_variables/my_key?value='my_key_value'"

成功时不返回信息。

删除 URL 变量

{{< history >}}

  • 引入于极狐GitLab 15.2。

{{< /history >}}

DELETE /groups/:id/hooks/:hook_id/url_variables/:key

支持的属性:

属性 类型 必需 描述
id integer or string Yes 群组的 ID 或 URL 编码路径
hook_id integer Yes 群组 hook 的 ID。
key string Yes URL 变量的键。

示例请求:

curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/3/hooks/1/url_variables/my_key"

成功时不返回信息。