- http status code type
status code |
response category |
reason phrase |
1xx |
Informational status code (Informational) |
The server is processing the request |
2xx |
Success status code (Success) |
The request has been processed normally |
3xx |
Redirection status code (Redirection) |
Additional action is required to complete the request |
4xx |
Client error status code (Client Error) |
The server cannot process the request due to client reasons |
5xx |
Server error status code (Server Error) |
An error occurred in processing the request due to server reasons |
- Interface calling method
2.1. Communication protocol
Supports HTTP or HTTPS protocol request communication. For higher security, it is recommended to use HTTPS protocol to send requests.
beg.
2.2. Request rules
https:// + request domain name + request path + ? + final request parameter string
2.3. Request method
method |
illustrate |
GET |
Requests the server to return the specified resource. |
PUT |
Requests the server to update the specified resource. |
POST |
Request the server to add resources or perform special operations. |
DELETE |
Request the server to delete specified resources, such as deleting objects, etc. |
HEAD |
Request server resource header. |
PATCH |
Requests the server to update part of a resource. When the resource does not exist, PATCH may create a new resource. |
2.4. Character encoding
API requests and return results are encoded using the UTF-8 character set.
- public parameters
3.1. Public request parameters
name |
Location |
type |
Is it necessary |
describe |
Timestamp |
param |
string |
yes |
The current UNIX timestamp can record the time when the API request was initiated. |
Nonce |
param |
string |
yes |
Random positive integer, combined with Timestamp, used to prevent replay attacks |
Version |
param |
string |
yes |
API version number, using YYYY-MM-DD date format. Value: 2014-05-15 |
- Common request return value
4.1. Normal return status code
status code |
return value |
illustrate |
200 |
OK |
The request was successful. |
202 |
Created |
The task submission is successful. The current system is busy and the issued tasks will be delayed. |
204 |
No Content |
Task submitted successfully. |
4.2. Exception return status code
status code |
return value |
illustrate |
300 |
multiple choices |
There are multiple alternative responses for the requested resource. |
400 |
Bad Request |
The server failed to process the request. |
401 |
Unauthorized |
被请求的页面需要用户名和密码。 |
403 |
Forbidden |
对被请求页面的访问被禁止。 |
404 |
Not Found |
服务器无法找到被请求的页面。 |
405 |
Method Not Allowed |
请求中指定的方法不被允许。 |
406 |
Not Acceptable |
服务器生成的响应无法被客户端所接受。 |
407 |
Proxy Authentication Required |
用户必须首先使用代理服务器进行验证,这样请求才会被处理。 |
408 |
Request Timeout |
请求超出了服务器的等待时间。 |
409 |
Conflict |
由于冲突,请求无法被完成。 |
500 |
Internal Server Error |
请求未完成,服务异常。 |
501 |
Not Implemented |
请求未完成,服务器不支持所请求的功能。 |
502 |
Bad Gateway |
请求未完成,服务器从上游服务器收到一个无效的响应。 |
503 |
Service Unavailable |
请求未完成,系统暂时异常。 |
504 |
Gateway Timeout |
网关超时。 |
505 |
HTTP Version Not Supported |
不支持的http版本。 |
4.3. 公共错误码
4.3.1. 云服务器操作类常见公共错误码
错误码 |
错误信息 |
http状态码 |
说明 |
101.001004 |
云服务器费用已过期,不能操作,请续费 |
400 |
云服务器已过期,需要续费 |
101.001012 |
存在未知状态的云服务器,请重新选择云服 务器 |
400 |
云服务器不满足操作的前置 状态 |
101.001013 |
存在未知所属的云服务器,请重新选择云服 务器 |
400 |
云服务器不属于操作用户或 者不存在 |
101.001014 |
存在未付费类型的云服务器,请重新选择云 服务器 |
400 |
云服务器在BSS 无计费信息 |
- 附录
5.1. 云服务器状态字段转义对照图
状态字段的转义如下:
取status 字段,不区分大小写
status |
translation |
ACTIVE |
运行中 |
DELETED |
已删除 |
ERROR |
错误/创建失败 |
PAUSED |
暂停 |
SOFT_DELETED |
软删除 |
STOPPED |
停止 |
SHUTOFF |
已关机 |
BUILD |
创建中 |
REBOOT |
软重启中 |
HARD_REBOOT |
硬重启中 |
RESIZE |
变更规格中 |
REBUILD |
重置系统中 |
PASSWORD |
重置密码中 |
取task_state 字段,不区分大小写
task_state |
translation |
powering-on |
开机中 |
powering-off |
关机中 |
deleting |
删除中 |
私有镜像状态字段转义对照图
status |
translation |
queued(排队中)、saving(保存中) |
创建中 |
killed |
创建失败/错误 |
active |
可用 |
pending_delete |
删除中 |