API filter of assigned_object_id fails, but nbshell is correct #9308

Closed
opened 2025-12-29 20:48:11 +01:00 by adam · 3 comments
Owner

Originally created by @josh-belwave on GitHub (Feb 29, 2024).

Deployment Type

Self-hosted

NetBox Version

v3.7.2

Python Version

3.8

Steps to Reproduce

curl -X GET "https://netbox.example.com/api/ipam/ip-addresses/?assigned_object_id=5597" -H "Authorization: Token "

nbshell#

IPAddress.objects.filter(assigned_object_id='5597')
<RestrictedQuerySet [<IPAddress: x.x.x.x/32>]>

Expected Behavior

API call should be the same filtered result

Observed Behavior

curl statement returns all ip-addresses

nbshell provides correct filtered data

Originally created by @josh-belwave on GitHub (Feb 29, 2024). ### Deployment Type Self-hosted ### NetBox Version v3.7.2 ### Python Version 3.8 ### Steps to Reproduce curl -X GET "https://netbox.example.com/api/ipam/ip-addresses/?assigned_object_id=5597" -H "Authorization: Token <redacted>" nbshell# >>> IPAddress.objects.filter(assigned_object_id='5597') <RestrictedQuerySet [<IPAddress: x.x.x.x/32>]> ### Expected Behavior API call should be the same filtered result ### Observed Behavior curl statement returns all ip-addresses nbshell provides correct filtered data
adam closed this issue 2025-12-29 20:48:11 +01:00
Author
Owner

@josh-belwave commented on GitHub (Feb 29, 2024):

I stumbled on this issue with the following function using pynetbox:

ip_obj = netbox.ipam.ip_addresses.filter(assigned_object_id=loopback_interface.id)

@josh-belwave commented on GitHub (Feb 29, 2024): I stumbled on this issue with the following function using pynetbox: ip_obj = netbox.ipam.ip_addresses.filter(assigned_object_id=loopback_interface.id)
Author
Owner

@jeremystretch commented on GitHub (Feb 29, 2024):

URL query parameters and Python ORM filters are entirely different. Please consult the API documentation to determine what filters are supported for each type of object.

@jeremystretch commented on GitHub (Feb 29, 2024): URL query parameters and Python ORM filters are entirely different. Please consult the API documentation to determine what filters are supported for each type of object.
Author
Owner

@josh-belwave commented on GitHub (Feb 29, 2024):

I’ve looked through the doc’s can you provide a link that shows these supported filters?

On Feb 29, 2024, at 6:57 AM, Jeremy Stretch @.***> wrote:



URL query parameters and Python ORM filters are entirely different. Please consult the API documentation to determine what filters are supported for each type of object.


Reply to this email directly, view it on GitHubhttps://github.com/netbox-community/netbox/issues/15309#issuecomment-1971084523, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BEZHM6C63W2UUXBLMUBKS53YV4STBAVCNFSM6AAAAABD7GZ6NSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZRGA4DINJSGM.
You are receiving this because you authored the thread.Message ID: @.***>

@josh-belwave commented on GitHub (Feb 29, 2024): I’ve looked through the doc’s can you provide a link that shows these supported filters? On Feb 29, 2024, at 6:57 AM, Jeremy Stretch ***@***.***> wrote:  URL query parameters and Python ORM filters are entirely different. Please consult the API documentation to determine what filters are supported for each type of object. — Reply to this email directly, view it on GitHub<https://github.com/netbox-community/netbox/issues/15309#issuecomment-1971084523>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BEZHM6C63W2UUXBLMUBKS53YV4STBAVCNFSM6AAAAABD7GZ6NSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZRGA4DINJSGM>. You are receiving this because you authored the thread.Message ID: ***@***.***>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9308