0

I'm using 'SoftLayer_Hardware', 'createObject' to deploy new servers, however this call returns no id, as on the example on http://sldn.softlayer.com/reference/services/SoftLayer_Hardware/createObject

So if I have no id how can I query info for that server? I noticed there's a globalIdentifier variable but no mention at all on what it is and how to use it

3 Answers3

0

you can use the goblal identifier instead the ID in your request

e.g.

Get https://api.softlayer.com/rest/v3.1/SoftLayer_Hardware/$GloblalIdentifier/getObject

Note: replace the $GloblalIdentifier

The reason why the id is not displayed is because the server was not created yet, your order has to be approved and when the provisioning is ended the id will show up, meanwhile you can use the global identifier when the provisioning ends you will be able to see the id

regards

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
0

Here SoftLayer_Hardware::createObject says:

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.

Please see this example:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Hardware/[globalIdentifier_value]/getObject

Method: GET

Also, you can get Bare Metal information using SoftLayer_Account::getHardware with some filters:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getHardware?objectFilter={"hardware":{"hostname":{"operation": "myhostname"}, "domain":{"operation": "mydomain"}}}&objectMask=mask[id,fullyQualifiedDomainName,provisionDate]
Method: GET

Note: You can add some masks in order to get more information than by default, i.e. In the previous request you can see the provisionDate(When provisionDate is not null, the server will be ready).

List Bare metal servers filtering by username who created them:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getHardware?objectFilter={   "hardware": {     "billingItem": {       "orderItem": {         "order": {           "userRecord": {             "username": {               "operation": "myusername"             }           }         }       }     }   } }&objectMask=mask[id,fullyQualifiedDomainName,billingItem.orderItem.order.userRecord.username,provisionDate]
Method: GET

Also you can review:

Softlayer API to get virtual guest owner

Community
  • 1
  • 1
mcruz
  • 1,534
  • 2
  • 11
  • 14
-1

thank you for your answers. Unfortunately this is a chicken/egg problem. Once the API call is sent, I get an GloblalIdentifier but not an id.

If I ask for this GloblalIdentifier I get a response with id as null

If I get the listing of the hardware servers, I see the new machine is there, has an id, but the GloblalIdentifier is None.

Makes no sense.

  • I updated my answer, but when the provisioning proccess ends you will see that id will change from null to his value.only when the provisioning proccess ends the id is updated. so you can use that behavior in order to know when your sever is ready. the another approach is listing your servers and look for your server and review its transactions in order to know if it is ready. – Nelson Raul Cabero Mendoza Mar 04 '16 at 13:30
  • And just in case when the provisioning proccess ends, you will see that the global identifier and id are updated in blth sides (listing the servers and getting the object using the globalidentifier) – Nelson Raul Cabero Mendoza Mar 04 '16 at 13:46