New to Monday.com, and I’m trying to use the API to create an item. I’ve tried with SQL server and PowerShell and always get a 500 error back.
I’ve read, and tried the code from this post:
Using PowerShell to create an item in Monday.com?
with no luck. I’ve tried and re-tried using different formatting, but I’m sure the issue is with $query below (tried with escaping the quotes etc.).
$apiKey = “xxxxx”
$boardId = “1234567890”
Set the header with your API key
$headers = @{
“Authorization” = $apiKey
“Content-Type” = “application/json”
}
Define the query to create an item
$query = "
mutation{
createItem1: create_item (board_id: 1234567890, item_name:““Test Item 1"”) {
id
name
}
}”
Execute the request
$response = Invoke-RestMethod -Uri ‘https://api.monday.com/v2/’ -Method Post -Headers $headers -Body $query
Any help would be appreciated. This seems like it should be pretty easy, but I cannot get it to work and the error isn’t much help. I can query the board (return data) so I know the authentication works, and inserting using the API playground works so I think the query (mutation) is right (have tried adding “query:” before mutation as well). But I can’t get anything other 500 back.