Provisioning of VMs - retrieve IP information


On my use case I am driving the provisioning of VMs using a Jenkins pipeline; for this reason I am only allowed to use the Rest API.
I am able to order a service, follow the service request generated and check when the request has been finished. Using the services API I can expand the VM resources (api/services/?expand=resources&attributes=vms) and check the information about the VMs – but I am unable to visualise the information about which IP was assigned to the VM.
This same information is available using the UI, so it seems that the problem may lie in not exposing this information over the API.

Is it possible to get the information about a VM IP address in any other way?

Thank you,

Have you found a way to retrieve IP address of created VM?

I’ve found the solution for that. May be will help for someone else. Sample query:

1 Like

Hey @jcornell - does this sound about right?

@abellotti Can you help out here?

This is the right approach, querying additional information about vms using virtual attributes, in this case ipaddresses. If you have the vm id, a:

GET /api/vms/:id?attributes=ipaddresses

would do, if you need to search by name, instead of querying all vms,

GET /api/vms?filter[]="name='pattern'"&expand=resources&attributes=ipaddresses

would also work. Other virtual attributes and relationships of vms can also be queried as needed with attributes as a comma seperated list.

Should this retrieve ip-address using rest work ?

if I query like this:

uri = “https://admin:xxxxx@,ipaddresses

I’ll get answer:

“id” => “”,
“name” => “foobar”

Same results…it looks like REST API is buggy.

Without this basic information we cannot go farther…

The “id” returned is the old signature, should just be an integer. What version of the API are you running ? Do a GET of /api for that information. The virtual attributes were added to v2.0.0.

Anand version use 1.0 ? Is 2.0 added to botvinnik release ?

I have tested with Botvinnik RC3 and it works.