如何使用softlayer api创建块存储

时间:2016-12-16 09:36:58

标签: ibm-cloud-infrastructure

我尝试使用python lib创建性能块存储,但响应显示“Price没有id”,问题是什么,我错过了任何参数。 这是提交请求的代码。

Array(
    [------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition:_form-data;_name] => "trackingNumber"

TestOrder_1234
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="advertiser"

Webservice
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="salesPerson"

sales person
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="publicationTitle"

publication title
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="adCategory"

Agricultural
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="specAd"

No
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="proofDate"

2016-04-25
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="runDate"

2016-04-25
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="publishDate"

2016-04-25
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="pickupAd"

New Build
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="requester"

shanthi05
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="printSpecifications[1][product]"

Creative Products
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="printSpecifications[1][prodcutType]"

Custom
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="printSpecifications[1][widthColumns]"

10
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="printSpecifications[1][depthLines]"

20
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="printSpecifications[1][colorType]"

Full Color
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="printSpecifications[1][artisticDiscretion]"

Full Artistic Discretion(AD3)
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="printSpecifications[1][copyTranslationRequired]"

No
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="printSpecifications[1][creativeBriefInstructions]"

Sample instructions
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="webSpecifications[1][product]"

Banners
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="webSpecifications[1][outputType]"

GIF [Animated]
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="webSpecifications[1][webOrderType]"

Rectangle
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="webSpecifications[1][webWidth]"

180
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="webSpecifications[1][webHeight]"

150
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="webSpecifications[1][landingURL]"

www.test.com
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="webSpecifications[1][artisticDiscretion]"

Full Artistic Discretion(AD3)
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="webSpecifications[1][creativeBriefInsructions]"

Sample instructions
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="orderAction"

Submit
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="deliveryDate"

Overnight
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="orderType"

Print
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="files[1][name]"

AW2023879_aw2015331_am_trader_ad_comple.pdf
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="files[1][fileSize]"

100
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="files[1][fileSpecificInstructions]"

trader changes template
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="files[1][ElementType]"

Graphic
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="files[1][url]"

S3 bucket relative path
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="files[2][name]"

file1.png
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="files[2][fileSize]"

100
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="files[2][fileSpecificInstructions]"

trader changes template
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="files[2][ElementType]"

Graphic
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="files[2][url]"

S3 bucket relative path
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="orderNumber"

4140787
------WebKitFormBoundary9F6kn9bF7EVHliR3
Content-Disposition: form-data; name="requestAction"

UPDATE_ORDER
------WebKitFormBoundary9F6kn9bF7EVHliR3--

)

我列出了使用python代码的性能存储的所有价格,只列出部分信息:

  

************ PACKAGE:Pkg Id:222可选类别:
      ----名称:附加费Cat Id:315                      项目价格ID:32082描述:国际服务LocGrp Id:无可选类别:
      ----名称:性能存储NFS Cat Id:378                      项目价格ID:40668描述:文件存储(性能)LocGrp Id:无可选类别:
      ----名称:存储复制Cat Id:388可选类别:
      ----名称:性能存储iSCSI Cat Id:380                      项目价格ID:40678描述:块存储(性能)LocGrp Id:无需要的类别:
      ----名称:存储空间Cat Id:382                      产品价格产品编号:82389描述:40 GB存储空间LocGrp Id:509                      产品价格产品编号:82395描述:80 GB存储空间LocGrp Id:505                      项目价格ID:90579描述:4000 GB存储空间LocGrp Id:545                      项目价格ID:90583描述:12000 GB存储空间LocGrp Id:505                      项目价格ID:90585描述:12000 GB存储空间LocGrp Id:507                      项目价格ID:90589描述:12000 GB存储空间LocGrp Id:545

我还检查了其他链接: alter table How to fetch LocationID, Storage Package ID, Storage Size ID and SnapShot Space Size ID for placing order in Endurance Storage 找不到太多的帮助信息。 任何人都可以提前帮助检查问题。

1 个答案:

答案 0 :(得分:0)

您使用的complexType无效,您需要使用:

"complexType": "SoftLayer_Container_Product_Order_Network_PerformanceStorage_Iscsi"

这是我使用的orderData的一个例子:

orderData = {
             "complexType": "SoftLayer_Container_Product_Order_Network_PerformanceStorage_Iscsi",
            "packageId": 222,
            "location": 154820,
            "quantity": 1,
            "prices": [
                {
                    "id": 40678           
                },
                {
                    "id": 40688
                },
                {
                    "id": 40798
                }
            ],
            "osFormatType": { 
                "keyName": "LINUX",
                "complexType": "SoftLayer_Network_Storage_Iscsi_OS_Type"

            }
          }

此致