- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
API get DHCP lease related info
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2018 06:51 AM
Hi,
I want use API to obtain DHCP lease ip all related info , need include lease allocation and end time .
I can not found this from API guide , so is this possible ? If yes , what API can help achieve ?
Any help will be appreciated.
Solved! Go to Solution.
Re: API get DHCP lease related info
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2018 06:26 AM
curl -k1 -u admin:infoblox -X GET 'https://192.168.1.2/wapi/v2.2/lease?_return_fields%2b=address,starts,ends,tstp,binding_state,hardware,uid&_return_as_object=1'
If there's a large number of leases, you will need to request them in pages. Here's how you request them 10 at a time. (10 is good for an example, 1000 is more realistic in an automated script...)
curl -k -u admin:infoblox -X GET 'https://192.168.1.2/wapi/v2.2/lease?_return_fields%2b=address,starts,ends,tstp,binding_state,hardware,uid&_paging=1&_return_as_object=1&_max_results=10'
which returns:
{ "next_page_id": "789c5...", "result": [ ... <lots of leases> ... }
For next page, use that next_page_id value in the request:
curl -k -u admin:infoblox -X GET 'https://192.168.1.2/wapi/v2.2/lease?_return_as_object=1&_max_results=100&_paging=1&_page_id=789c5...'
This returns another next_page_id, which goes into the next page request. repeat until next_page_id is empty, this means all pages have been returned
Re: API get DHCP lease related info
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2018 08:35 PM
Dear MRichard,
Many thank your reply ! You reply is helpful !
But i am confusing about API return lease Start and End time . I can not match return value with lease real time .
For example :
In my lab , lease Start time is :2018-07-16 10:35:06 CST ,
and lease End time is :2018-07-16 22:35:06 CST ;
But API return lease Start and End time is strange number:
<list>
<value type="object">
<ends type="int">1531751706</ends>
<starts type="int">1531708506</starts>
<client_hostname>Lab-XP1</client_hostname>
<hardware>00:0c:29:3f:1b:bc</hardware>
<binding_state>ACTIVE</binding_state>
<_ref>
lease/ZG5zLmxlYXNlJDEwLzE5Mi4xNjguMjAuMTAwLzAv:192.168.20.100/default
</_ref>
</value>
</list>
Do you know how to match these API return "int number" with lease real time ?
Regards,
King
Re: API get DHCP lease related info
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2018 08:08 AM