Reply

WAPI (Web API) Sample Code for NIOS

[ Edited ]
Adviser
Posts: 175
6291     0

Sample code showing how to use the WAPI (Web API) for NIOS in various languages. These samples include Java, Python and Javascript. 

If you appreciate my efforts, please give me a kudo ↓ or Accept as solution to help others find it faster.

Re: WAPI (Web API) Sample Code for NIOS

[ Edited ]
New Member
Posts: 1
6291     0

I've been looking through the javascript sample code you provided and it looks like a great starter. However, there's nowhere that I can see that you're defining/creating a connection to the WAPI (similar to what was done in the python version), i.e. hostname, username, password, etc. Is there a file missing? Or is this an exercise for the user? 

 

You're also using ExtJS in the extjs-example, but it's not included in the zip download, so users will need to find a copy and put it in the right place in order for any of this to work. 

 

Thanks again for the great jumpstart, and if you could answer my question about the WAPI connection settings that would be great. 

Re: WAPI (Web API) Sample Code for NIOS

New Member
Posts: 1
6291     0

I have the trial Infoblox DDI software loaded on Ravello, and I am trying to use these examples or the examples from the online WAPI course, and I keep getting errors. Does the trial software include WAPI support? If so, are there some configuration parameters required to activate it?

Re: WAPI (Web API) Sample Code for NIOS

Adviser
Posts: 109
6291     0

@mlane706 wrote:

I have the trial Infoblox DDI software loaded on Ravello, and I am trying to use these examples or the examples from the online WAPI course, and I keep getting errors. Does the trial software include WAPI support? If so, are there some configuration parameters required to activate it?


I know that this is an old post but just wanted to add something in case anyone else runs across this. To confirm- there are no extra requirements when using the trial version, with the main difference being that it will use temporary license keys which are only valid for 60 days. If any errors are encountered, I would recommend starting a new thread in the forums and posting both the sample code that you are attempting to use, along with any errors that you are seeing.

 

Regards,

Tony

Re: WAPI (Web API) Sample Code for NIOS

Techie
Posts: 2
6291     0

Hello Eric,
The code samples are a great starting point.

 

I'm using the java-wapi-client-V1.1.zip.

Can you help with invoking a 'delete' operation?
I've tried:

  • -input json -d'{"_ref":"record:a/REF_HASH:myfoo.mysite.com/default"}' - failed
  • -d "record:a/REF_HASH:myfoo.mysite.com/default" -> urlencoded, failed

The error is alwatys the same:

{ "Error": "AdmConProtoError: Object ref must be given for DELETE: record:a", "code": "Client.Ibap.Proto", "text": "Object ref must be given for DELETE: record:a"}

 

Thank you in advance,

Jorden

Re: WAPI (Web API) Sample Code for NIOS

[ Edited ]
Techie
Posts: 2
6291     0

UPDATE: I missed the '-r' flag, reverted the code change.

 

 

I think I've found the issue.

Debugging the flow, I found the in OperationType.DELETE.performOperation, the 'params' string wasn't passed to the 'dao.delete()' method call.

 

Best,

Jorden

Re: WAPI (Web API) Sample Code for NIOS

[ Edited ]
New Member
Posts: 4
6291     0

Hi, I've used the Python samples to start building my own scripts.  I use Postman a lot to work on the queries and output then I move my queries to Python 3 requests. I mostly use it for quick validations and most of the time I format the JSON in Pandas DataFrames (easier to pivot, filter, order...).

Let's say I want to get ip addresses inside a network (10.148.64.0/25), but I would like to receive only the ones where 

"status": "USED"

The URL is this one to query the IPs in the Network

https://{{grid_master}}/wapi/v2.11.2/ipv4address?network=10.148.64.0/25&_return_fields%2b=ip_address,status

But from the WAPI documentation the field status is searchable.  Where would this criteria be added in the URL?  I finally figured this one out: the filter [&status=USED] should be added at the end of the URL like this.

https://{{grid_master}}/wapi/v2.11.2/ipv4address?network=10.148.64.0/25&_return_fields%2b=ip_address,status&status=USED

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You