Hi,
You can look Invoke-ArubaMCRestMethod =>
https://github.com/PowerAruba/PowerArubaMC/blob/master/PowerArubaMC/Private/RestMethod.ps1i add the uidaruba to the uri/url
https://github.com/PowerAruba/PowerArubaMC/blob/master/PowerArubaMC/Private/RestMethod.ps1#L63------------------------------
PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...
PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)
PowerArubaCL: Powershell Module to use Aruba Central
PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..
ACEP / ACMX #107 / ACDX #1281
------------------------------
Original Message:
Sent: Dec 06, 2022 03:43 AM
From: Grzegorz Stolarczyk
Subject: Use Powershell to call ArubaOS 8.7.x.x API no modules allowed
Hi alagoutte!
Thanks for your reply! I've readed your source code, looks very nice :-). Variable $connection has aside other subparams the connection.uidaruba parameter.
The question is how to use it for further calls? I've used it this way, but once again 401, header with $connection.session gives an error...
$GET_API = Invoke-RestMethod -Uri $GetURL -ContentType application/json -Headers $connection -Method Get
Should I add something to your $headers? I've tried this, once again 401:
$headers = @{ Accept = "application/json"; "Content-type" = "application/json"; "Cookie" = $arubamc }
$GET_API = Invoke-RestMethod -Uri $GetURL -ContentType application/json -Headers $headers -Method Get
I've also tried:
$headers = @{ Accept = "application/json"; "Content-type" = "application/json"; "Cookie" = "SESSION= " + $arubamc }
...and also:
$session = $arubamc.Cookies.GetCookies($UriLogon)
$headers = @{ Accept = "application/json"; "Content-type" = "application/json"; "Cookie" = $session }
No luck :-(
Best Regards,
Original Message:
Sent: Dec 05, 2022 03:16 PM
From: Alexis La Goutte
Subject: Use Powershell to call ArubaOS 8.7.x.x API no modules allowed
It is PowerArubaMC for Mobility Controller (and not SW)
You can look the source of connection (and copy/paste the function ^^)
https://github.com/PowerAruba/PowerArubaMC/blob/master/PowerArubaMC/Public/Connection.ps1#L117
i don't remember there is a CSRF for MC API but it will be easy to add (i can look if needed)
------------------------------
PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...
PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)
PowerArubaCL: Powershell Module to use Aruba Central
PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..
ACEP / ACMX #107 / ACDX #1281