Infoblox Exchange Cybersecurity Roadshow 2020 – Join us!
North America | Europe | Middle East/Africa | Asia-Pacific

Network Change & Configuration Management

Reply
Highlighted

Call to API via URL and passing a variable

Techie
Posts: 2
2963     0

Trying to call to an API with URL and not sure how to imput a varaible into the URL.  This is what I have thus far:

 

https://userSmiley Tongueassword@#.#.#.#/api/2.8/scripts/run?name=SCRIPT_NAME&device_ids=9789&script_variables=???????

 

Everything appears to work by calling to the script and the device I want to run the script on but not sure how to pass a variable to the script.   Would help if the API documentation gave examples.

Highlighted

Re: Call to API via URL and

Adviser
Posts: 412
2964     0

&script_variables=$test=sh run

 

Here is what you need

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh
Highlighted

Re: Call to API via URL and

Techie
Posts: 2
2964     0

Thanks for the response but figured it out:

I thought I had to enter the key word "script_variables" and associate it to the the variable I wanted to pass but you only needed to enter the variable name itself in the script.

Example:

https://userSmiley Tongueassword@192.168.1.1/api/2.8/scripts/run?name=SCRIPT_NAME&device_ids=9789&<VariableName>=$<string>

 

 

 

script_variables is the <VariableName> and $<string> is the value you want for that variable.

Highlighted

I can't get this to work.  I

Techie
Posts: 2
2964     0

I can't get this to work.  I've tried:

/api/2.9/scripts/run?name=LocalUsernameUpdate&device_group_ids=41&script_variables=$username=test
/api/2.9/scripts/run?name=LocalUsernameUpdate&device_group_ids=41&script_variables=$username test
/api/2.9/scripts/run?name=LocalUsernameUpdate&device_group_ids=41&script_variables=$username%20test
​/api/2.9/scripts/run?name=LocalUsernameUpdate&device_group_ids=41&script_variables=username=test
/api/2.9/scripts/run?name=LocalUsernameUpdate&device_group_ids=41&script_variables=username test
/api/2.9/scripts/run?name=LocalUsernameUpdate&device_group_ids=41&script_variables=username%20test
/api/2.9/scripts/run?name=LocalUsernameUpdate&device_group_ids=41&username=$test

 

But the variables in the job log are always ''

Thanks,
Greg

 

Highlighted

Try:

Adviser
Posts: 353
2964     0

Try:

 

/api/2.9/scripts/run?name=LocalUsernameUpdate&device_group_ids=41&$username=test

 

That is, the "$" is used to identify variables that should be passed into the script.

 

Highlighted

That worked. Thanks!

Techie
Posts: 2
2964     0

That worked. Thanks!

Showing results for 
Search instead for 
Do you mean 

Recommended for You