Network Management

last person joined: 2 days ago 

Keep an informative eye on your network with HPE Aruba Networking network management solutions
Expand all | Collapse all

api xml download

This thread has been viewed 1 times
  • 1.  api xml download

    Posted May 09, 2018 09:27 AM

    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.



  • 2.  RE: api xml download

    EMPLOYEE
    Posted May 09, 2018 10:55 AM

    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.



  • 3.  RE: api xml download

    Posted May 09, 2018 11:04 AM

    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.



  • 4.  RE: api xml download

    EMPLOYEE
    Posted May 09, 2018 11:23 AM

    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.



  • 5.  RE: api xml download

    Posted May 14, 2018 05:08 AM
    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.


  • 6.  RE: api xml download

    EMPLOYEE
    Posted May 14, 2018 12:12 PM

    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.



  • 7.  RE: api xml download

    Posted May 15, 2018 03:55 AM

    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.