sumguy37
sumguy37

Reputation: 43

SoftLayer Curl Command Does Not Match UI Output

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

Answers (2)

F.Ojeda
F.Ojeda

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

Related Questions