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

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...