Andy Bretten

Random API Methodology thoughts

Discussion created by Andy Bretten on Apr 15, 2016
Latest reply on Apr 17, 2016 by Uri Bialik

Disclaimer:  not a hard core programmer , so I might say crazy things.


I thought I would just share my initial impressions and feedback on a simple proof of concept I've been working on with the new R80 API.


Adding a host.    On the surface this is simple....format a JSON query with a couple of fields and you can add an object to Smartcenter,  awesome.  That works.


Now I've complicated it by purposely sending a duplicate object IP address.   Now I get a HTTP 500 back.


Ok I think,   I need to check for dupe, before adding the object.


Ok I cant search for a match via the API (unless I've missed that),  so I can dump a list of hosts.


Ok that just gives me a list of object names back,  so now I start recursively doing a show host on every host object to suck in all the ip addresses into my perl script to decide if I'm about to dupe.

This feels like alot of work I'm creating,  anyone want to share any thoughts on the API methodology here ?


EDIT: ok so I realized there was a "show more" link in the API docs for "show-hosts" and I can send "details-level":"full" to get the ip addresses of the host objects ... awesome.