Add next 10 available IPs?

61 views
Skip to first unread message

Han Chen

unread,
Mar 28, 2019, 7:10:55 PM3/28/19
to NetBox
Hi, my app is trying to reserve a number of available IPs in bulk, I'm trying the available-ips API and it can only add ONE IP at a time. Is there another API to reserve say next 10 available IPs? Calling this API 10 times may not be performant. Is there a better way to do that?

curl -X POST \
  -H 'Accept: application/json' \
  -H 'Authorization: Token 0123456789abcdef0123456789abcdef01234567' \
  -H 'Content-Type: application/json' \
  -H 'Postman-Token: 4531fb9f-ba3a-408d-8d6c-c03db0dab6b2' \
  -H 'cache-control: no-cache' \
  -d '{
"description": "my ip"
}'



Also, I know there's a bulk add API for ip-addresses API, however, it's not very intuitive t  first get a list of available IPs, then combine them to ranges , e.g.

:param ips: a list of IPs, e.g. [192.168.0.1, 192.168.0.2, 192.168.0.3, 192.168.0.5, 192.168.0.6, 192.168.1.1]
:return: ip ranges, e.g. [192.168.0.[1-3, 5-6], 192.168.1.1]

thanks!
Reply all
Reply to author
Forward
0 new messages