Network Management

Reply
Occasional Contributor I

api xml download

i've been trying for a while now to download the xml file from the api on one of our acces points i can get it to download through a powershell internet explorer hook but the problem is that wouldnt work once put on the server in tasksheduler. the reason i had to resort to the internet explorer hook is cause it would seem the login page of the airwave controller is not made in a form and can appearantly not be called by a invoke-webrequest or a webclient which would be the only way for the script to be able to do its job while no one is logged into the server. i was wondering if anyone else has ever succesfully download from the api or if i'm just doing something wrong on the webrequest. the location of the api is on <controlerwebconnection>ap_detail.xml?id=<ID-number of the ap>.

 

the way that i'd like to do it would be through webrequest. i've currently been trying to work off of

$url = "https://<airwavecontroller>/ap_detail.xml?id=607"
$date = get-date
$name = $date.ToString("dMyhhmm")
$outFilePath = "C:\Users\latitude\"+$name+"raw.xml"


$web = Invoke-WebRequest -Uri $url -Credential $mycreds  -OutFile $outFilePath

any pointers or even a place to start looking for a way to get this done would be really appreciated.

Moderator

Re: api xml download

The best route is to create an API user account, and have the script login using that account to fetch data from the API.  This is done in a way to enforce data access auditing on the system.


Rob Gin
Senior QA Engineer - Network Services
Aruba Networks, a Hewlett Packard Enterprise Company
Occasional Contributor I

Re: api xml download

i'm currently passing along my credentials as a admin in the

$mycreds

 which get passed along inside the header of the web request. shouldnt this normaly work or do i actualy need a specific api user for this application.

 

thanks for taking the time to respond.

Highlighted
Moderator

Re: api xml download

For activity auditing, it's a suggested best practice to have a separate API user.

 

The main exchange that has to happen after initial login is receiving the session cookie.  And don't forget to add a logout at the end of the transaction.


Rob Gin
Senior QA Engineer - Network Services
Aruba Networks, a Hewlett Packard Enterprise Company
Occasional Contributor I

Re: api xml download

the main problem is it wont let me log in to the main page i've tried connecting to ik through a webrequest but it would seem it doesnt detect the header with the password and username in it. the login page also isnt in a form so i can't use the webrequest.form to fill in the fields. i've been trying to trouble shoot this for the past 3 weeks but seem to have hit a brick wall that i cant get around with my limited powerschell knowledge.
Moderator

Re: api xml download

You've got the advantage over me, I'm not familiar with Powershell at all.  Try opening a support case, perhaps someone in support might be able to steer you the right way to access the APIs.


Rob Gin
Senior QA Engineer - Network Services
Aruba Networks, a Hewlett Packard Enterprise Company
Occasional Contributor I

Re: api xml download

well appearantly i was overcomplicating things. it turns out the username/password get passed through in plaintext instead of encrypted so i was trying to do an unnecessary step. thank you for your replies. this thread could be deleted if necessary cause it turned out to be a non issue XD.

Search Airheads
cancel
Showing results for 
Search instead for 
Did you mean: