SoftLayer Rest API attachDiskImage 调用抛出错误
SoftLayer Rest API attachDiskImage call throwing error
我正在尝试使用下面的它总是抛出 "You must provide a valid portable storage volume id."。我已经在下面的 curl 中替换了我的 virtualGuestId、imageId、用户名和 apikey。
curl "https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/[virtualGuestId]/attachDiskImage.json?imageId=[imageId]"
请告诉我正确的 API 用于加载磁盘映像以及如何获取磁盘映像的详细信息。
我建议您查看这些链接:
https://sldn.softlayer.com/blog/bpotter/more-softlayer-rest-api-examples
https://sldn.softlayer.com/article/REST
好吧,attachDiskImage 方法的参数是便携式存储的 "imageId",如您在文档中所见:
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/attachDiskImage
必须使用 POST 方法发送参数,并且您需要使用 JSON 格式在有效负载中发送这些参数,因此您的请求应更改为:
curl -X POST -d '{"parameters":[$IMAGEID]}' https://$SLUSERNAME:$SLAPIKEY@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/$VIRTUALGUESTID/attachDiskImage.json
Note: replace $IMAGEID, $SLUSERNAME, $SLAPIKEY and $VIRTUALGUESTID
此致
我正在尝试使用下面的它总是抛出 "You must provide a valid portable storage volume id."。我已经在下面的 curl 中替换了我的 virtualGuestId、imageId、用户名和 apikey。
curl "https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/[virtualGuestId]/attachDiskImage.json?imageId=[imageId]"
请告诉我正确的 API 用于加载磁盘映像以及如何获取磁盘映像的详细信息。
我建议您查看这些链接:
https://sldn.softlayer.com/blog/bpotter/more-softlayer-rest-api-examples https://sldn.softlayer.com/article/REST
好吧,attachDiskImage 方法的参数是便携式存储的 "imageId",如您在文档中所见:
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/attachDiskImage
必须使用 POST 方法发送参数,并且您需要使用 JSON 格式在有效负载中发送这些参数,因此您的请求应更改为:
curl -X POST -d '{"parameters":[$IMAGEID]}' https://$SLUSERNAME:$SLAPIKEY@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/$VIRTUALGUESTID/attachDiskImage.json
Note: replace $IMAGEID, $SLUSERNAME, $SLAPIKEY and $VIRTUALGUESTID
此致