Replies: 2 comments
-
My understanding is that custom_fields are stored as a JSON blob in the DB and their contents may be opaque to GraphQL
—
Mark Tinberg ***@***.***>
Division of Information Technology-Network Services
University of Wisconsin-Madison
…________________________________
From: Tadas Ustinavičius ***@***.***>
Sent: Monday, September 25, 2023 11:24 PM
To: netbox-community/netbox ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [netbox-community/netbox] Graphql filtering out custom fields results (Discussion #13894)
Hello,
it seems that I can't find the way to filter out results from custom fields while using graphql.
For example:
curl -H "Authorization: Token $TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" http://netbox.local/graphql/ --data '{"query": "query {device_list(name:\"test.server\") {name custom_fields}}"}'
returns device name and all custom fields. But if i want to return only speciffic field it does not work:
curl -H "Authorization: Token $TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" http://netbox.local/graphql/ --data '{"query": "query {device_list(name:\"test.server\") {name custom_fields{ price }}}"}'
{
"errors": [
{
"message": "Field 'custom_fields' must not have a selection since type 'GenericScalar' has no subfields.",
"locations": [
{
"line": 1,
"column": 65
}
]
}
]
}
Is this kind of filtering is possible at all?
Thank you.
—
Reply to this email directly, view it on GitHub<#13894>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAS7UM3ZZDTP3O7G2H3ASKDX4JKIPANCNFSM6AAAAAA5HB6UZU>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Seitanas
-
Well that's unfortunate. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
it seems that I can't find the way to filter out results from custom fields while using graphql.
For example:
returns device name and all custom fields. But if i want to return only speciffic field it does not work:
Is this kind of filtering is possible at all?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions