Recently, when writing about AWS-related development, there is a problem: for example, how do you create, restart, stop, delete, and so on for instance, if you want to implement it in a restful design style?
GET /etc/instance/ 获取instancePOST /ec2/instance/ 创建instanceDELETE /etc/instance/ 删除instance
How about restarting, stopping, etc.? With put?
Reply content:
Recently, when writing about AWS-related development, there is a problem: for example, how do you create, restart, stop, delete, and so on for instance, if you want to implement it in a restful design style?
GET /etc/instance/ 获取instancePOST /ec2/instance/ 创建instanceDELETE /etc/instance/ 删除instance
How about restarting, stopping, etc.? With put?
Just do a management service Restsful API design, say my design ideas for reference.
# 创建POST /ec2/instance# 查询状态GET /ec2/instance/:id# 删除(terminate)DELETE /ec2/instance/:id# 启动、重启等都算作修改状态,假定是在修改 instance 的 status 属性# 启动PUT /ec2/instance/:idForm data: status=start# 停止PUT /ec2/instance/:idForm data: status=stop# 启动,如果已启动就重启PUT /ec2/instance/:id?force=1Form data: status=start
Answer with a rails URL design, lazy hands.
What is restful?