-1

I have been using the softlayer-api-client (.0.2.3), by using these API client I am able to order the virutal server in IBM softlayer cloud, then able to get the VM and list those VM. sample code below

Guest.Service service = Guest.service(client);

In the guest I am setting all VM related information, then place order

guest = service.createObject(guest);

while create VM, few of the default block device (disk) getting attached to the VM instance.

Do we have similar kind of RestApiClient service to Create/delete the additional volume?

please share the API to create the volume.

Let me know in case need further clarification for the same.

Fruchtzwerg
  • 10,999
  • 12
  • 40
  • 49
Subbiah
  • 11
  • 1

1 Answers1

0

in order to add or delete volumes to the VSI you need to upgrade/downgrade your machines, this process only can be achieve using the http://sldn.softlayer.com/reference/services/SoftLayer_Product_Order/placeOrder method:

this is an example using RESTFUL:

POST https://api.softlayer.com/rest/v3.1/SoftLayer_Product_Order/placeOrder

body: 
    {
        "parameters": [{
            "virtualGuests": [{
                "id": 49495232
            }],
            "prices": [{
                    "id": 2277,
                    "categories": [{
                        "categoryCode": "guest_disk1",
                        "complexType": "SoftLayer_Product_Item_Category"
                    }],
                    "complexType": "SoftLayer_Product_Item_Price"
                },

                {
                    "id": 2270,
                    "categories": [{
                        "categoryCode": "guest_disk2",
                        "complexType": "SoftLayer_Product_Item_Category"
                    }],
                    "complexType": "SoftLayer_Product_Item_Price"
                }
            ],
            "properties": [

                {
                    "name": "NOTE_GENERAL",
                    "value": "adding disks"
                },

                {
                    "name": "MAINTENANCE_WINDOW",
                    "value": "2014-08-25T9:50:00-05:00"
                }
            ],
            "complexType": "SoftLayer_Container_Product_Order_Virtual_Guest_Upgrade"
        }]
    }

I do not have at hand an example using the Java but the idea is the same you need to send all of data (If you have troubles with the code in Java let me know and I will make the example in Java). Also you may be interested in this documentation about how the placeOrder method works http://sldn.softlayer.com/blog/bpotter/going-further-softlayer-api-python-client-part-3