Reputation: 43
I've been creating and deleting VMs, and trying to pull their status throughout the processing of the order. The output is always '{"id":[ID],"statusId":1001}' no matter where in the process the order is.
In the UI, it may say 'Attaching Primary Disk', but it will always output 'Active' and '1001' using the API.
The command used:
curl https://[username]:[apiKey]@api.softlayer.com/rest/v3/Softlayer_Hardware_Server/[serverID].json
Is there a reason why this doesn't work? Is there a solution to getting the status using the API?
Upvotes: 2
Views: 109
Reputation: 1104
About the status you see in UI "Attaching Primary Disk", I think you are talking about the transaction status, to retrieve that information you can use the following methods
For Virtual Guests: https://softlayer.github.io/reference/services/SoftLayer_Virtual_Guest/getActiveTransaction https://softlayer.github.io/reference/services/SoftLayer_Virtual_Guest/getActiveTransactions https://softlayer.github.io/reference/services/SoftLayer_Virtual_Guest/getLastTransaction
For Hardware Servers: https://softlayer.github.io/reference/services/SoftLayer_Hardware_Server/getActiveTransaction https://softlayer.github.io/reference/services/SoftLayer_Hardware_Server/getActiveTransactions https://softlayer.github.io/reference/services/SoftLayer_Hardware_Server/getLastTransaction
Upvotes: 1
Reputation: 728
When you create a new VM the status will be ¨Active¨ and statusId= 1001 , it means it is in use, when you cancel a VM the status will be ¨Disconnected¨ and statusId= 1006 before to be canceled completely.
After that the status is ¨RESOURCE RESERVE¨ before removing the VM, in this status the VM is not longer listed for users whether through the api o UI.
For more reference you can see the following link: SoftLayer Virtual Guest host Status list
Try with below curl command to retrieve the VM status:
curl -k "https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/[vmId]/getObject.json" | python -mjson.tool
Or you can use the following rest api:
Method: GET
https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/[vmId]/getObject?objectMask=mask[status]
Upvotes: 0