Create item with column values returns 500

Hi

I am trying to create a new item with values through the API, but it returns a 500 error.
The columns is of a text type.

I am following instructions from the API Reference.
Did I get something wrong?

Thanks.

Hi @amit.lzkpa,

A 500 error is often a result of invalid request.

In the sample mutation you have sent, you have not passed a column id to update.

Your mutation should look something like:

mutation {
create_item(board_id: BOARD_ID, item_name: “My new item”, column_values: “{"COLUMN_ID":"somevalue"}” ) {
id
}
}
I created this request in GraphiQL, but you can use the same format using JSON.stringify with Javascript

Ok.
I’ll give that a try next time.
It wasn’t very clear to me from the api reference that we need to pass the column id.
Thanks for the quick response.

On a general note, shouldn’t invalid request return a 400 error as 500 is meant for server errors?

1 Like

@mitchell.hudson thanks for jumping in and assisting Amit with this!

@amit.lzkpa I definitely agree that our API could use some further improvements in terms of making errors more specific! As far as I understand, you will usually get a 500 error when the request isn’t formatted properly and the platform doesn’t let the values through, whereas a 400 error would indicate potential network issues. Does that make sense?

-Alex