API Call Address
{域名地址}/attachment/upload?token={token}
Description:{域名地址}
Need to replace it with your domain address, such ashttps://en.anqicms.com/attachment/upload?token={token}
Calling method
POST form-data
Request parameters
GET Parameters
Field name |
Type |
Required |
Description |
token |
string |
Yes |
Token in the background content import interface feature |
POST Parameters
Field name |
Type |
Required |
Description |
category_id |
int |
No |
Image resource category ID |
id |
int |
No |
Image resource ID, required if replacing an image |
file |
File |
Yes |
The file resource to be uploaded |
Return parameters
Field name |
Type |
Description |
code |
int |
error code |
msg |
string |
error reason description |
data |
object |
result content |
data parameter
Field name |
Type |
Description |
id |
int |
resource ID |
file name |
string |
File Name |
file_location |
string |
File Storage Path |
file_size |
int |
File Size |
file_md5 |
string |
file MD5 |
width |
int |
image width |
height |
int |
Image Height |
category_id |
int |
Resource Category ID |
is_image |
int |
Is it an image, 1 is an image, 0 is not |
Logo |
string |
Original Image |
Thumb |
string |
Thumbnail |
Created Time |
int |
Timestamp of Creation |
updated_time |
int |
update timestamp |
status |
int |
display status |
request data example
Parameter |
Value |
category_id |
1 |
file |
File Resource |
Return Data Example
{
"code": 0,
"data": {
"id": 213,
"created_time": 1662734332,
"updated_time": 1662734332,
"file_name": "AnqiCMS",
"file_location": "uploads/202209/09/5632dd13c746a365.webp",
"file_size": 9348,
"file_md5": "4fae2c295632dd13c746a3653227f93a",
"width": 160,
"height": 160,
"category_id": 0,
"is_image": 1,
"status": 1,
"logo": "https://en.anqicms.com/uploads/202209/09/5632dd13c746a365.webp",
"thumb": "https://en.anqicms.com/uploads/202209/09/thumb_5632dd13c746a365.webp"
},
"msg": ""
}
Error Code
error code |
Description |
0 |
OK |
-1 |
Error, the reason is indicated in the msg |
1001 |
Not logged in |
1002 |
Unauthorized |
200 |
API request OK |