Failed to insert record to Monday.com via api v2

we failed to insert record to Monday.com via api v2.
got eror as:
{“error_message”:“Internal server error”,“status_code”:500}
for test push record below
{
“query”: “mutation{create_item( board_id: 154534478, group_id: “video_articles”, item_name: “Test - Trump to Offer Optimistic Vision in State of the Union Address”, column_values: {status:{index:15},status7:{index:19},status3:{index:15},person7:{id:10603717},article4:{index:13},eet_link:{url:“https://ntd.com/trump-to-offer-optimistic-vision-in-state-of-the-union-address_284634.html",text:"https://ntd.com/trump-to-offer-optimistic-vision-in-state-of-the-union-address_284634.html”}}) {\n\t\tid\n\t\tcolumn_values {\n\t\t\tid\n\t\t\ttitle\n\t\t\tvalue\n\t\t}}}”
}

Hey @Hilary - welcome!

That error usually has to do with the format of any JSON strings in your query. The first place I would check is that the right data structure is being used for each column value and if there any missing/extra commas and brackets.

For example, here is a query creating an item and populating the link:

mutation {
  create_item(board_id: xxxxx, item_name: "Hello world!", column_values: "{\"link\" : {\"url\":\"http://monday.com\",\"text\":\"go to monday!\"}}") {
    id
  }
}

Would you mind posting just the query snippet you’re trying to send?
-Danny

1 Like

I would also check if you have given sufficient permission(s) for your feature.

1 Like

here’ the query snippet used

mutation{create_item( board_id: 154534478, group_id: “video_articles”, item_name: “Test - Trump to Offer Optimistic Vision in State of the Union Address”, column_values: {status:{index:15},status7:{index:19},status3:{index:15},person7:{id:10603717},article4:{index:13},eet_link:{url:"[https://ntd.com/trump-to-offer-optimistic-vision-in-state-of-the-union-address_284634.html",text:"https://ntd.com/trump-to-offer-optimistic-vision-in-state-of-the-union-address_284634.html](https://ntd.com/trump-to-offer-optimistic-vision-in-state-of-the-union-address_284634.html",text:"https://ntd.com/trump-to-offer-optimistic-vision-in-state-of-the-union-address_284634.html)"}}) {\n\t\tid\n\t\tcolumn_values {\n\t\t\tid\n\t\t\ttitle\n\t\t\tvalue\n\t\t}}}

the code worked before, then suddenly stopped working.

From what I can see, it looks like there’s markdown syntax inside link. Also, I know that each column has their own set of rules. May need to refer here: https://monday.com/developers/v2#column-values-section

For link, has it been stringified?
For example:

{\"url\":\"https://www.google.com\",\"text\":\"testname\"}
1 Like

I tried to reply to this threat earlier, not sure why my post couldn’t go out. So I created another login to reply.

I didn’t quite under your reply.
Can you explain specifically what is the error and what should it be to fix bug for the example we provided?
{url:“https://ntd.com/trump-to-offer-optimistic-vision-in-state-of-the-union-address_284634.html",text:"https://ntd.com/trump-to-offer-optimistic-vision-in-state-of-the-union-address_284634.html”}

Hey @HLin !

I have it working this way:

const query = `mutation changeValue($value: JSON){
  create_item(board_id: yourboardId , item_name: "Item Name You want",  column_values: $value) {
	id
}
}`

variable

The already stringified way: 

const variables = {value: "{\"link\" : {\"url\":\"https://ntd.com/trump-to-offer-optimistic-vision-in-state-of-the-union-address_284634.html\",\"text\":\"THE_TEXT_YOU_WANT_TO_SHOW\"}}"}

or the jsonstringify way: 

const value = JSON.stringify({link: {url: "THELINK", text: "THETEXT" } })
const variable = {value: value}

The column values is very strict on how it’s stringified, but it’s easier when you use JSON.stringify(). I suggest referring to here to get more information on column values: https://monday.com/developers/v2#column-values-section

Good luck. I hope that helped.

1 Like

Thank you. Let me try.

Once again, our friendly neighborhood chili-fan AKA @pepperaddict does it again :slight_smile: Thanks so much for your friendly and clear input here, I love your contributions to the community.

@HLin

Please let us know if you need any further assistance, we’d love to make sure this is working for you.

-Alex

1 Like