BUG Get contacts by group contacts filter #9178

Closed
opened 2025-12-29 20:46:37 +01:00 by adam · 13 comments
Owner

Originally created by @rickypid on GitHub (Feb 1, 2024).

Deployment Type

Self-hosted

NetBox Version

v3.7.0

Python Version

3.8

Steps to Reproduce

BUG Get contact by group contacts filter To reproduce the problem it is necessary to have a series of nested contact groups (In our case we get up to 3 deep)

Expected Behavior

Through the GET method with Netbox API we would like to obtain the members of a specific group using the group ID or the slug

Observed Behavior

In reality, however, the method does not correctly return the members of the specified group, both using the ID and the slug.

First contact is correct:

image

But the second i wrong:

image

Originally created by @rickypid on GitHub (Feb 1, 2024). ### Deployment Type Self-hosted ### NetBox Version v3.7.0 ### Python Version 3.8 ### Steps to Reproduce BUG Get contact by group contacts filter To reproduce the problem it is necessary to have a series of nested contact groups (In our case we get up to 3 deep) ### Expected Behavior Through the GET method with Netbox API we would like to obtain the members of a specific group using the group ID or the slug ### Observed Behavior In reality, however, the method does not correctly return the members of the specified group, both using the ID and the slug. First contact is correct: ![image](https://github.com/netbox-community/netbox/assets/19270983/26d3baea-58a9-494d-996f-9fdea780b5be) But the second i wrong: ![image](https://github.com/netbox-community/netbox/assets/19270983/e2d0559f-7c30-41f7-9882-f2d66dc97335)
adam added the type: bug label 2025-12-29 20:46:37 +01:00
adam closed this issue 2025-12-29 20:46:37 +01:00
Author
Owner

@DanSheps commented on GitHub (Feb 1, 2024):

Is group 140 a parent group of 147?

@DanSheps commented on GitHub (Feb 1, 2024): Is group 140 a parent group of 147?
Author
Owner

@DanSheps commented on GitHub (Feb 1, 2024):

Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.7.1. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.

@DanSheps commented on GitHub (Feb 1, 2024): Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v3.7.1. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.
Author
Owner

@DanSheps commented on GitHub (Feb 1, 2024):

Please do some more testing. I am closing this because:

  1. Your reproduction steps are insufficient
  2. Limited testing with the API shows there does not appear to be a bug
  3. You haven't tested against the latest version available
@DanSheps commented on GitHub (Feb 1, 2024): Please do some more testing. I am closing this because: 1. Your reproduction steps are insufficient 2. Limited testing with the API shows there does not appear to be a bug 3. You haven't tested against the latest version available
Author
Owner

@rickypid commented on GitHub (Feb 1, 2024):

Hi @DanSheps,

Thenk you for response,

No, this is the structure:

  • Group: Site A (ID: 50)
    • Group: [IT] Software consultant (ID: 140)
    • Group: [IT] Werehouse (ID: 147)

the problem also appears within the Netbox Web UI, the user count is incorrect in the contacts column.

In the contacts groups summary:

image

This is when I open the group (Netbox apply filter automatically):

image

At the bottom I find the correct members of this group who appear to me to be only 5 and not 17 (I am not attaching screenshots as they are correct).

