Parse error on create_column

Hello,

I started to learn how your API works and everything was fine until I tried to create a new column in a board. I quite litterally copy / pasted the code I found in the doc, put my board ID and my API Key. changed nothing else just to see if it was working but I got this message :

“message”: “Parse error on “create_column” (IDENTIFIER) at [1, 1]”

here is my code :

 let query = "create_column(board_id: "+boardID+", title:\"Work Status\", description:\"This is my work status column\", column_type:text){id}}"

    fetch ("https://api.monday.com/v2", {
        method: 'post',
        headers: {
            'Content-Type': 'application/json',
            'Authorization' : apikey
        },
        body: JSON.stringify({
            'query' : query
        })
    })
        .then(res => res.json())
        .then(res => console.log(JSON.stringify(res, null, 2)));
}

Do you know why this occurs ?

Thank you and have a nice day :slight_smile:

Hello @Tesseract and welcome to the community!

The first thing that sticks out is that your query is not completely written out, as you do need to identify your query as a mutation. You may notice that the very end of your query has two closing curly brackets after the id return field, but only one opening bracket.

You can complete the query by formatting your query in the following way.

let query = "mutation { create_column(...) {id}}

Please let me know if you are still running into issues.

Thank you and happy coding!

Andrew

1 Like