概要

基础

SM.MS API通过标准化的编程接口公开基础结构。

该API是通过使HTTPS请求发送到特定版本的端点URL,其中GET,POST,PUT,PATCH和DELETE方法决定你与信息的交互方式提供访问。 每个端点仅通过HTTPS支持SSL(端口443)协议来访问。

所有第2版HTTPS端点稳定的基本网址为:

https://sm.ms/api/v2/

认证方式

通过有效的API密钥设置Authorization头请求进行身份验证。

我们仅接受像这样的API密钥:

"Authorization":  "14ac5499cfdd2bb2859e4476d2e5b1d2bad079bf"

或基本类型和API密钥:

"Authorization":  "Basic 14ac5499cfdd2bb2859e4476d2e5b1d2bad079bf"

确保将API密钥存储在安全的地方,并且永远不要公开共享它们。

User

Get Token - Get API-Token

1) 请求地址

https://sm.ms/api/v2/token

2) 调用方式:HTTP post

3) 接口描述:

  • 接口描述详情

4) 请求参数:

POST参数:

字段名称 字段说明 类型 必填 备注
username string Y -
password string Y -

5) 请求返回结果:

1
2
3
4
5
6
7
8
9
{
"success": true,
"code": "success",
"message": "Get API token success.",
"data": {
"token": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
},
"RequestId": "9B4AC473-0DBF-4A18-8D9B-384E1AA29056"
}

6) 请求返回结果参数说明:

字段名称 字段说明 类型 必填 备注
success string Y -
code string Y -
message string Y -
data string Y -
token string Y -
RequestId string Y -

Get Profile - Get User Profile

1) 请求地址

https://sm.ms/api/v2/profile

2) 调用方式:HTTP post

3) 接口描述:

  • 接口描述详情

4) 请求参数:

5) 请求返回结果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
"success": true,
"code": "success",
"message": "Get user profile success.",
"data": {
"username": "Sakitam",
"email": "tjwsq-qiqiqi@outlook.com",
"role": "user",
"group_expire": "0000-00-00",
"email_verified": 0,
"disk_usage": "2.07 MB",
"disk_limit": "5.00 GB",
"disk_usage_raw": 2173228,
"disk_limit_raw": 5368709120
},
"RequestId": "D19B7117-8FB5-462C-A2C3-A2E11FAFC35F"
}

6) 请求返回结果参数说明:

字段名称 字段说明 类型 必填 备注
success string Y -
code string Y -
message string Y -
data string Y -
username string Y -
email string Y -
role string Y -
group_expire string Y -
email_verified string Y -
disk_usage string Y -
disk_limit string Y -
disk_usage_raw string Y -
disk_limit_raw string Y -
RequestId string Y -

Image