通知 API 合同
用于 Webhook 通知的 API 合同是单向数据流。
请求
从 IBM® Verify 对已配置的 Webhook URL 发出的请求是 HTTPPOST。 Content-Type 标头设置为 application/json ,请求体为单个 IBM Verify 事件。| 字段 | 值 | 注 |
|---|---|---|
| Method | POST | |
| 资源 | 不适用 | |
| Content-type | application/json |
|
| 接受 | 取消设置 | |
| HTTP 主体 | 请参阅示例。 | 用于封装单个事件的 JSON 对象。 |
请求主体示例
事件的内容根据事件类型不同而变化。 以下代码是认证事件的示例:
{
"geoip": {
"continent_name": "North America",
"city_name": "Austin",
"country_iso_code": "US",
"ip": "129.42.38.10",
"country_name": "United States",
"region_name": "Texas",
"location": {
"lon": "-97.7133",
"lat": "30.4092"
}
},
"data": {
"result": "success",
"subtype": "user_password",
"subject": "50Q4QK9UTM",
"origin": "129.42.38.10",
"cause": "Authentication Successful",
"action": "login",
"sourcetype": "clouddirectory",
"realm": "cloudIdentityRealm",
"devicetype": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36",
"target": "https://example.verify.ibm.com/",
"username": "scott@ibm.com"
},
"year": 2022,
"event_type": "authentication",
"month": 1,
"indexed_at": 1641825768059,
"tenantid": "7fc5e889-c27b-4ff0-96f2-a495e0598e78",
"tenantname": "example.verify.ibm.com",
"correlationid": "CORR_ID-1112f59a-5ac2-439b-9c73-dc140932c7d2",
"servicename": "authsvc",
"id": "d5dc6c25-0060-4078-bb80-1c218cb5e05a",
"time": 1641825767367,
"day": 10
}
有关事件的更多示例,请参阅事件 API。
响应
配置的 Webhook URL 对 HTTP 状态为2XX 的请求做出响应,以指示成功接收通知。 如果返回了 non-2XX 代码,那么不会读取响应的 HTTP 主体,并且不会包含任何响应。| 字段 | 预期值 | 注 |
|---|---|---|
| 状态码 | 2XX | 除非另行配置。 |
| 主体 | 空 |