SoftLayer Curl 命令与 UI 输出不匹配

SoftLayer Curl Command Does Not Match UI Output

我一直在创建和删除 VM,并试图在整个订单处理过程中提取它们的状态。 输出始终是 '{"id":[ID],"statusId":1001}' 无论订单在流程中的哪个位置。

在UI中,它可能会说'Attaching Primary Disk',但它总是使用API输出'Active'和'1001'。

使用的命令:

curl https://[username]:[apiKey]@api.softlayer.com/rest/v3/Softlayer_Hardware_Server/[serverID].json

为什么这不起作用?是否有使用 API 获取状态的解决方案?

当您创建新的 VM 时,状态将为“Active”且 statusId= 1001,这意味着它正在使用中,当您取消 VM 时,状态将为“Disconnected”且 statusId= 1006,然后才能取消完全。

在删除 VM 之前状态为“RESOURCE RESERVE”之后,在此状态下,无论是否通过 api o UI,都不再为用户列出 VM。

更多参考可以看下面link:

尝试使用以下 curl 命令检索 VM 状态:

curl -k "https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/[vmId]/getObject.json" | python -mjson.tool

或者你可以使用下面的休息api:

方法:获取

https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/[vmId]/getObject?objectMask=mask[status]

关于您在 UI "Attaching Primary Disk" 中看到的状态,我认为您是在谈论交易状态,要检索该信息,您可以使用以下方法

对于虚拟客人: 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

对于硬件服务器: 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