ipam/services: GET parent_object_type - wrong data type - integer #11715

Closed
opened 2025-12-29 21:48:55 +01:00 by adam · 4 comments
Owner

Originally created by @cernymi on GitHub (Oct 10, 2025).

Originally assigned to: @pheus on GitHub.

NetBox Edition

NetBox Community

NetBox Version

v4.3.0 and never

Python Version

3.12

Steps to Reproduce

  1. Create virtual machine (in exapmple used vm.id=361).

  2. Create service/application service for VM - POST is working fine ("parent_object_type": "string",)

curl -X 'POST' \
  'https://demo.netbox.dev/api/ipam/services/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'X-CSRFTOKEN: <X-CSRFTOKEN> \
  -d '{
  "parent_object_type": "virtualization.virtualmachine",
  "parent_object_id": 361,
  "name": "web_tcp_https",
  "protocol": "tcp",
  "ports": [
    443
  ],
  "ipaddresses": [
  ],
  "description": "web_tcp_https",
  "comments": "web_tcp_https",
  "tags": [
  ],
  "custom_fields": {
  }
}'
  1. Try to get query this service using parent_object_id and parent_object_type
curl -X 'GET' \
    'https://demo.netbox.dev/api/ipam/services/?parent_object_type=virtualization.virtualmachine&parent_object_id=361' \
    -H "Authorization: Token <Token>" \
    -H 'X-CSRFTOKEN: <CSRFTOKEN>'

Expected Behavior

PATH:           IPAM/SERVICES:
Method:         GET
Object:         parent_object_type
Data type:      integer -> string

Observed Behavior

Response is:

{"parent_object_type":["Select a valid choice. That choice is not one of the available choices."]}

or more detailed:

Please correct the following validation errors and try again. 
For 'parent_object_type': Value must be an integer.
Originally created by @cernymi on GitHub (Oct 10, 2025). Originally assigned to: @pheus on GitHub. ### NetBox Edition NetBox Community ### NetBox Version v4.3.0 and never ### Python Version 3.12 ### Steps to Reproduce 1. Create virtual machine (in exapmple used vm.id=361). 2. Create service/application service for VM - POST is working fine ("parent_object_type": "string",) ``` curl -X 'POST' \ 'https://demo.netbox.dev/api/ipam/services/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -H 'X-CSRFTOKEN: <X-CSRFTOKEN> \ -d '{ "parent_object_type": "virtualization.virtualmachine", "parent_object_id": 361, "name": "web_tcp_https", "protocol": "tcp", "ports": [ 443 ], "ipaddresses": [ ], "description": "web_tcp_https", "comments": "web_tcp_https", "tags": [ ], "custom_fields": { } }' ``` 3. Try to get query this service using `parent_object_id` and `parent_object_type` ``` curl -X 'GET' \ 'https://demo.netbox.dev/api/ipam/services/?parent_object_type=virtualization.virtualmachine&parent_object_id=361' \ -H "Authorization: Token <Token>" \ -H 'X-CSRFTOKEN: <CSRFTOKEN>' ``` ### Expected Behavior ``` PATH: IPAM/SERVICES: Method: GET Object: parent_object_type Data type: integer -> string ``` ### Observed Behavior Response is: ```{"parent_object_type":["Select a valid choice. That choice is not one of the available choices."]}``` or more detailed: ``` Please correct the following validation errors and try again. For 'parent_object_type': Value must be an integer. ```
adam added the type: bugstatus: acceptednetboxseverity: low labels 2025-12-29 21:48:55 +01:00
adam closed this issue 2025-12-29 21:48:55 +01:00
Author
Owner

@jnovinger commented on GitHub (Oct 10, 2025):

Thanks for the bug report, @cernymi !

@jnovinger commented on GitHub (Oct 10, 2025): Thanks for the bug report, @cernymi !
Author
Owner

@jnovinger commented on GitHub (Oct 10, 2025):

The same issue affects IPAddress.assigned_object_type and MACAddress.assigned_object_type filtering as well and should be fixed together.

Job.object_type is also affected, but not in the same way. Instead of returning the error, like above, the filter is silently ignored. Example: /api/core/jobs/?obect_type=dcim.interface returns multiple results, including those with a different object_type value.

@jnovinger commented on GitHub (Oct 10, 2025): The same issue affects `IPAddress.assigned_object_type` and `MACAddress.assigned_object_type` filtering as well and should be fixed together. `Job.object_type` is also affected, but not in the same way. Instead of returning the error, like above, the filter is silently ignored. Example: `/api/core/jobs/?obect_type=dcim.interface` returns multiple results, including those with a different `object_type` value.
Author
Owner

@pheus commented on GitHub (Oct 15, 2025):

I'd like to contribute the fix. Could you please assign the issue to me? Thanks!

@pheus commented on GitHub (Oct 15, 2025): I'd like to contribute the fix. Could you please assign the issue to me? Thanks!
Author
Owner

@jnovinger commented on GitHub (Oct 15, 2025):

Thanks, @pheus .

@jnovinger commented on GitHub (Oct 15, 2025): Thanks, @pheus .
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11715