GraphQL not showing interface_id in fhrp_group_list query #7752

Closed
opened 2025-12-29 20:27:48 +01:00 by adam · 1 comment
Owner

Originally created by @marcosmas28 on GitHub (Mar 13, 2023).

NetBox version

v3.4.5

Python version

3.8

Steps to Reproduce

  1. Open the Netbox GraphQL API page (http://<netbox_ip>/graphql)
  2. Enter the following query to list all FHRP groups and their assigned intrfaces:
{
  fhrp_group_list {
    group_id
    fhrpgroupassignment_set {
      interface_id
    }
  }
}

Expected Behavior

The expected result is the following (as per in Netbox v3.2.7):

{
  "data": {
    "fhrp_group_list": [
      {
        "group_id": 10,
        "fhrpgroupassignment_set": [
          {
            "interface_id": 74
          },
          {
            "interface_id": 73
          }
        ]
      }
    ]
  }
}

Observed Behavior

{
  "errors": [
    {
      "message": "Cannot query field 'interface_id' on type 'FHRPGroupAssignmentType'. Did you mean 'interface'?",
      "locations": [
        {
          "line": 5,
          "column": 7
        }
      ]
    }
  ]
}
Originally created by @marcosmas28 on GitHub (Mar 13, 2023). ### NetBox version v3.4.5 ### Python version 3.8 ### Steps to Reproduce 1. Open the Netbox GraphQL API page (http://<netbox_ip>/graphql) 2. Enter the following query to list all FHRP groups and their assigned intrfaces: ``` { fhrp_group_list { group_id fhrpgroupassignment_set { interface_id } } } ``` ### Expected Behavior The expected result is the following (as per in Netbox v3.2.7): ``` { "data": { "fhrp_group_list": [ { "group_id": 10, "fhrpgroupassignment_set": [ { "interface_id": 74 }, { "interface_id": 73 } ] } ] } } ``` ### Observed Behavior ``` { "errors": [ { "message": "Cannot query field 'interface_id' on type 'FHRPGroupAssignmentType'. Did you mean 'interface'?", "locations": [ { "line": 5, "column": 7 } ] } ] } ```
adam added the type: bugstatus: needs owner labels 2025-12-29 20:27:48 +01:00
adam closed this issue 2025-12-29 20:27:48 +01:00
Author
Owner

@arthanson commented on GitHub (Mar 20, 2023):

@marcosmas28
Not a bug - nested interfaces are now returned as the interface object (the type depending on the interface type. You can query them using inline fragments (https://graphql.org/learn/queries/#inline-fragments). If you need to enumerate the types that are returned you can use __typename:

{
  fhrp_group_list {
    group_id
    fhrpgroupassignment_set {
        interface {
            __typename
        }
    }
  }
}

Once you have the type you can reference each of them via a fragment:

{
  fhrp_group_list {
    group_id
    fhrpgroupassignment_set {
        interface {
            ... on type1 {
                id
            }
            ... on type2 {
                id
            }
        }
    }
  }
}

Note: In the above "Type1" and "Type2" would be replaced with the type names returned via the earlier query. Please let me know if that isn't clear.

@arthanson commented on GitHub (Mar 20, 2023): @marcosmas28 Not a bug - nested interfaces are now returned as the interface object (the type depending on the interface type. You can query them using inline fragments (https://graphql.org/learn/queries/#inline-fragments). If you need to enumerate the types that are returned you can use __typename: ``` { fhrp_group_list { group_id fhrpgroupassignment_set { interface { __typename } } } } ``` Once you have the type you can reference each of them via a fragment: ``` { fhrp_group_list { group_id fhrpgroupassignment_set { interface { ... on type1 { id } ... on type2 { id } } } } } ``` Note: In the above "Type1" and "Type2" would be replaced with the type names returned via the earlier query. Please let me know if that isn't clear.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7752