【问题标题】:Softlayer API place order return Package (835) requires a preset configuration errorSoftlayer API下单退货包(835)需要预设配置错误
【发布时间】:2017-11-08 05:37:09
【问题描述】:

当我使用 SoftLayer API 使用特定 CPU、内存和第一个磁盘的风格创建 CCI 时,我无法像以前那样附加第二个磁盘。

然后我粘贴流程详细信息:

  1. 通过createObject创建CCI,参数如下:

    POST https://api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest.json
    {
        "parameters": [
            {
                "blockDeviceTemplateGroup": {
                    "globalIdentifier": "2aae2a36-76f3-4d2f-9881-e86fa15b040b"
                },
                "datacenter": {
                    "name": "dc02"
                },
                "dedicatedAccountHostOnlyFlag": false,
                "domain": "softlayer.com",
                "hostname": "server-ed-20171108-032526-888",
                "hourlyBillingFlag": true,
                "localDiskFlag": false,
                "networkComponents": [
                    {
                        "maxSpeed": 100
                    }
                ],
                "primaryBackendNetworkComponent": {
                    "networkVlan": {
                        "id": 12345678,
                        "networkSpace": "PRIVATE"
                    }
                },
                "primaryNetworkComponent": {
                    "networkVlan": {
                        "id": 12345676,
                        "networkSpace": "PUBLIC"
                    }
                },
                "privateNetworkOnlyFlag": false,
                "supplementalCreateObjectOptions": {
                    "flavorKeyName": "B1_4X8X25"
                }
            }
        ]
    }
    
  2. 等待配置完成

  3. 请求 SoftLayer_Product_Package 对象来下订单

    GET https://api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/{vmid}.json?objectMask=mask%5BprimaryBackendNetworkComponent%5BprimaryIpAddress%2C+networkVlan%5Bid%2Cname%2CvlanNumber%2CprimaryRouter%5D%2C+subnets%5Bnetmask%2CnetworkIdentifier%5D%5D%2C+primaryNetworkComponent%5BprimaryIpAddress%2C+networkVlan%5Bid%2Cname%2CvlanNumber%2CprimaryRouter%5D%2C+subnets%5Bnetmask%2CnetworkIdentifier%5D%5D%5D
    

    Softlayer 返回两个包(我第一次使用)

    [
        {
            "description": "Virtual Server Instance",
            "id": 46,
            "isActive": 1,
            "name": "Cloud Server",
            "type": {
                "keyName": "VIRTUAL_SERVER_INSTANCE"
            }
        },
        {
            "description": "Public Virtual Server",
            "id": 835,
            "isActive": 1,
            "name": "Public Virtual Server",
            "type": {
                "keyName": "VIRTUAL_SERVER_INSTANCE"
            }
        }
    ]  
    
  4. 请求 SoftLayer_Virtual_Guest getUpgradeItemPrices 以查找第二个磁盘的升级项目价格

    POST https://api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/{vmid}/getUpgradeItemPrices.json
    

    并得到167个商品的价格和选择第一个商品匹配类别代码和容量。

  5. 下订单

    POST https://api.softlayer.com/rest/v3.1/SoftLayer_Product_Order/placeOrder.json
    Parameters:
    {
        "parameters": [
            {
                "complexType": "SoftLayer_Container_Product_Order_Virtual_Guest_Upgrade",
                "packageId": 46,
                "prices": [
                    {
                        "categories": [
                            {
                                "categoryCode": "guest_disk1",
                                "id": 82,
                                "name": "Second Disk",
                                "quantityLimit": 0
                            }
                        ],
                        "currentPriceFlag": false,
                        "hourlyRecurringFee": 0.013,
                        "id": 112953,
                        "item": {
                            "attributes": [
                                {
                                    "attributeType": {
                                        "keyName": "SAN_DISK",
                                        "name": "SAN Disk"
                                    },
                                    "id": 196,
                                    "itemAttributeTypeId": 50,
                                    "itemId": 922,
                                    "value": "1"
                                }
                            ],
                            "capacity": 100,
                            "description": "100 GB (SAN)",
                            "id": 922,
                            "itemTaxCategoryId": 166,
                            "keyName": "GUEST_DISK_100_GB_SAN_3",
                            "localDiskFlag": false,
                            "units": "GB"
                        },
                        "itemId": 922,
                        "laborFee": 0,
                        "locationGroupId": 505,
                        "oneTimeFee": 0,
                        "pricingLocationGroup": {
                            "description": "Location Group 3",
                            "id": 505,
                            "locationGroupType": {
                                "name": "PRICING"
                            },
                            "locationGroupTypeId": 82,
                            "locations": [
                                {
                                    "id": 449600,
                                    "longName": "Mexico 1",
                                    "name": "mex01",
                                    "statusId": 2
                                },
                                {
                                    "id": 2124095,
                                    "longName": "London 6",
                                    "name": "lon06",
                                    "statusId": 2
                                },
                                {
                                    "id": 167094,
                                    "longName": "London 1",
                                    "name": "lon01",
                                    "statusId": 2
                                },
                                {
                                    "id": 358694,
                                    "longName": "London 2",
                                    "name": "lon02",
                                    "statusId": 2
                                },
                                {
                                    "id": 2017395,
                                    "longName": "London 4",
                                    "name": "lon04",
                                    "statusId": 2
                                },
                                {
                                    "id": 1541257,
                                    "longName": "Oslo 1",
                                    "name": "osl01",
                                    "statusId": 2
                                }
                            ],
                            "name": "Location Group 3"
                        },
                        "recurringFee": 7.98,
                        "setupFee": 0,
                        "sort": 0
                    }
                ],
                "properties": [
                    {
                        "name": "MAINTENANCE_WINDOW",
                        "value": "2017-11-08T03:34:12Z"
                    },
                    {
                        "name": "NOTE_GENERAL",
                        "value": "Upgrade instance configuration."
                    }
                ],
                "virtualGuests": [
                    {
                        "id": {vmid}
                    }
                ]
            },
            false
        ]
    }
    

    此请求出现Response: {"error":"Invalid data on the order for property: packageId. Package (835) requires a preset configuration.","code":"SoftLayer_Exception_Order_InvalidData"} 错误

