Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - 5m4u66y

#1
24.7, 24.10 Series / Re: Adding reservations with Kea API?
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.


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:

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"}