SelSup Developers

公共的 API · 参考 API

网络

网络连接器的终点,包括精确的路线,参数,请求机体和可扩展的响应方案.

3 终点/api/webhook稳定机器可读的描述 ↗
{ }

通过可编辑的独立合同来支持本页面. 在生产使用之前,验证使用测试数据的写作操作.

/api/webhook

准备使用的工作流程

准备使用的工作流程

01

开始使用Webhooks

使用专用API代币,首先验证测试数据的读取操作.

  1. 保存代币服务器侧,然后将其发送到Authorization标题中.
  2. 检查所需参数,并扩大请求或响应方案.
  3. 在应用错误中处理HTTP状态和稳定的error字段.

数据模型

数据结构

模型在此列出一次,并且可以直接从使用它们的终端点扩展.

Webhook6 字段
idinteger · int32

Id.

namestring

姓名.

urlstring

查看一个URL.

typesstring[]

类型.

clientIdinteger · int64

客户身份证.

organizationIdinteger · int64

组织身份证.

错误合同

如何返回应用错误

编程的代码在每个地方都相同,而用户面向的消息由服务器翻译. 建立在error周围的应用逻辑,仅用于显示.

鱼类

稳定机器可读的代码用于集成逻辑.

鱼类

在API代币用户语言中显示准备的消息.

鱼类

服务器在本地化消息模板中插入的值.

localMessage使用了 API代币的用户的lang字段.文档语言和 Accept-Language标题不会改变它;当用户没有语言配置时,使用俄语.

RU用户位置是 ru
{
  "error": "error_brand_already_exists",
  "localMessage": "Бренд Base уже существует",
  "params": {
    "name": "Base"
  }
}
CN中文 (cn)
{
  "error": "error_brand_already_exists",
  "localMessage": "品牌 Base 已经存在",
  "params": {
    "name": "Base"
  }
}

终点

终点

GET

列表

/api/webhook/
读取访问的标志

使用 GET /api/webhook/.的列表

curl --request GET 'https://api.selsup.ru/api/webhook/' \
  --header 'Authorization: YOUR_API_TOKEN'

成功的反应

200
阵列项结构 Webhook[]
字段类型必填描述
id integer · int32 Id.
name string 姓名.
url string 查看一个URL.
types string[] 类型.
clientId integer · int64 客户身份证.
organizationId integer · int64 组织身份证.
[
  "string"
]
错误4

应用错误通常以 JSON, error,localMessage和 params为回归. 如何返回应用错误 ↑

401auth_required
需要进行认证

Authorization 缺失,空,或包含无效的代币.

400error_access_denied
拒绝访问

代币存在,但它的作用不能执行这个操作.

500error_unknown
发生了一个未知的错误。如果该问题再次发生,请联系支持

节省请求时间和联系支持;不要盲目重新尝试突变.

400error_subscription_expired
你的费率已经过期。支付关税以继续使用该服务。

应用逻辑中使用稳定的error_subscription_expired代码;localMessage包含上述翻译.

POST

创建

/api/webhook/
具有写入的标志

使用 POST 创建 /api/webhook/.

要求机构

application/json
对象场Webhook
字段类型必填描述
id integer · int32 Id.
name string 姓名.
url string 查看一个URL.
types string[] 类型.
clientId integer · int64 客户身份证.
organizationId integer · int64 组织身份证.
curl --request POST 'https://api.selsup.ru/api/webhook/' \
  --header 'Authorization: YOUR_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
  "id": 1001,
  "name": "Example",
  "url": "https://example.com",
  "types": "string",
  "clientId": 1001,
  "organizationId": 1001
}'

成功的反应

200
对象场 Webhook
字段类型必填描述
id integer · int32 Id.
name string 姓名.
url string 查看一个URL.
types string[] 类型.
clientId integer · int64 客户身份证.
organizationId integer · int64 组织身份证.
{
  "id": 1001,
  "name": "Example",
  "url": "https://example.com",
  "types": "string",
  "clientId": 1001,
  "organizationId": 1001
}
错误7

应用错误通常以 JSON, error,localMessage和 params为回归. 如何返回应用错误 ↑

401auth_required
需要进行认证

Authorization 缺失,空,或包含无效的代币.

400error_access_denied
拒绝访问

代币存在,但它的作用不能执行这个操作.

500error_unknown
发生了一个未知的错误。如果该问题再次发生,请联系支持

节省请求时间和联系支持;不要盲目重新尝试突变.

400error_empty_type
未指定类型

应用逻辑中使用稳定的error_empty_type代码;localMessage包含上述翻译.

400error_empty_url
未指定网站地址

应用逻辑中使用稳定的error_empty_url代码;localMessage包含上述翻译.

400error_invalid_url
网站地址不正确,应该以http:// 或 https:// 开始,地址中不允许有selsup、localhost。

应用逻辑中使用稳定的error_invalid_url代码;localMessage包含上述翻译.

400error_subscription_expired
你的费率已经过期。支付关税以继续使用该服务。

应用逻辑中使用稳定的error_subscription_expired代码;localMessage包含上述翻译.

DELETE

删除

/api/webhook/{webhookId}
具有写入的标志

使用 DELETE /api/webhook/{webhookId}.删除

路径参数

字段类型必填描述
webhookId integer · int64 网页身份证.
curl --request DELETE 'https://api.selsup.ru/api/webhook/1001' \
  --header 'Authorization: YOUR_API_TOKEN'

成功的反应

200

答案没有身体.

错误4

应用错误通常以 JSON, error,localMessage和 params为回归. 如何返回应用错误 ↑

401auth_required
需要进行认证

Authorization 缺失,空,或包含无效的代币.

400error_access_denied
拒绝访问

代币存在,但它的作用不能执行这个操作.

500error_unknown
发生了一个未知的错误。如果该问题再次发生,请联系支持

节省请求时间和联系支持;不要盲目重新尝试突变.

400error_subscription_expired
你的费率已经过期。支付关税以继续使用该服务。

应用逻辑中使用稳定的error_subscription_expired代码;localMessage包含上述翻译.

Authorization

测试请求的标志

代币存储在本浏览器的本地存储库中,只会在要求的Authorization头上发送到 api.selsup.ru.

试一试

实际请求参数

现场API响应

发送请求查看SelSup的响应.