1
24.7 Production Series / Re: Adding reservations with Kea API?
« on: September 10, 2024, 05:38:40 pm »
Hi,
I just needed this, and your question helped me to make it work.
You need to add a "reservation" entry to your json and you also need to use the subnet uuid. To get your subnet uuid, you can call the searchSubnet command.
And then to add your reservation:
I just needed this, and your question helped me to make it work.
You need to add a "reservation" entry to your json and you also need to use the subnet uuid. To get your subnet uuid, you can call the searchSubnet command.
Code: [Select]
curl -k --request GET \
-u "your_key":"your_secret" \
https://192.168.0.1/api/kea/dhcpv4/searchSubnet
{"rows":[{"uuid":"d4a3aa6d-e4e2-4b31-a54b-a9184f353ebc","subnet":"192.168.0.0\/24","next_server":"","option_data_autocollect":"1","option_data":"","pools":"","description":"My LAN"}],"rowCount":1,"total":1,"current":1}%
And then to add your reservation:
Code: [Select]
curl -k --request POST \
--header "Content-Type: application/json" \
-u "your_key":"your_secret" \
-d '{"reservation":{"subnet":"d4a3aa6d-e4e2-4b31-a54b-a9184f353ebc","ip_address":"192.168.0.10","hw_address":"01:23:45:67:89:ab","hostname":"device-001","description":"DEVICE"}}' \
https://192.168.0.1/api/kea/dhcpv4/addReservation
{"result":"saved","uuid":"fe4312c4-1c4f-4ec2-943c-6ebd112c2433"}