Monday SDK for js

Hello,

I’m trying to add columns values using monday’s official sdk ( GitHub - mondaycom/monday-sdk-js: Node.js and JavaScript SDK for developing over the monday.com platform ), but the docs are not helping to much.

I’m getting 500 error,
this is my code

 monday.api(`mutation {
        create_item (board_id: 123456789, item_name: "My Item Name", column_values: "[{\"text1\": \"yellow\"}, {\"text2\": \"red\"}, {\"text3\": \"blue\"}" ) {
        id
        } }`).then(res => {
        console.log(res)
    });

I tried also with only one column, still error 500 or nothing at all.
I don’t want to make another query and use “change_column_value”.

Thank you!

Hello @Razvan and welcome to the community!

I hope you like it here :muscle:

Regarding your mutation, I think it should work with a little tweak:

monday.api(mutation { create_item (board_id: 123456789, item_name: "My Item Name", column_values: "{\"text1\": \"yellow\", \"text2\": \"red\", \"text3\": \"blue\"}" ) { id } }).then(res => {
console.log(res)
});

Please also check that the column IDs are correct.

Let me know what happens!

Cheers,
Matias

Hello, :slight_smile:

Thank you Matias for you’re response.
Unfortunately now I receive this error: Parse error on ": " (STRING).

This is my code.

const column_values = `{\"text1\": \"yellow\"}`;
const mutation = `mutation{create_item(item_name: "TEST", board_id: 123456789, column_values: "${column_values}"){ id }}`;
monday.api(mutation).then(res => {
         console.log(res);
});

If I delete column_values then It will work, also tried with change_multiple_column_values but I get the same error.

I tried using the default fetch method, but I need https, to post on monday.

This is the error : message: ‘Parse error on ": " (STRING) at [1, 88]’

Full solution can be found here!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.