{@{message=No query string was present}} 15333503

Hi Team,

Im getting No query string error since im new to coding and monday.com could someone help me please.

Set up variables for the Monday API

$apiKey = “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
$apiUrl = “https://api.monday.com/v2

Set up variables for the server

$serverName = “google.com

Check the server status

$status = Test-Connection $serverName -Count 1 -Quiet

Convert the status to “Online” or “Offline”

if ($status) {
$serverStatus = “Online”
} else {
$serverStatus = “Offline”
}

Set up variables for the Monday.com column

$boardId = “4048955123”
$itemId = “4048955140”
$columnId = “text7”

Set up the JSON payload for the update request

$updateData = @{
query = @"
mutation {
change_column_value (
board_id: $boardId,
item_id: $itemId,
column_id: “$columnId”,
value: “{"label":"$serverStatus"}”
) {
id
}
}
"@
}

Send the update request to the Monday API

Invoke-RestMethod -Method POST -Uri $apiUrl -Headers @{Authorization = “Bearer $apiKey”} -Body ($updateData | ConvertTo-Json)