I agree, this is not ideal. I was just trying to minimize the changes and used existing @server.find_record.

Also, if you look at the list of issues I posted here http://projects.theforeman.org/issues/2687, it becomes very clear (at least to me), that there are a lot changes have to happen in DHCP smart-proxy and better (and faster) API for record search is just one of them.

Going back to API itself. In ISC DHCP there are 3 main objects - lease, host and group. With "host" object being the only one that is fully RW, I thought the following URL structure should be truly RESTful:

curl -X <GET | POST | DELETE> http://<proxy>:<port>/dhcp/host -d 'ip=x.x.x.x' -d 'mac=xx.xx.xx.xx.xx.xx', etc.

so basically exactly the same thing you mentioned, but with object "reservation". For example, if somebody wanted to implement the lease manipulation API (like expiration or something), they would just use "PUT /dhcp/lease".

Not sure if other DHCP implementations (MS, etc) have other objects available, but having this structure will allow for easier API modifications, IMHO.