createObject


SoftLayer_Hardware::createObject

Create a new server

Description

createObject() enables the creation of servers on an account. This method is a simplified alternative to interacting with the ordering system directly.

In order to create a server, a template object must be sent in with a few required values.

When this method returns an order will have been placed for a server of the specified configuration.

To determine when the server is available you can poll the server via SoftLayer_Hardware::getObject, checking the provisionDate property. When provisionDate is not null, the server will be ready. Be sure to use the globalIdentifier as your initialization parameter.

Warning: Servers created via this method will incur charges on your account. For testing input parameters see SoftLayer_Hardware::generateOrderTemplate.

Input - SoftLayer_Hardware

  • hostname
    Hostname for the server.
    • Required
    • Type - string

  • domain
    Domain for the server.
    • Required
    • Type - string

  • processorCoreAmount
    The number of logical CPU cores to allocate.
    • Required
    • Type - int
    • See [SoftLayer_Hardware::getCreateObjectOptions](/reference/services/SoftLayer_Hardware/getCreateObjectOptions) for available options.

  • memoryCapacity
    The amount of memory to allocate in gigabytes.
    • Required
    • Type - int
    • See [SoftLayer_Hardware::getCreateObjectOptions](/reference/services/SoftLayer_Hardware/getCreateObjectOptions) for available options.

  • hourlyBillingFlag
    Specifies the billing type for the server.
    • Required
    • Type - boolean
    • When true the server will be billed on hourly usage, otherwise it will be billed on a monthly basis.

  • operatingSystemReferenceCode
    An identifier for the operating system to provision the server with.
    • Required
    • Type - string
    • See [SoftLayer_Hardware::getCreateObjectOptions](/reference/services/SoftLayer_Hardware/getCreateObjectOptions) for available options.

  • datacenter.name
    Specifies which datacenter the server is to be provisioned in.
    • Required
    • Type - string
    • The datacenter property is a [SoftLayer_Location](/reference/datatypes/SoftLayer_Location) structure with the name field set.
    • See [SoftLayer_Hardware::getCreateObjectOptions](/reference/services/SoftLayer_Hardware/getCreateObjectOptions) for available options.
    { "datacenter": { "name": "dal05" } }
  • networkComponents.maxSpeed
    Specifies the connection speed for the server's network components.
    • Optional
    • Type - int
    • Default - The highest available zero cost port speed will be used.
    • Description - The networkComponents property is an array with a single [SoftLayer_Network_Component](/reference/datatypes/SoftLayer_Network_Component) structure. The maxSpeed property must be set to specify the network uplink speed, in megabits per second, of the server.
    • See [SoftLayer_Hardware::getCreateObjectOptions](/reference/services/SoftLayer_Hardware/getCreateObjectOptions) for available options.
    { "networkComponents": [ { "maxSpeed": 1000 } ] }
  • networkComponents.redundancyEnabledFlag
    Specifies whether or not the server's network components should be in redundancy groups.
    • Optional
    • Type - bool
    • Default - false
    • Description - The networkComponents property is an array with a single [SoftLayer_Network_Component](/reference/datatypes/SoftLayer_Network_Component) structure. When the redundancyEnabledFlag property is true the server's network components will be in redundancy groups.
    { "networkComponents": [ { "redundancyEnabledFlag": false } ] }
  • privateNetworkOnlyFlag
    Specifies whether or not the server only has access to the private network
    • Optional
    • Type - boolean
    • Default - false
    • When true this flag specifies that a server is to only have access to the private network.

  • primaryNetworkComponent.networkVlan.id
    Specifies the network vlan which is to be used for the frontend interface of the server.
    • Optional
    • Type - int
    • Description - The primaryNetworkComponent property is a [SoftLayer_Network_Component](/reference/datatypes/SoftLayer_Network_Component) structure with the networkVlan property populated with a [SoftLayer_Network_Vlan](/reference/datatypes/SoftLayer_Network_Vlan) structure. The id property must be set to specify the frontend network vlan of the server.
    { "primaryNetworkComponent": { "networkVlan": { "id": 1 } } }
  • primaryBackendNetworkComponent.networkVlan.id
    Specifies the network vlan which is to be used for the backend interface of the server.
    • Optional
    • Type - int
    • Description - The primaryBackendNetworkComponent property is a [SoftLayer_Network_Component](/reference/datatypes/SoftLayer_Network_Component) structure with the networkVlan property populated with a [SoftLayer_Network_Vlan](/reference/datatypes/SoftLayer_Network_Vlan) structure. The id property must be set to specify the backend network vlan of the server.
    { "primaryBackendNetworkComponent": { "networkVlan": { "id": 2 } } }
  • fixedConfigurationPreset.keyName
    • Optional
    • Type - string
    • Description - The fixedConfigurationPreset property is a [SoftLayer_Product_Package_Preset](/reference/datatypes/SoftLayer_Product_Package_Preset) structure. The keyName property must be set to specify preset to use.
    • If a fixed configuration preset is used processorCoreAmount, memoryCapacity and hardDrives properties must not be set.
    • See [SoftLayer_Hardware::getCreateObjectOptions](/reference/services/SoftLayer_Hardware/getCreateObjectOptions) for available options.
    { "fixedConfigurationPreset": { "keyName": "SOME_KEY_NAME" } }
  • userData.value
    Arbitrary data to be made available to the server.
    • Optional
    • Type - string
    • Description - The userData property is an array with a single [SoftLayer_Hardware_Attribute](/reference/datatypes/SoftLayer_Hardware_Attribute) structure with the value property set to an arbitrary value.
    • This value can be retrieved via the [SoftLayer_Resource_Metadata::getUserMetadata](/reference/services/SoftLayer_Resource_Metadata/getUserMetadata) method from a request originating from the server. This is primarily useful for providing data to software that may be on the server and configured to execute upon first boot.
    { "userData": [ { "value": "someValue" } ] }
  • hardDrives
    Hard drive settings for the server
    • Optional
    • Type - SoftLayer_Hardware_Component
    • Default - The largest available capacity for a zero cost primary disk will be used.
    • Description - The hardDrives property is an array of [SoftLayer_Hardware_Component](/reference/datatypes/SoftLayer_Hardware_Component) structures.
    • Each hard drive must specify the capacity property.
    • See [SoftLayer_Hardware::getCreateObjectOptions](/reference/services/SoftLayer_Hardware/getCreateObjectOptions) for available options.
    { "hardDrives": [ { "capacity": 500 } ] }
  • sshKeys
    SSH keys to install on the server upon provisioning.
    • Optional
    • Type - array of [SoftLayer_Security_Ssh_Key](/reference/datatypes/SoftLayer_Security_Ssh_Key)
    • Description - The sshKeys property is an array of [SoftLayer_Security_Ssh_Key](/reference/datatypes/SoftLayer_Security_Ssh_Key) structures with the id property set to the value of an existing SSH key.
    • To create a new SSH key, call [SoftLayer_Security_Ssh_Key::createObject](/reference/services/SoftLayer_Security_Ssh_Key/createObject) on the [SoftLayer_Security_Ssh_Key](/reference/datatypes/SoftLayer_Security_Ssh_Key) service.
    • To obtain a list of existing SSH keys, call [SoftLayer_Account::getSshKeys](/reference/services/SoftLayer_Account/getSshKeys) on the [SoftLayer_Account](/reference/datatypes/SoftLayer_Account) service.
    { "sshKeys": [ { "id": 123 } ] }
  • postInstallScriptUri
    Specifies the uri location of the script to be downloaded and run after installation is complete.
    • Optional
    • Type - string

