Webhook配置

更新
Cover image for: Webhook配置

API使用webhook配置资源将事件发送到您的webhook接收器。

组织可以具有默认webook配置,该配置由该组织内的所有未指定其自己的webhook配置的密钥使用。

属性

名称类型描述
id webhook config ID Resource identifier.
resource string, always webhook_config Resource type specifier.
organisation organisation ID The organisation the resource belongs to.
url string The url to target when sending events.
secret string The shared secret used to verify event signatures.
state string One of: new, valid, invalid, deactivated.
date_created datetime When the resource was created.

秘密

创建webhook配置后,将生成一个秘密,用于签署API发送的事件。强烈建议您使用此秘密实现webhook接收器以验证传入事件的签名。有关签名验证过程的更多详细信息,请参阅webhook配置文档

状态

  • new刚刚创建或最近更新,但尚未测试。
  • valid已通过验证并可以使用。组织必须至少具有一个处于此状态的webhook配置才能使用。
  • invalid验证测试失败。必须更新或重新测试。
  • deactivated已由所属组织关闭。

创建POST /configs/webhook

此操作将创建webhook_config.test任务以验证端点详细信息。如果尚未设置webhook接收器,则此测试可能会失败并将配置设置为invalid状态。但是,始终可以使用测试操作重新测试配置。

参数

name type description
url required The URL of your webhook receiver.

使用cURL

curl https://ricloud-api.reincubate.com/configs/webhook \
  -X POST \
  -H 'Authorization: Token <your key_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "url": "https://www.mywebhook.com/webhooks/"
}'

使用ricloud-py

import ricloud

webhook_config = ricloud.WebhookConfig.create(url='https://www.mywebhook.com/webhooks/')

检索GET /configs/webhook/{webhook_config ID}

使用cURL

curl https://ricloud-api.reincubate.com/configs/webhook/<webhook_config ID> \
  -H 'Authorization: Token <your key_token>'

使用ricloud-py

import ricloud

webhook_config = ricloud.WebhookConfig.retrieve(<webhook_config ID>)

列出GET /configs/webhook

处于deactivated状态的Webhook配置默认隐藏,只能通过显式过滤列出。

参数

name type description
state string Filter webhook configs by their state.
date_created datetime filter Filter by resource creation date.

更新POST /configs/webhook/{webhook_config ID}

此操作将在后台创建webhook_confg.test任务,以验证对配置所做的任何更改。

在您基本上停用配置的情况下,只能将state属性更改为deactivated

参数

name type description
url string Update the URL.
state string Only to new or deactivated.

使用cURL

curl https://ricloud-api.reincubate.com/configs/webhook/<webhook_config ID> \
  -X POST \
  -H 'Authorization: Token <your key_token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "url": "https://www.myupdatedwebhook.com/webhooks/",
}'

使用ricloud-py

import ricloud

webhook_config = ricloud.WebhookConfig.update_with_id(
  <webhook_config ID>,
  url='https://www.myupdatedwebhook.com/webhooks/'
)

# OR

webhook_config = ricloud.WebhookConfig.retrieve(<webhook_config ID>)

webhook_config.update(url='https://www.myupdatedwebhook.com/webhooks/')

测试POST /configs/webhook/{webhook_config ID}/test

此操作将创建webhook_config.test任务,该任务使用指定的配置发送测试事件。测试结果将相应地更新webook配置的state属性。

使用cURL

curl https://ricloud-api.reincubate.com/configs/webhook/<webhook_config ID>/test \
  -H 'Authorization: Token <your key_token>'

使用ricloud-py

import ricloud

test_task = ricloud.WebhookConfig.test_with_id(<webhook_config ID>)

# OR

webhook_config = ricloud.WebhookConfig.retrieve(<webhook_config ID>)

test_task = webhook_config.test()

我们能帮你什么吗?

我们的支持团队在这里提供帮助!

我们的办公时间是格林威治标准时间周一至周五上午9点至下午5点。 时间目前是 12:56 PM的 GMT。

我们力争在一个工作日内答复所有垂询。

我们的支持团队非常棒

我们可以改进这篇文章吗?

我们喜欢听取用户的意见:为什么不给我们发电子邮件,发表评论或发推文 @reincubate?

© 2008 - 2024 Reincubate Ltd. 保留所有权利。 在英格兰和威尔士注册 #5189175, VAT GB151788978. Reincubate®和Camo®是注册商标。 隐私政策 & 条款.