Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I get all the interfaces for the device #67

Open
wilful opened this issue Mar 12, 2024 · 1 comment
Open

How do I get all the interfaces for the device #67

wilful opened this issue Mar 12, 2024 · 1 comment

Comments

@wilful
Copy link

wilful commented Mar 12, 2024

Hi, tell me how, having only the hostname (name/display), to get all the interfaces of the device with addresses?
In my case, I'm trying to use a device query and I get nil.

>> NetboxClientRuby.dcim.interfaces.find_by(device: 'brz-v-itmg-1')


I, [2024-03-12T23:14:48.133484 #73591]  INFO -- request: GET https://netbox.../api/dcim/interfaces.json?device=brz-v-itmg-1&limit=50
I, [2024-03-12T23:14:48.133513 #73591]  INFO -- request: Authorization: "Token ***"
User-Agent: "Faraday v1.10.3"
I, [2024-03-12T23:14:49.461606 #73591]  INFO -- response: Status 200
I, [2024-03-12T23:14:49.461814 #73591]  INFO -- response: content-type: "application/json"
vary: "HX-Request, Cookie, origin, Accept-Encoding"
allow: "GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, TRACE"
x-request-id: "1129bd3c-283c-49a0-9be5-14a6eefaf198"
x-content-type-options: "nosniff"
referrer-policy: "same-origin"
cross-origin-opener-policy: "same-origin"
x-frame-options: "SAMEORIGIN"
server: "envoy"
date: "Tue, 12 Mar 2024 20:14:49 GMT"
x-envoy-upstream-service-time: "862"
transfer-encoding: "chunked"
nil

But the same request in the console works and I get the necessary interfaces

curl -H "Authorization: Token ***" 'https://netbox.../api/dcim/interfaces.json?device=brz-v-itmg-1&limit=50' | jq
{
  "count": 7,
...
@shaneshort
Copy link

You want to use filter, not find_by, this tripped me up too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants