Get Token
Features |
interface |
Request method |
POST |
URL |
https://iimg.com.cn/api/token |
Request parameter
parameter name |
Types of |
Do you have to |
Explanation |
email |
String |
Yes |
mailbox |
password |
String |
Yes |
account password |
format |
String |
no |
Return data format, optional json, xml, jsonp, default json |
Return Data Description
parameter name |
Types of |
Examples of values |
Explanation |
code |
Number |
200 |
Status code 200 is returned successfully, failed to return 500 |
msg |
String |
success |
Tips |
time |
Number |
1544176295 |
Response time stamp |
data |
array|object |
{"token": "8961576c9090ef0902c4b89406f8d557"} |
Get the token data |
2. Upload pictures
Features |
interface |
Request method |
POST |
URL |
https://iimg.com.cn/api/upload |
Request parameter
parameter name |
Types of |
Do you have to |
Explanation |
image |
File |
Yes |
Form Name |
format |
String |
no |
Return data format, optional json, xml, jsonp, default json |
Note: If there is a request header parameter token, the interface to the authentication token, upload pictures also in the token this user, or for visitors to upload.
Return Data Description
parameter name |
Types of |
Examples of values |
Explanation |
code |
Number |
200 |
Status code 200 is returned successfully, failed to return 500 |
msg |
String |
success |
Tips |
time |
Number |
1544176295 |
Response time stamp |
data |
array|object |
{
"name": "9B7BCFBD05891B2D42187F126887777A.jpg",
"url": "http://域名/p/5c0b519f44701.jpg"
} |
Get the token data |
Upload the sample
POST /api/upload HTTP/1.1
Host: https://iimg.com.cn
Connection: keep-alive
Content-Length: 57398
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryx2mqINKHVPJ8yMdK
------WebKitFormBoundaryx2mqINKHVPJ8yMdK
Content-Disposition: form-data; name="image"; filename="test.png"
Content-Type: image/png
响应错误示例
{
"code": 500,
"msg": "管理员关闭了游客上传!",
"data": null,
"time": 1544245931
}