@rickypid commented on GitHub (Feb 1, 2024): Hi @DanSheps, Thenk you for response, No, this is the structure: - Group: Site A (ID: 50) - Group: [IT] Software consultant (ID: 140) - Group: [IT] Werehouse (ID: 147) the problem also appears within the Netbox Web UI, the user count is incorrect in the `contacts` column. In the contacts groups summary: ![image](https://github.com/netbox-community/netbox/assets/19270983/c70b9a83-19da-494c-88f0-23137d26e192) This is when I open the group (Netbox apply filter automatically): ![image](https://github.com/netbox-community/netbox/assets/19270983/da446359-0f59-4b76-bd34-c0860e7d1757) At the bottom I find the correct members of this group who appear to me to be only 5 and not 17 (I am not attaching screenshots as they are correct).
Author
Owner

@DanSheps commented on GitHub (Feb 1, 2024):

This looks to be more a bug with your hierarchy, as I cannot reproduce it in develop.

How were these groups created?

@DanSheps commented on GitHub (Feb 1, 2024): This looks to be more a bug with your hierarchy, as I cannot reproduce it in develop. How were these groups created?
Author
Owner

@rickypid commented on GitHub (Feb 1, 2024):

The groups were created manually via Netbox's graphical interface, via API and a script we only deal with obtaining contacts with GET calls to the Netbox database.

I can say that the child groups were moved several times from one group to another during the reorganization.

After opening this issue I tried to replicate the problem without success. However, checking the contact groups affected by this problem are at least 3. I don't know what I can do to provide you with additional information or access data to be able to verify.

Last information, to provide you with a more correct context:

The movement of the groups was done with Netbox 3.6, subsequently updated to 3.7 hoping that it would solve the problem.

I remain available for further information.

@rickypid commented on GitHub (Feb 1, 2024): The groups were created manually via Netbox's graphical interface, via API and a script we only deal with obtaining contacts with GET calls to the Netbox database. I can say that the child groups were moved several times from one group to another during the reorganization. After opening this issue I tried to replicate the problem without success. However, checking the contact groups affected by this problem are at least 3. I don't know what I can do to provide you with additional information or access data to be able to verify. Last information, to provide you with a more correct context: The movement of the groups was done with Netbox `3.6`, subsequently updated to `3.7` hoping that it would solve the problem. I remain available for further information.
Author
Owner

@rickypid commented on GitHub (Feb 8, 2024):

I @DanSheps ,

I noticed this in swagger:

image

image

Is it normal that where the slug is requested there is an array of integers? Could this be the problem?

@rickypid commented on GitHub (Feb 8, 2024): I @DanSheps , I noticed this in swagger: ![image](https://github.com/netbox-community/netbox/assets/19270983/9640e5f4-5402-4cc1-bdea-aaa6f282b1ac) ![image](https://github.com/netbox-community/netbox/assets/19270983/08647284-086e-4fc5-ae82-ee842a531239) Is it normal that where the slug is requested there is an array of integers? Could this be the problem?
Author
Owner

@DanSheps commented on GitHub (Feb 8, 2024):

Was the movement done by script?

@DanSheps commented on GitHub (Feb 8, 2024): Was the movement done by script?
Author
Owner

@rickypid commented on GitHub (Feb 8, 2024):

Sorry @DanSheps , i didn't understand your request.

@rickypid commented on GitHub (Feb 8, 2024): Sorry @DanSheps , i didn't understand your request.
Author
Owner

@DanSheps commented on GitHub (Feb 8, 2024):

When you re-ordered the groups, was it done in the UI or the script?

@DanSheps commented on GitHub (Feb 8, 2024): When you re-ordered the groups, was it done in the UI or the script?
Author
Owner

@rickypid commented on GitHub (Feb 8, 2024):

I did the reordering of the contact groups from the graphical interface, our script only executes GET, no POST, PUT, etc.. consequently we are not going to edit data.

@rickypid commented on GitHub (Feb 8, 2024): I did the reordering of the contact groups from the graphical interface, our script only executes GET, no POST, PUT, etc.. consequently we are not going to edit data.
Author
Owner

@DanSheps commented on GitHub (Feb 8, 2024):

I would try to re-order some of the groups (temporarily make them flat then re-structure them).

Likely something got messed up with building the MPTT tree. However this would be something we would need to report upstream and without being able to reproduce it, it isn't something we can report unfortunately.

@DanSheps commented on GitHub (Feb 8, 2024): I would try to re-order some of the groups (temporarily make them flat then re-structure them). Likely something got messed up with building the MPTT tree. However this would be something we would need to report upstream and without being able to reproduce it, it isn't something we can report unfortunately.
Author
Owner

@rickypid commented on GitHub (Feb 8, 2024):

the only thing that still seems strange to me is the integer data type on the slug string filter. beam or should it be string type?

@rickypid commented on GitHub (Feb 8, 2024): the only thing that still seems strange to me is the integer data type on the slug string filter. beam or should it be string type?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9178