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

Hi. Thanks for your help. We tested and got http code of 200, but no result in Monday record.
The string we sent:

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

We tested and got http code of 200, but no result in Monday record. Does anyone know what happened? How can we get a record on Monday.com?
The string we sent is this:

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

Hey sorry for the late reply.
Did you already manage to get it?

I see a bunch of things wrong with the code, but I can’t tell if it was changed due to you copying and pasting or your line of code is really like that. How are you sending it in? Are you using monday’s api? When pasting your code in the forum could you surround it with backticks.
One line of code you just need one backtick. If you have multiple lines of code you use 3 backticks.

I suggest testing it out in playground using your token here: https://monday.com/developers/v2/try-it-yourself

Good luck.

1 Like

Hey @HLin - would you mind updating / posting your code using backticks like @pepperaddict suggested? I suspect the forum formatting may have modified the code in your original post. That way we can continue to troubleshoot this.

1 Like

I’m attaching a screenshot of the code. Maybe that’s better to see.

Hi, i’ve replied above. Sorry for the late reply. It seems I don’t get any notification when my posts gets a reply, so I didn’t see you replied a while ago.

Hey @Hilary
Thanks for the update. Hmm. Is the \n necessary?
How are you sending the data? Are you using Monday’s API or other? What language are you using? Could we see the whole code when it comes to sending in the request? You don’t need to take a screen shot.
You can surround it with backticks. Use three backticks for multiple lines of code.
Did you test your request in the GraphQL playground and if so, did it work?

By any chance were you able to test this code on the GraphQL playground to see if it works? I suspect this may be an issue related to the formatting on some of the column values (depending on the programming language, it might be easier to use variables as our quickstart guides use).

Could you let us know what language you are using?

-Daniel

Sorry for the late reply. We use php. Are there any demo programs with apiv2 in php?

Sorry for the late reply. We use php. Are there any demo programs with apiv2 in php?