/v1/firewalls endpoint broken

Hello together,

i already have an ticket open on this, or at least something because there are not ticket numbers, when you right the api support team Slight smile

We are stuck since some weeks that the '/v1/firewalls' endpoint is broken and we cannot use it.

We have working script which are just stopped going and even the sophos examples does not work anymore.

Here is a sample code i stiched together to provide sophos support - this should work, but it fails:

$clientId = "xxx" 
$clientSecret = "xxx" 
  
$TokenURI = https://id.sophos.com/api/v2/oauth2/token 
  
$TokenRequestBody = @{ 
    grant_type = "client_credentials" 
    client_id = $clientId 
    client_secret = $clientSecret 
    scope = "token" 
} 
$TokenRequestHeaders = @{ 
    "content-type" = "application/x-www-form-urlencoded"; 
} 
  
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 
  
$APIAuthResult = (Invoke-RestMethod -Method Post -Uri $TokenURI -Body $TokenRequestBody -Headers $TokenRequestHeaders -ErrorAction SilentlyContinue -ErrorVariable ScriptError) 
if ($SaveCredentials) { 
    $clientSecret = $clientSecret | ConvertFrom-SecureString 
    ConvertTo-Json $ClientID, $ClientSecret | Out-File $CredentialFile -Force 
} 
  
$Token = $APIAuthResult.access_token 
  
$WhoamiURI = https://api.central.sophos.com/whoami/v1 
  
$WhoamiRequestHeaders = @{ 
    "Content-Type" = "application/json"; 
    "Authorization" = "Bearer $Token"; 
} 
$APIWhoamiResult = (Invoke-RestMethod -Method Get -Uri $WhoamiURI -Headers $WhoamiRequestHeaders -ErrorAction SilentlyContinue -ErrorVariable ScriptError) 

# Save Response details 
$APIidPartner = $APIWhoamiResult.id 
$APIidType = $APIWhoamiResult.idType     
$APIdataRegion = $APIWhoamiResult.ApiHosts.global # THIS CHANGED FROM dataRegion to global 
  
if ($APIidType -ne "partner") { 
    Write-Output "Aborting script - idType does not match partner!" 
    Break 
} 
  
$APIpartnerHeaders = @{ 
    "Authorization" = "Bearer $Token"; 
    "X-Partner-ID" = "$APIidPartner"; 
} 
  
$TenantPage = 1 
do { 
  
    $TenantList = (Invoke-RestMethod -Method Get -Uri https://api.central.sophos.com/partner/v1/tenants?pageTotal=true&pageSize=100&page=$TenantPage -Headers $APIpartnerHeaders -ErrorAction SilentlyContinue -ErrorVariable ScriptError) 
    foreach ($Tenant in $TenantList.items) { 
  
        $APIidTenant = $Tenant.id 
        $APIdataRegion = $Tenant.apiHost 
  
        ################# INSERT CODE HERE ############### 
        Write-Output $Tenant.showAs 
        ################# INSERT CODE HERE ############### 
        Write-Output "Getting firewall information for Sophos Central..." 
        Write-Output "" 
            
        # SOPHOS API Headers: 
        $APIHeaders = @{ 
            "Authorization" = "Bearer $Token"; 
            "X-Tenant-ID" = "$APIidTenant"; 
        } 
        
        if ($null -ne $APIdataRegion){ 
            # Post Request to Firewall API: 
            $Result = (Invoke-RestMethod -Method Get -Uri $APIdataRegion"/firewall/v1/firewalls" -Headers $APIHeaders -ErrorAction SilentlyContinue -ErrorVariable ScriptError) 
        } 
        
        #Output in table format 
        $Result.items | Format-Table -Property @{label='Firewall Hostname';e={$_.hostname}},@{label='Firewall Name';e={$_.name}}, @{label='Firewall Group';e={$_.group}}, @{label='Serial Number';e={$_.serialNumber}}, @{label='Firmware Version';e={$_.firmwareVersion}}, @{label='Firewall Model';e={$_.model}}, @{label='Cluster Mode';e={$_.cluster.mode}}, @{label='Cluster status';e={$_.cluster.status}}, @{label='Central Connection';e={$_.status.connected}} 
    } 
    $TenantPage++ 
  
} while ($TenantPage -le $TenantList.pages.total) 
  

We get errors like:

{ 
  "error": "BadServerResponse", 
  "correlationId": "cbe11b6f-13e8-42ca-bfd3-a7465e26358f", 
  "requestId": "44a26d4e-9a46-4ef5-9e38-7cd5449365b1" 
} 
  
{ 
  "error": "BadServerResponse", 
  "correlationId": "16173567-5bfe-4149-a13c-8e7409c8525b", 
  "requestId": "f1416091-cac2-4f33-a86c-dd6a614088c7" 
} 
  
{ 
  "error": "BadServerResponse", 
  "correlationId": "a8eb9935-183c-4368-9a08-eaff1d972f71", 
  "requestId": "4177bff3-a9e9-4b00-888d-22f06badb2c3" 
} 

i can confirm, that this did work 8 weeks ago and stopped working after some migration of sophos central partner dashboards.

Can someone test this in his partner instance and tell me if this is an problem of our partner account or a general problem.

Thank you

Parents Reply Children