2017-03-24 31 views
0

我已經做了一些在線搜索,似乎無法弄清楚爲什麼OS格式類型是錯誤的。我做了一個查詢,ID和鍵名是正確的。osFormatType耐力塊存儲排序Softlayer

enduranceOrder = { 
    "location": 1441195, 
    "packageId": 240, 
    "quantity": 48, 
    "prices": [ 
     { 
      "id": 45064 # endurance 
     }, 
     { 
      "id": 45104 # block storage 
     }, 
     { 
      "id": 178501 # 10 IOPS 
     }, 
     { 
      "id": 178581 # 250 GB storage space 
     } 
    ], 
    "osFormatType": { 
     "id": 12, 
     "keyName": "LINUX", 
     "complexType": "SoftLayer_Network_Storage_Iscsi_OS_Type" 
    } 
} 

是我的訂單。我曾嘗試過,沒有複雜的類型。

SoftLayer.exceptions.SoftLayerAPIError: SoftLayerAPIError(SoftLayer_Exception_Order_InvalidData): Invalid data on the order for property: osFormatType. No OS format type key name set. Please provide a valid value

是錯誤

回答

1

,因爲API不知道您的訂單是用什麼容器,通常不需要指定,但在這種情況下你需要它。

試試這個:

enduranceOrder = { 
    "complexType": "SoftLayer_Container_Product_Order_Network_Storage_Enterprise", 
    "location": 1441195, 
    "packageId": 240, 
    "quantity": 48, 
    "prices": [ 
     { 
      "id": 45064 # endurance 
     }, 
     { 
      "id": 45104 # block storage 
     }, 
     { 
      "id": 178501 # 10 IOPS 
     }, 
     { 
      "id": 178581 # 250 GB storage space 
     } 
    ], 
    "osFormatType": { 
     "id": 12, 
     "keyName": "LINUX", 
     "complexType": "SoftLayer_Network_Storage_Iscsi_OS_Type" 
    } 
} 

問候

+0

非常感謝尼爾森。關於這些複雜類型,這只是指定這些priceId(物品)的位置? 此外,爲了向訂單添加標籤,我假設在訂購時無法完成此操作? – Patrick

+0

對不起,我不undertand你的問題,但爲了瞭解複雜類型使用你需要看看文檔http://sldn.softlayer.com/reference/datatypes/SoftLayer_Container_Product_Order_Network_Storage_Enterprise –

+0

感謝您的幫助尼爾森 – Patrick