## Script Variables $WebURL = "https://Loginenterprise.my.domain" $ConfigToken = "BifSUhkFfEKkLb7tqnYUtYiNBkaJA4OgrdemwoLM71Q" $TestGUID = "3a9f24a1-232f-4849-8a37-56117ba82734" # WARNING: ignoring SSL/TLS certificate errors is a security risk $code = @" public class SSLHandler {public static System.Net.Security.RemoteCertificateValidationCallback GetSSLHandler() {return new System.Net.Security.RemoteCertificateValidationCallback((sender, certificate, chain, policyErrors) => { return true; });} } "@ Add-Type -TypeDefinition $code # WARNING: ignoring SSL/TLS certificate errors is a security risk [System.Net.ServicePointManager]::ServerCertificateValidationCallback = [SSLHandler]::GetSSLHandler() # this is only required for older version of PowerShell/.NET [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12 # Define global authorization header for the script $Header = @{ "Accept" = "application/json" "Authorization" = "Bearer $ConfigToken" } ## Retrieve location site 1 and 2 in the list. To add more simply copy paste and make changes to the numbers in the [] $Location1 = (Invoke-RestMethod -Uri "$WebUrl/publicApi/v5/locations" -Headers $Header -Method Get).Items[0].id $Location2 = (Invoke-RestMethod -Uri "$WebUrl/publicApi/v5/locations" -Headers $Header -Method Get).Items[1].id ## Retrieve the diagnostic tile data on the dashboard for all continuous tests for the last hour Invoke-RestMethod -Uri "$WebUrl/publicApi/v5/test-diagnostics?timeRange=lasthour" -Headers $Header -Method Get ## Retrieve the diagnostic tile data on the dashbnoard for a specific continuous test, for the last 15 minutes Invoke-RestMethod -Uri "$WebUrl/publicApi/v5/tests/$TestGUID/test-diagnostics?timeRange=last15minutes" -Headers $Header -Method Get ## Retrieve diagnostic tile data based on the location dashboard per site for the last hour, to expand duplicate the entries. Invoke-RestMethod -Uri "$WebUrl/publicApi/v5/tests/$TestGUID/test-diagnostics?timeRange=lasthour&locationId=$Location1" -Headers $Header -Method Get Invoke-RestMethod -Uri "$WebUrl/publicApi/v5/tests/$TestGUID/test-diagnostics?timeRange=lasthour&locationId=$Location2" -Headers $Header -Method Get ## Retrieve application statistics for a specific continuous test for the last hour Invoke-RestMethod -Uri "$WebUrl/publicApi/v5/tests/$TestGUID/application-diagnostics?timeRange=lasthour" -Headers $Header -Method Get ## Retrieve application statistics for a specific continuous test and a specific launcher location, for the last hour Invoke-RestMethod -Uri "$WebUrl/publicApi/v5/tests/$TestGUID/application-diagnostics?timeRange=lasthour&locationId=$Location2" -Headers $Header -Method Get