Anybody has an example of creating multiple items in Postman?

Hello friends! I’m back with a new question. :slight_smile:

I trying to create an item with about 5-6 different columns, and I’m trying to create all this through one mutation API-call through Postman(JSON-body). The thing is: I can’t really figure it out through the documentation. Does somebody maybe have an example(a picture maybe) of the syntax of such a call. The values and type doesn’t matter at all. The only example in the documentation is just setting the item name.

Very thankful! Have a great one.

Or is the only way perhaps to first create the item through a mutation, and then in a seperate call create and populate the columns of that item? :slight_smile: No way of creating the item and populating its columns in the same call?

hi @Sina

I’m not using Postman that much but if you look at this example using the API playground I am sure you can convert it to Postman. This one creates an item and set two date columns.

mutation {
  create_item(board_id: 123456789, item_name: "New item", column_values: "{\"date_1\":\"2022-01-20\", \"date_11\":\"2022-01-22\"}") {
    id
  }
}

You need to send the column values in a JSON formatted string. In the example the outer quotes (after column_values) are because you need to send a string, then the curly brackets to make it JSON and then columnId / columnValue pairs. The columnId and values (most often) are strings so therefore you need to escape (\) the double quotes defining those strings. You can find which column type needs which format in this section Column Types Reference.

Have fun!

2 Likes

Thank you senpai @basdebruin! Now I understand completely! :pray:

Although, what this mutation did for me, was only creating the item, without the columns. So I guess I’m back to square one. So I’ll keep searching, and if anybody stumbles upon some solution, I’d be most grateful if you chose to share it with me! :slight_smile:

hi @Sina

Using the example mutation sets the column values at the time the item is created, it does not create those columns (you have to use existing columnIds). There is no option to create columns while creating an item. The columns need to be created through the UI or by an API call:

mutation {
    create_column (board_id: 1234567, title: "Work Status", column_type: status) {
        id
    }
}

See also: Columns

2 Likes

Thank you @basdebruin, you absolute monday encyclopedia :muscle:

1 Like