Jump to content

Response "Error occurred: {"Meta":{"ResponseCode":403,"ErrorMessage":"Unknown system identifier."}}"


martijnsp1991

Recommended Posts

Hello,

We want to send a post notification via the API, but we always get the message "Unknown system identifier". What are we doing wrong? Below is the script that is used.

# Set your Pulseway API credentials
$tokenID = "*********"
$tokenSecret = "*************"

# Pulseway API Endpoint
$apiEndpoint = "https://************.pulseway.com/api/v3/notifications"

# Notification details
$instanceId = "Test"
$title = "Testing"
$message = "Test succeed"
$priority = "Critical"

# Create the JSON payload
$jsonPayload = @{
    InstanceId = $instanceId
    Title      = $title
    Message    = $message
    Priority   = $priority
} | ConvertTo-Json

$jsonPayload

# Set the authorization header
$headers = @{
    Authorization = "Basic {0}" -f [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($tokenID):$($tokenSecret)"))
    'Content-Type' = 'application/json'
}

# Send the API request
try {
    $response = Invoke-RestMethod -Uri $apiEndpoint -Method Post -Headers $headers -Body $jsonPayload

    if ($response.status -eq "success") {
        Write-Host "Notification sent successfully."
    } else {
        Write-Host "Failed to send notification. Response: $($response | ConvertTo-Json -Depth 5)"
    }
}
catch {
    Write-Host "Error occurred: $_"
}
 

Hope someone can help us.

Greeting,

Martijn

Link to comment
Share on other sites

  • 4 months later...

Hello Martijn,

To send a post notification, you need a host system through which the notification will be transmitted. This host system is identified by a unique system identifier.

In the above script - "$instanceId" refers to the System Identifier. 
Below is how you can find the System Identifier. 

Select any device in the device card. You will find an alphanumeric in the URL associated to it. 

image.png.253d7075118cc96a8d59ebdb07c634e0.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...