Create item with custom status and other columns values

Hi there,

I’m trying to create task and define status of the task, but it is not easy to understand how to properly do this.

My query:

mutation {create_item (board_id: 377902169, group_id: "new_group18793", item_name: "new item", column_values: "{"status": "Search Active"}") {id}}

This query failed with error:
[{"message":"Parse error on \": \" (STRING) at [1, 117]","locations":[{"line":1,"column":117}]}]

I’ve also tried this query:

mutation {create_item (board_id: 377902169, group_id: "new_group18793", item_name: "new item", column_values: {status: "Search Active"}) {id}}

And this query fails with 500 status code and message “We’re currently experiencing some technical issues which our developers are working hard to resolve” (but the status page shows there are no incidents…)

So, the question is how I can set the correct value for columns for a new task?

Thank you!

So, more I work with this API more I hate it :frowning:.

Here is the example for people who will also be stuck trying to create a new item with PYthon:

headers = {'Content-Type': 'application/json',
           'Authorization': token}

url = 'https://api.monday.com/v2/'

create_item = """mutation {create_item (board_id: 377902169, group_id: "new_group18793", item_name: "new item",
               column_values: "{\\"status\\": {\\"label\\": \\"Search Active\\"},
                                \\"numbers\\": \\"1\\",
                                \\"text4\\": \\"Test\\"
                                }") {id}}
            """

get_columns_data = """query {boards (ids: 377902169) {owner {id} columns {id title type}}}"""

# Get columns types / ids:
body = {'query': get_columns_data}
res = requests.post(url=url, json=body, headers=headers)

# Create item with one status column, one numeric column and one text column:
body = {'query': create_item}
res = requests.post(url=url, json=body, headers=headers)
1 Like

Hey @xwizard – sorry to hear that you’ve found it difficult to get started with our API.

You can certainly use escape characters to make the column value string, but I recommend using GraphQL variables for this instead. It will let you send the column values as a normal JSON object and not worry about string interpolation.

Here’s a guide to help you get started in Python!

Cheers,
Dipro

Can you guys please add examples to these column data !
Its the most complex part of the call an you have no documentation on it.

In the page here:
https://monday.com/developers/v2#mutations-section-items-create

1 Like

Hi , I share same issue. here is my code, I am getting an empty response {}

var colval = {

    "columnVals" : JSON.stringify({

    status2 : $w('#dropdown1').value,

    phone : "1234567",

    email : {email : "abc@xyz.com", text : "abc@xyz.com",

    location :"my place ca",

    long_text1 : "some very long story",

    date4 :new Date(),

    date1 : 'today'

};

let query1 =‘mutation{create_item(board_id: 1032702316, item_name : “wix lead”, $columnVals: JSON!){id}}’;

fetch("https://api.monday.com/v2", {

    method : 'post',

    headers : {

        'Content-Type': 'application/json',

        'Authorization': 'xxxx' 

    },

    body : JSON.stringify({'query' : query1, 'variables' : JSON.stringify(vars)})

})

.then(res => res.json())

.then(res => console.log(res));

.catch(err => wixData.insert('Log', {dt: new Date(), msg : err}));

So I dont see any reject and item was not created

Hi @kutib, welcome to the community!

I see that not all of your colvals are formatted correctly. I would definitely utilize our API documentation as a starting point.

For your date columns in particular, the format needs to be in “YYYY-MM-DD” formatting. Additionally, the location column needs to be in longitude/latitude, otherwise I would recommend utilizing a text column. Additionally, for your email, you’re missing the closing curly bracket “}” at the end of the expression.

Here’s our API documentation: https://monday.com/developers/v2#simple-column-values-section-location. The quickest way to find all of the column formatting would be to just search the page with a CTRL + F!

If you have more questions feel free to write into appsupport@monday.com.

-Helen