I create one image template, and want to create a virtual server using this template. I can do this on WEB GUI. For rest api, I saw that operatingSystemReferenceCode is used to create virtual server. I think operatingSystemReferenceCode is different with image template.
I want to know which api is used when creating virtual server using image template and it's very nice of you to give an example. Thanks!
Well the easy way is using the createObject method, in that method you can pass the image that you want to use for more information see:
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/createObject
you just need to configure this property in the request:
here a RESTful example:
POST https://api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/createObject Payload:
Likely you are wondering how to get the globalIdentifier of the tamplate you want to use, well there are two types of images templates: private and public.
The private templates (the ones that you created) can be fetched using this method:
http://sldn.softlayer.com/reference/services/SoftLayer_Account/getBlockDeviceTemplateGroups
In another hand the public templates can be fetched using this method:
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest_Block_Device_Template_Group/getPublicImages
I hope it helps you
Regards