REST Example

curl -X POST -d '{ "parameters":[ { "hostname": "host1", "domain": "example.com", "processorCoreAmount": 2, "memoryCapacity": 2, "hourlyBillingFlag": true, "operatingSystemReferenceCode": "UBUNTU_LATEST" } ] }' https://api.softlayer.com/rest/v3/SoftLayer_Hardware.json HTTP/1.1 201 Created Location: https://api.softlayer.com/rest/v3/SoftLayer_Hardware/f5a3fcff-db1d-4b7c-9fa0-0349e41c29c5/getObject

{ “accountId”: 232298, “bareMetalInstanceFlag”: null, “domain”: “example.com”, “hardwareStatusId”: null, “hostname”: “host1”, “id”: null, “serviceProviderId”: null, “serviceProviderResourceId”: null, “globalIdentifier”: “f5a3fcff-db1d-4b7c-9fa0-0349e41c29c5”, “hourlyBillingFlag”: true, “memoryCapacity”: 2, “operatingSystemReferenceCode”: “UBUNTU_LATEST”, “processorCoreAmount”: 2 }


Parameters

Name Type Description
templateObject SoftLayer_Hardware The SoftLayer_Hardware object that you wish to create.

Required Headers

Optional Headers

Return Values

Associated Methods

curl -g -u $SL_USER:$SL_APIKEY -X POST -d '{"parameters": [SoftLayer_Hardware]}' \
'https://api.softlayer.com/rest/v3.1/SoftLayer_Hardware/createObject'