Network Speed - How to find the ID from getItemPri

2019-08-12 06:06发布

I am following the below steps to increase the network maxspeed to 1 gbps,

  1. Find the package ID using the API:

    https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/$vsi/getObject?objectMask=mask[billingItem[package]]
    
  2. Next I need to get the Item price ID for 1 gbps speed and using following API:

    https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Package/$packageId/getItemPrices
    

This is where am stuck as am not aware which ID needs to selected from this output. I need to increase the speed to 1gbps (private network). I see more than one ID for this in the output.

I'd like some help in identifying the right ID so I can proceed to increase max speed with a upgrade request.

1条回答
The star\"
2楼-- · 2019-08-12 06:40

This request will help you to get valid item prices to upgrade your Virtual Server:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/[vsi_id]/getUpgradeItemPrices
Method: GET

In the result should display something like this:

{
"currentPriceFlag": false
"hourlyRecurringFee": ".04"
"id": 274
"itemId": 188
"laborFee": "0"
"locationGroupId": null
"onSaleFlag": null
"oneTimeFee": "0"
"quantity": null
"recurringFee": "20"
"setupFee": "0"
"sort": 3
"accountRestrictions": [0]
"categories": [1]
0:  {
"categoryCode": "port_speed"
"id": 26
"name": "Uplink Port Speeds"
"quantityLimit": 0
}-
-
"item": {
"capacity": "1000"
"description": "1 Gbps Public & Private Network Uplinks"
"id": 188
"itemTaxCategoryId": 166
"keyName": "1_GBPS_PUBLIC_PRIVATE_NETWORK_UPLINKS"
"softwareDescriptionId": null
"units": "Mbps"
"upgradeItemId": null
"attributes": [0]
}-
}

The id that we need is 274 (Using a Test Account and valid for my VSI) Now, to upgrade the Virtual Guest, please execute:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Product_Order/verifyOrder

Method: POST

{
  "parameters": [
    {
      "complexType": "SoftLayer_Container_Product_Order_Virtual_Guest_Upgrade",
      "prices": [
        {
          "id": 274
        }
      ],
      "virtualGuests": [
        {
          "id": 11498369
        }
      ],
      "properties": [
        {
          "name": "NOTE_GENERAL",
          "value": "upgrading speed"
        },
        {
          "name": "MAINTENANCE_WINDOW",
          "value": "2015-10-05T9:00:00-05:00"
        }
      ]
    }
  ]
}

Where: “11498369” is the vsi_id to upgrade

Reference: Modify Device Configuration

Then, if you want to change the private/public network interface speed to the new speed: Execute (Example for private network speed):

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Virtual_Guest/[vsi_id]/setPrivateNetworkInterfaceSpeed.json

Method: POST
{
    "parameters": [    
      10
    ]
}

References:

http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/setPrivateNetworkInterfaceSpeed

http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/setPublicNetworkInterfaceSpeed

查看更多
登录 后发表回答