请求是我使用包'46'升级,但Softlayer返回关于包'835'的错误。这是什么意思?

【问题讨论】:

  • 我使用包 '835' 发布 placeOrder 返回相同的错误。

标签: api ibm-cloud-infrastructure


【解决方案1】:

尝试在您的请求中添加属性“presetId”,值为 0,同时 packageId 将其设置为 0。例如

POST https://api.softlayer.com/rest/v3.1/SoftLayer_Product_Order/placeOrder.json
Parameters:
{
    "parameters": [
        {
            "complexType": "SoftLayer_Container_Product_Order_Virtual_Guest_Upgrade",
            "packageId": 0,
            "presetId": 0,
            "prices": [
                {
                    "categories": [
                        {
                            "categoryCode": "guest_disk1",
                            "id": 82,
                            "name": "Second Disk",
                            "quantityLimit": 0
                        }
                    ],
                    "currentPriceFlag": false,
                    "hourlyRecurringFee": 0.013,
                    "id": 112953,
                    "item": {
                        "attributes": [
                            {
                                "attributeType": {
                                    "keyName": "SAN_DISK",
                                    "name": "SAN Disk"
                                },
                                "id": 196,
                                "itemAttributeTypeId": 50,
                                "itemId": 922,
                                "value": "1"
                            }
                        ],
                        "capacity": 100,
                        "description": "100 GB (SAN)",
                        "id": 922,
                        "itemTaxCategoryId": 166,
                        "keyName": "GUEST_DISK_100_GB_SAN_3",
                        "localDiskFlag": false,
                        "units": "GB"
                    },
                    "itemId": 922,
                    "laborFee": 0,
                    "locationGroupId": 505,
                    "oneTimeFee": 0,
                    "pricingLocationGroup": {
                        "description": "Location Group 3",
                        "id": 505,
                        "locationGroupType": {
                            "name": "PRICING"
                        },
                        "locationGroupTypeId": 82,
                        "locations": [
                            {
                                "id": 449600,
                                "longName": "Mexico 1",
                                "name": "mex01",
                                "statusId": 2
                            },
                            {
                                "id": 2124095,
                                "longName": "London 6",
                                "name": "lon06",
                                "statusId": 2
                            },
                            {
                                "id": 167094,
                                "longName": "London 1",
                                "name": "lon01",
                                "statusId": 2
                            },
                            {
                                "id": 358694,
                                "longName": "London 2",
                                "name": "lon02",
                                "statusId": 2
                            },
                            {
                                "id": 2017395,
                                "longName": "London 4",
                                "name": "lon04",
                                "statusId": 2
                            },
                            {
                                "id": 1541257,
                                "longName": "Oslo 1",
                                "name": "osl01",
                                "statusId": 2
                            }
                        ],
                        "name": "Location Group 3"
                    },
                    "recurringFee": 7.98,
                    "setupFee": 0,
                    "sort": 0
                }
            ],
            "properties": [
                {
                    "name": "MAINTENANCE_WINDOW",
                    "value": "2017-11-08T03:34:12Z"
                },
                {
                    "name": "NOTE_GENERAL",
                    "value": "Upgrade instance configuration."
                }
            ],
            "virtualGuests": [
                {
                    "id": {vmid}
                }
            ]
        },
        false
    ]
}

如果这能解决您的问题,请告诉我。

【讨论】:

  • 我设置 'packageId' 和 'presetId' 都是 0,它返回相同的错误。两个零值是什么意思?
  • 请尝试删除这些值(packageId 和 Presete),如果问题仍然是 presetId,请告诉我
  • 也请尝试将 presetId 值设置为 223,presetID 表示您选择订购 VSI 的风味,我理解这不是必需的,但似乎是。您可以像这样获取用于 VSI 的预设 GET api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest{VSIID}/getObject?objectMask=mask[id,billingItem[id,orderItem[presetId]]]
  • presetId 为 223 的 packageId 是什么? 0 还是 223?删除or 223时还是返回同样的错误。
  • 所以错误提示835包需要persetId,但是我们从来没有指定835包。为什么它返回那个错误?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-06-07
  • 2013-03-07
  • 2018-06-26
  • 2014-01-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多