Include service ID with Virtual Machines #1268

Closed
opened 2025-12-29 16:30:55 +01:00 by adam · 2 comments
Owner

Originally created by @mastermindg on GitHub (Sep 28, 2017).

Issue type

[ ] Feature request
[x] Bug report
[ ] Documentation

Environment

  • Python version: 2.7
  • NetBox version: v2.2-beta1

Description

I'm running 2.2beta and I'm trying to pull out virtual machine information from the API. I would like a service id included as part of the return from a virtual-machines API request.

When I submit this request:

curl 'http://localhost/api/virtualization/virtual-machines/16/'

I get the following results:

{"id"=>16, "name"=>"db-b", "status"=>{"value"=>1, "label"=>"Active"}, "cluster"=>{"id"=>1, "url"=>"http://localhost/api/virtualization/clusters/1/", "name"=>"KVMSQL1"}, "tenant"=>nil, "platform"=>{"id"=>2, "url"=>"http://localhost/api/dcim/platforms/2/", "name"=>"Centos", "slug"=>"centos"}, "primary_ip4"=>3, "primary_ip6"=>nil, "comments"=>"", "custom_fields"=>{}}
From these results there is no mention of the existing service that is attached to this virtual machine:

screenshot at sep 27 23-12-01
Originally created by @mastermindg on GitHub (Sep 28, 2017). # Issue type [ ] Feature request [x] Bug report [ ] Documentation # Environment - Python version: 2.7 - NetBox version: v2.2-beta1 # Description I'm running 2.2beta and I'm trying to pull out virtual machine information from the API. I would like a service id included as part of the return from a virtual-machines API request. When I submit this request: `curl 'http://localhost/api/virtualization/virtual-machines/16/'` I get the following results: `{"id"=>16, "name"=>"db-b", "status"=>{"value"=>1, "label"=>"Active"}, "cluster"=>{"id"=>1, "url"=>"http://localhost/api/virtualization/clusters/1/", "name"=>"KVMSQL1"}, "tenant"=>nil, "platform"=>{"id"=>2, "url"=>"http://localhost/api/dcim/platforms/2/", "name"=>"Centos", "slug"=>"centos"}, "primary_ip4"=>3, "primary_ip6"=>nil, "comments"=>"", "custom_fields"=>{}} ` From these results there is no mention of the existing service that is attached to this virtual machine: <img width="439" alt="screenshot at sep 27 23-12-01" src="https://user-images.githubusercontent.com/5431723/30947813-de0b67ac-a3d9-11e7-82e9-bc5666398db0.png">
adam added the type: bug label 2025-12-29 16:30:55 +01:00
adam closed this issue 2025-12-29 16:30:56 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 28, 2017):

As with devices, services aren't included in the API representation of a virtual machine: you'll need to retrieve and filter those via the services endpoint:

GET /api/ipam/services/?virtual_machine_id=123

However, we are missing the filter to accomplish this. I'll add it.

@jeremystretch commented on GitHub (Sep 28, 2017): As with devices, services aren't included in the API representation of a virtual machine: you'll need to retrieve and filter those via the services endpoint: `GET /api/ipam/services/?virtual_machine_id=123` However, we are missing the filter to accomplish this. I'll add it.
Author
Owner

@jeremystretch commented on GitHub (Sep 28, 2017):

Fixed in 0ea58ab

@jeremystretch commented on GitHub (Sep 28, 2017): Fixed in 0ea58ab
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1268