1. Support
  2. Knowledge Base
  3. Uptrends' API
  4. Accessing the Uptrends API using Powershell

Accessing the Uptrends API using Powershell

We’re changing our user interface. Some info may not yet be up to date. Please check From classic to new UI.

The following example accesses the Uptrends API and fetches the list of Uptrends' checkpoint locations.

# Specify your Uptrends login info here $user = "james@galacticresorts.com" $pass= "1234xxx" # URI to the API method you want to execute $uri = "https://api.uptrends.com/v3/checkpointservers" # Compile the login info into credentials containing basic authentication $passwordValue = ConvertTo-SecureString $pass -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential ($user, $passwordValue) # Execute the request $result = Invoke-RestMethod -Uri $uri -Method Get -Credential $cred -Headers @{ Accept = "application/json" }

That final statement puts the result in the `$result` variable. You can then continue working with that content. For example, to retrieve the IPv4 address for a specific checkpoint:

$result | Where-Object { $_.CheckPointName -eq 'Leicester, United Kingdom' } | Select IPAddress

By using the Uptrends website, you consent to the use of cookies in accordance with our Cookie Policy.