How to associate an Ip Address with an interface for a given device via API

32 views
Skip to first unread message

gav....@coinbase.com

unread,
Feb 4, 2019, 12:05:16 PM2/4/19
to NetBox
Hi,

I'm trying to figure out the endpoint to use to associate an IP address with a interface via the API.

I figure first I must find the IP address object so I can get it's id 

next I find the interface id for the Management interface on the device I want to associate the IP with

So now I have both the IP address ID and the interface ID.

Any ideas which endpoint I use to complete the association.

Thanks

Gav

Brian Candler

unread,
Feb 4, 2019, 12:44:50 PM2/4/19
to NetBox
Interface is an attribute of the IPAddress model; so you should be able to set interface id on the IP address object.

If you go to the API browser (/api/docs/ on a running instance) you may find this helpful. Scroll down to PATCH /api/ipam/ip-addresses/{id}/
Reply all
Reply to author
Forward
0 new messages