Jump to content

martijnsp1991

Members
  • Posts

    1
  • Joined

  • Last visited

Profile Information

  • Location
    Netherlands
  1. 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
×
×
  • Create New...