I want to use REST API to achieve our private cloud some function,e.g:poweroff/poweron vms,create vms.
But when I test REST API at manageiq localhost,PUT and DELETE action also failed.
the error messages just like:
"
[root@localhost ~]# curl --user admin:smartvm -X POST -H “Accept: application/json” -d ‘{“action”: “poweroff”,“resources” : [{“name”:“vm-test41”}]}’ http://localhost:3000/api/vms
{“error”:{“kind”:“bad_request”,“message”:“Unsupported HTTP Method post for the Collection vms specified”,“klass”:“ApiController::BadRequestError”}}
"
"
[root@localhost ~]# curl --user admin:smartvm -i -X DELETE -H “Accept: application/json” http://localhost:3000/api/vms/502
{“error”:{“kind”:“bad_request”,“message”:“Unsupported HTTP Method delete for the Collection vms specified”,“klass”:“ApiController::BadRequestError”}}
“
”
[root@localhost ~]#curl --user admin:smartvm -i -X POST -H “Accept: application/json” -d ‘{ “action”: “poweroff” }’ http://localhost:3000/api/vms/511
{“error”:{“kind”:“bad_request”,“message”:“Unsupported HTTP Method post for the Collection vms specified”,“klass”:“ApiController::BadRequestError”}}
"
I want to know,the reason that the commander is wrong or real unsupported the action of post&delete?
I wish the master help me,Thx~