如何使用软层 Rest API 在 IBM 云中启动具有数据磁盘的计算实例

How to Launch a compute Instance with data disk in IBM cloud using softlayer Rest API

我需要使用 softlayer rest API 启动计算实例并创建卷 API 并且需要使用 globalIdentifier 启动。

https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest.json

正文: { "parameters": [{ "complexType": "SoftLayer_Virtual_Guest", "maxMemory": 4, "hostname": "jagatest", "maxCpu": 2, "domain": "test.local", "hourlyBillingFlag": 是的, "startCpus": 1, "blockDeviceTemplateGroup":{ "globalIdentifier":“375c7ad3-1b39-4c58-a657-7fc4351d7b06” }, "blockDevices":[{ "device": "0", "diskImage":{ "capacity": 25 } }, { "device": "2", "diskImage":{ "capacity": 10 } } ], "localDiskFlag":错误, "datacenter":{ "complexType": "SoftLayer_Location", "name": "sjc01" } }] }

错误通过:

{"error":"Invalid value provided for 'blockDevices'. Block devices may not be provided when using an image template.","code":"SoftLayer_Exception_InvalidValue"}

尝试跟随下一个请求

方法POST

https://api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/createObject.json

正文

{
  "parameters": [
    {
      "complexType": "SoftLayer_Virtual_Guest",
      "maxMemory": 4,
      "hostname": "jagatest",
      "maxCpu": 2,
      "domain": "test.local",
      "hourlyBillingFlag": true,
      "startCpus": 1,
      "blockDeviceTemplateGroup": {
        "globalIdentifier": "375c7ad3-1b39-4c58-a657-7fc4351d7b06"
      },
      "localDiskFlag": false,
      "datacenter": {
        "complexType": "SoftLayer_Location",
        "name": "sjc01"
      }
    }
  ]
}