1
0
mirror of https://github.com/chatopera/cosin.git synced 2025-07-28 12:32:15 +08:00

Destroyed RestAPI 文档 (markdown)

Samurais 2020-05-14 13:44:37 +08:00
parent 1381dd4573
commit debfdea47f

@ -1,54 +0,0 @@
# 春松客服RestAPI
春松客服目前具备30余个API接口包括联系人管理授权获得访客会话列表等。使用春松客服API需要安装Postman并导入春松客服API Collection文件。
## 安装Postman
Postman支持各种操作系统下载安装包
https://www.postman.com/
## 导入春松客服API文件
下载[Chatopera_cc_v1.postman_collection.20200312.zip](https://github.com/chatopera/cosin/files/4323043/Chatopera_cc_v1.postman_collection.20200312.zip)
将zip文件解压得到 Chatopera_cc_v1.postman_collection.json
打开Postman执行导入
![image](https://user-images.githubusercontent.com/3538629/76501380-256fe080-647d-11ea-8644-1b53671d6b25.png)
## API认证
导入collection文件后从左侧找到 **Chatopera_cc_v1**
![image](https://user-images.githubusercontent.com/3538629/76501495-53552500-647d-11ea-922e-be442aa7c9a1.png)
认证接口:
```
# 获得Token
POST http://IP:PORT/tokens?username=USERNAME&password=PASSWORD
```
| key | 描述 |
| --- | --- |
| IP | 春松客服IP |
| PORT | 春松客服端口 |
| USERNAME | 用户名 |
| PASSWORD | 密码 |
回复结果为一个字符串即Auth token。
## 业务API请求
在请求其它API时在header中设置`authorization`为Auth token就可以如下
![image](https://user-images.githubusercontent.com/3538629/76501630-9616fd00-647d-11ea-9f51-73ea33548bcf.png)
针对每个接口的描述此处不赘述直接用Postman测试。
## 其它注意事项
* 每个token有效期为24小时认证失败会有相应提醒
* 登录用户的权限有限制API访问受此约束