Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For prerequisites, refer to Deploying the Survivable Branch Appliance and Using Powershell 3 to Access REST.

Log into SBC REST API

The action below defines the login resource used to log into the 

Spacevars
0company
Spacevars
0product2
REST API. This is the first request that needs to be made before you can access any of the other REST Resources on the 
Spacevars
0company
 
Spacevars
0longproduct
system. Refer to Resource - login. 


Code Block
### Allow self Sign Cert
add-type @"
    using System.Net;
    using System.Security.Cryptography.X509Certificates;
     
    public class IDontCarePolicy : ICertificatePolicy {
        public IDontCarePolicy() {}
        public bool CheckValidationResult(
            ServicePoint sPoint, X509Certificate cert,
            WebRequest wRequest, int certProb) {
            return true;
        }
    }
"@
[System.Net.ServicePointManager]::CertificatePolicy = new-object IDontCarePolicy
                                             
### Login
$BodyValue = "Username=restuser&Password=restpass"
 
$url = "https://134.56.226.215/rest/login"
$Result = Invoke-RestMethod -Uri $url -Method Post -Body $BodyValue -SessionVariable ps 

...