CloudSOC CASB Gateway

 View Only

Accessing CloudSoc API through Powershell

  • 1.  Accessing CloudSoc API through Powershell

    Posted Feb 25, 2018 06:30 AM

    I am trying to connect CloudSOC API through Powershell

    Does anyone able to connect with PowerShell?

    This is an example of code i am running with error:

    $uri = "https://api.eu.elastica.net/mytenant/api/admin/v1/logs/get/?app=Detect&subtype=threatscore&threat_score=45"

    $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"

    $username = "Key ID"

    $password = "Key Secret"

    $userpass = $username + ":" + $password

    $bytes= [System.Text.Encoding]::UTF8.GetBytes($userpass)

    $encodedlogin=[Convert]::ToBase64String($bytes)

    $authheader = "Basic " + $encodedlogin

    $headers.Add("Accept","application/json")

    $headers.Add("Authorization",$authheader)

    $headers.Add("X-Elastica-Dbname-Resolved","True")

    $response = Invoke-RestMethod -Uri $uri -Headers $headers -Method Post -ContentType "application/json"

     

    Thanks