系统钩子API

所有方法都需要管理员授权。

系统钩子的URL端点也可以使用下面的admin区域中的UI进行配置钩子/管理/钩子)。

阅读更多关于系统钩子

列出系统钩子

获取所有系统钩子的列表。


GET /钩子

示例请求:

旋度——头“PRIVATE-TOKEN: 9 koxpg98eahejpvbs5tk”https://gitlab.example.com/api/v4/hooks

示例响应:

{“id”1“url”“https://gitlab.example.com/hook”“created_at”“2016 - 10 - 31 t12:32:15.192z”“push_events”真正的“tag_push_events”“merge_requests_events”真正的“enable_ssl_verification”真正的}

添加新的系统挂钩

添加一个新的系统挂钩。


邮报和钩子
属性 类型 要求 描述
url 字符串 是的 钩子URL
令牌 字符串 没有 用于验证接收的有效载荷的秘密令牌;这将不会在响应中返回
push_events 布尔 没有 当为true时,钩子将在推送事件时触发
tag_push_events 布尔 没有 当为true时,钩子将在新标签被推送时触发
merge_requests_events 布尔 没有 在合并请求事件上触发挂钩
enable_ssl_verification 布尔 没有 触发钩子时是否进行SSL验证

示例请求:

旋度——请求帖子——头“PRIVATE-TOKEN: 9 koxpg98eahejpvbs5tk”“https://gitlab.example.com/api/v4/hooks?url=https: / / gitlab.example.com/hook”

示例响应:

{“id”1“url”“https://gitlab.example.com/hook”“created_at”“2016 - 10 - 31 t12:32:15.192z”“push_events”真正的“tag_push_events”“merge_requests_events”真正的“enable_ssl_verification”真正的}

测试系统挂钩

得到/钩子:id
属性 类型 要求 描述
id 整数 是的 钩子的ID

示例请求:

旋度——头“PRIVATE-TOKEN: 9 koxpg98eahejpvbs5tk”https://gitlab.example.com/api/v4/hooks/2

示例响应:

{“project_id”1“owner_email”“example@gitlabhq.com”“owner_name”“一个人”“名称”“Ruby”“路径”“ruby”“event_name”“project_create”}

删除系统挂钩

删除系统钩子。


删除/钩子:id
属性 类型 要求 描述
id 整数 是的 钩子的ID

示例请求:

旋度——请求删除——头“PRIVATE-TOKEN: 9 koxpg98eahejpvbs5tk”https://gitlab.example.com/api/v4/hooks/2
Baidu
map