Revision history [back]

click to hide/show revision 1
initial version

curl api call to stop vm

Hi , I am currently trying to facilitate a user so that he can stop /start his vm through an open-api call. I have successfully obtained a token as follows:

curl -i 'http://<ipaddress>:5000/v2.0/tokens' -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{"auth": {"tenantName": "", "passwordCredentials": {"username": "myuser", "password": "myuser"}}}'

I am now trying to pass the token and issuse a server command as follows:

curl -i -X POST -H "Content-Type: application/json" -H 'X-Auth-Token:b13a057539784d6f8a55d9d2d3a115a8'
-d '{"os-stop":null} ' 'http://<ipaddress>:8774/v2.0/<tenant_id>/servers/<vm_id>/action'

eg as follows:

curl -i -X POST -H "Content-Type: application/json" 'X-Auth-Token:b13a057539784d6f8a55d9d2d3a115a8' -d '{"os-stop":null }' http://controller:8774/v2.0/91ca51f6aff347089b5439931c770b39/servers/8c67ea2e-9477-4714-bddf-092efc03b7ba/action

91ca51f6aff347089b5439931c770b39 is the tenant-id 8c67ea2e-9477-4714-bddf-092efc03b7ba is the vm-id b13a057539784d6f8a55d9d2d3a115a8 is the token-id

curl: (6) Couldn't resolve host 'X-Auth-Token:b13a057539784d6f8a55d9d2d3a115a8'

I know I am very close to getting this to work. Can someone help with where I am going wrong.