softlayer api: How to order Public Secondary IP Addresses when I ordering?
I have order a virtual machine with 8 secondary ip address. by using api, how can I retrive the 8 secondary ip address.
softlayer api: How to order Public Secondary IP Addresses when I ordering?
I have order a virtual machine with 8 secondary ip address. by using api, how can I retrive the 8 secondary ip address.
An Answer Given on SO itself contains your answer :
Order Virtual Guest with a Secondary Public Ip Address
Below is an example in REST to order a virtual guest with a secondary ip address and two first questions in the form.
Note: Don't forget change [username], [apikey], prices, and other ids with your own data
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Product_Order/verifyOrder Method: POST Body JSON: { "parameters":[ { "complexType": "SoftLayer_Container_Product_Order_Virtual_Guest", "packageId": 46, "location": "AMSTERDAM", "quantity": 1, "prices":[ {"id":14640}, {"id":11644}, {"id":9205}, {"id":22272}, {"id":52231}, {"id":21}, {"id":2202}, {"id":13945}, {"id":55}, {"id":57}, {"id":58}, {"id":420}, {"id":418}, {"id":22} ], "virtualGuests":[ { "hostname": "test", "domain": "example.com" } ], "itemCategoryQuestionAnswers":[ { "answer": "2", "categoryId": 14, "questionId": 14 }, { "answer": "4", "categoryId": 14, "questionId": 15 } ] } ] }
Note : Please Refer to this Question for more detailed answer.
You may retrieve the list required by using Network_Subnet::getIpAddresses method. Please try the following REST request:
https://$username:$apiKey@api.softlayer.com/rest/v3.1/SoftLayer_Network_Subnet/$subnetId/getIpAddresses?objectMask=mask[ipAddress, note, id, subnetId]
The code above is using objectMasks to display only what portal shows you, as in this case, your 8 or any number of Ip Addresses on a specific subnet, remember to change the first $username:$apikey values for valid credentials, and also the $subnetId identifier.
UPDATE: You may search the subnet Id of of a VSI by using:
SoftLayer_Virtual_Guest::getObject
https://$username:$apiKey@api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/$virtualGuestId/getObject?objectMask=mask[accountId,fullyQualifiedDomainName,primaryIpAddress,hostname,domain,frontendNetworkComponents[guestId,primaryIpAddress,subnets[id]]]
Remember to change the $virtualGuestId for your VSI id value.
For more information please see below: