diff --git a/%E7%BB%88%E7%AB%AF%E6%9C%BA%E5%95%86%E5%AE%B6.md b/%E7%BB%88%E7%AB%AF%E6%9C%BA%E5%95%86%E5%AE%B6.md index 44e43c6..3a07ecc 100644 --- a/%E7%BB%88%E7%AB%AF%E6%9C%BA%E5%95%86%E5%AE%B6.md +++ b/%E7%BB%88%E7%AB%AF%E6%9C%BA%E5%95%86%E5%AE%B6.md @@ -21,7 +21,18 @@ ### 获取手机号 -方式一:主动取号(<a href="https://test-api.code92.top/index.html#/%E7%AE%A1%E7%90%86%E6%9C%8D%E5%8A%A1/sms.code/api-adm-sms.code-get.phone-Post" target="_blank">文档</a>) +<a href="https://test-api.code92.top/index.html#/%E7%AE%A1%E7%90%86%E6%9C%8D%E5%8A%A1/sms.code/api-adm-sms.code-get.phone-Post" target="_blank">接口文档</a> + +接口路径:/api/adm/sms.code/get.phone + +请求示例: +``` json +{ + "project": "telegram", + "provider": "terminal", // 此项固定不可变 + "countryCode": "us" +} +``` 成功响应示例: ``` json @@ -43,19 +54,20 @@ } ``` -方式二:自动取号推送 - -i. <a href="https://admin.code92.top/biz/phone-task" target="_blank">添加取号需求</a> - -ii. <a href="https://admin.code92.top/push/subscriber" target="_blank">添加推送地址</a> - -iii. 控制取号开启/停止(<a href="https://test-api.code92.top/index.html#/%E7%AE%A1%E7%90%86%E6%9C%8D%E5%8A%A1/phone.task/api-adm-phone.task-set.enabled.by.country-Post" target="_blank">文档</a>) - ---------------- ### 获取验证码 -方式一:主动获取(<a href="https://test-api.code92.top/index.html#/%E7%AE%A1%E7%90%86%E6%9C%8D%E5%8A%A1/sms.code/api-adm-sms.code-get-Post" target="_blank">文档</a>),此步骤需要多次尝试,建议设定请求间隔为5s,持续5min + +<a href="https://test-api.code92.top/index.html#/%E7%AE%A1%E7%90%86%E6%9C%8D%E5%8A%A1/sms.code/api-adm-sms.code-get-Post" target="_blank">接口文档</a> + +此步骤需要多次尝试,建议设定请求间隔为5s,持续5min + +请求示例: +``` json +{ + "id": 611987201483781 // 业务流水号 +} +``` 取到码响应示例: ``` json @@ -86,8 +98,6 @@ iii. 控制取号开启/停止(<a href="https://test-api.code92.top/index.html } } ``` -方式二:接码自动推送(<a href="https://admin.code92.top/push/subscriber" target="_blank">添加推送地址</a>) - ### 报告验证码错误 @@ -100,44 +110,3 @@ iii. 控制取号开启/停止(<a href="https://test-api.code92.top/index.html 如果不希望获取到某个手机号,可以调用此接口(<a href="https://test-api.code92.top/index.html#/%E7%AE%A1%E7%90%86%E6%9C%8D%E5%8A%A1/sms.code/api-adm-sms.code-ban.phone-Post" target="_blank">文档</a>)拉黑,拉黑之后可确保24小时内不会再次取到此手机号。 - - -## 数据订阅推送 - -如果您拥有支持公网访问的 Web 服务器,还可以 <a target="_blank" href="https://admin.code92.top/push/subscriber">订阅数据推送</a> ,支持各类订阅各类事件推送。 - -通知方式也是通过 HTTP 请求传递到您的 Web 服务器。 - -### 推送协议 - -| Request Method | Request Url | Request Header | Request Body | -| -------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| POST | <a href="https://admin.code92.top/push/subscriber" target="_blank">设置用于接收数据推送的 URL 地址</a> | CLOUD-CODE-TIMESTAMP: 时间戳 <br />CLOUD-CODE-SIGN: 签名 <br />Content-Type: application/json | { "pushType": <a target="_blank" href="https://test-api.code92.top/index.html#/SwaggerModels/%E7%AE%A1%E7%90%86%E6%9C%8D%E5%8A%A1"> DataPushTypes </a>, "pushData": 推送数据 } | - -### 签名校验 -为了确保数据由本平台发出且未经篡改送达您的服务器, 请按照以下方式校验签名,抛弃签名不符以及时间戳误差过大的非法请求: - -( <a href="https://admin.code92.top/profile/merchant" target="_blank">您的用户标识</a> + Header["CLOUD-CODE-TIMESTAMP"] + ReuqestBody ).MD5(UTF8) = Header["CLOUD-CODE-SIGN"] - -例如您的用户标识为:26849160-3e36-46fb-b51c-2def0655f195 - -收到的请求时间戳为:1723276087 - -收到的请求内容为:{"name":"cloud-code"} - -则签名串为 -``` -26849160-3e36-46fb-b51c-2def0655f1951723276087{"name":"cloud-code"} -``` -经过md5哈希运算的签名值为: -``` -aadb0544aa76e57ed86481870a21f8d2 -``` -### 推送事件 - -点击链接进入文档页面 CTRL+F 搜索 - -| 事件类型 | 类型描述 | 推送数据 | -| ---------------- | ---------------- | ------------------------------------------------------------ | -| smsCodeReceived | 接收到短信验证码 | <a target="_blank" href="https://test-api.code92.top/index.html#/SwaggerModels/%E7%AE%A1%E7%90%86%E6%9C%8D%E5%8A%A1">QuerySmsCodeRsp</a> | -| gotPhone | 取到手机号 | <a target="_blank" href="https://test-api.code92.top/index.html#/SwaggerModels/%E7%AE%A1%E7%90%86%E6%9C%8D%E5%8A%A1">GetPhoneRsp</a> | \ No newline at end of file