如何通过单个 API 调用来订购具有不同包 ID 的硬件服务器

how to order hardware servers with different package id's with a single API call

如何通过单个 order/API 调用订购多个具有不同包 ID 的 SoftLayer 裸机服务器?

更新: 在下面添加了详细信息,希望它能让我更清楚地了解我正在尝试做的事情。

下面的2个数据结构是SoftLayer_Container_Product_Order_Hardware_Server datatypes. Each is for a hardware server (billed monthly) with a different package_id, and they can each be passed individually to the placeOrder()API方法

我的问题是是否有办法将它们组合成一个订单,这样我就可以对 placeOrder() 进行一次 API 调用?

第一个数据结构,用package_id553

订购2台服务器
    {'complexType': 'SoftLayer_Container_Product_Order_Hardware_Server',
 'hardware': [{'domain': 'example.com',
               'hostname': u'host1',
               'primaryBackendNetworkComponent': {'networkVlan': {'id': 1234}},
               'primaryNetworkComponent': {'networkVlan': {'id': 5678}}},
              {'domain': 'example.com',
               'hostname': u'host2',
               'primaryBackendNetworkComponent': {'networkVlan': {'id': 1234}},
               'primaryNetworkComponent': {'networkVlan': {'id': 5678}}}],
 'location': 1441195,
 'packageId': 553,
 'prices': [{'id': 177613},
            {'id': 49811},
            {'id': 49811},
            {'id': 50113},
            {'id': 50113},
            {'id': 50113},
            {'id': 50113},
            {'id': 50113},
            {'id': 50113},
            {'id': 49081},
            {'id': 49427},
            {'id': 141945},
            {'id': 50359},
            {'id': 35686},
            {'id': 50223},
            {'id': 34807},
            {'id': 29403},
            {'id': 34241},
            {'id': 32627},
            {'id': 25014},
            {'id': 33483},
            {'id': 35310},
            {'id': 32500}],
 'quantity': 2,
 'quoteName': u'DAL10-qty2-rand9939',
 'sshKeyIds': [{'sshKeyIds': [9876]}, {'sshKeyIds': [9876]}],
 'storageGroups': [{'arrayTypeId': 2, 'hardDrives': [0, 1]},
                   {'arrayTypeId': 5, 'hardDrives': [2, 3, 4, 5, 6, 7]}],
 'useHourlyPricing': False}

第二种数据结构,用package_id251

订购2台服务器
{'complexType': 'SoftLayer_Container_Product_Order_Hardware_Server',
 'hardware': [{'domain': 'example.com',
               'hostname': u'host3',
               'primaryBackendNetworkComponent': {'networkVlan': {'id': 1234}},
               'primaryNetworkComponent': {'networkVlan': {'id': 5678}}},
              {'domain': 'example.com',
               'hostname': u'host4',
               'primaryBackendNetworkComponent': {'networkVlan': {'id': 1234}},
               'primaryNetworkComponent': {'networkVlan': {'id': 5678}}}],
 'location': 1441195,
 'packageId': 251,
 'prices': [{'id': 50659},
            {'id': 49811},
            {'id': 49811},
            {'id': 50113},
            {'id': 50113},
            {'id': 50113},
            {'id': 50113},
            {'id': 49081},
            {'id': 49437},
            {'id': 141945},
            {'id': 50359},
            {'id': 26109},
            {'id': 50223},
            {'id': 34807},
            {'id': 29403},
            {'id': 34241},
            {'id': 32627},
            {'id': 25014},
            {'id': 33483},
            {'id': 35310},
            {'id': 32500}],
 'quantity': 2,
 'quoteName': u'DAL10-qty2-rand3106',
 'sshKeyIds': [{'sshKeyIds': [9876]}, {'sshKeyIds': [9876]}],
 'storageGroups': [{'arrayTypeId': 2, 'hardDrives': [0, 1]},
                   {'arrayTypeId': 5, 'hardDrives': [2, 3, 4, 5]}],
 'useHourlyPricing': False}

是的,如果您查看 SoftLayer_Container_Product_Order_Hardware_Server 容器的文档,您会看到这个 属性:

orderContainers

Orders may contain an array of configurations. Populating this property allows you to purchase multiple configurations within a single order. Each order container will have its own individual settings independent of the other order containers. For example, it is possible to order a bare metal server in one configuration and a virtual server in another. If orderContainers is populated on the base order container, most of the configuration-specific properties are ignored on the base container. For example, prices, location and packageId will be ignored on the base container, but since the billingInformation is a property that's not specific to a single order container (but the order as a whole) it must be populated on the base container.

所以您只需要为您的订单设置 属性,例如

    "orderContainers": [
            order1,
            order2
        ]

Note: replace order1 and order2 with the orders that you posted in your question

此致