Monday Post API integration - with Custom POC Application

Hi Team,

We are accessing Monday API to send data from Custom POC application to Monday.com board.

We are able to pass item name value via our code through API call

Running Code:

let query3 = ‘mutation{ create_item(board_id: 3106812303, item_name: “new item”) { id }}’;
fetch(“https://api.monday.com/v2”, {
method: ‘post’,
headers: {
‘Content-Type’: ‘application/json’,
‘Authorization’: ‘YOUR_TOKEN’
},
body: JSON.stringify({
‘query’: query3
})
})
.then(res => res.json())
.then(res => console.log(JSON.stringify(res, null, 2)));

but when we try to rest information of the board along with item name, it generates error.

Not Running Code:

let query3 = ‘mutation{ create_item(board_id: 3106812303, item_name: “new item”, column_values: “{“text”:“ready 3”}”) { id }}’;
fetch(“https://api.monday.com/v2”, {
method: ‘post’,
headers: {
‘Content-Type’: ‘application/json’,
‘Authorization’: ‘YOUR_TOKEN’
},
body: JSON.stringify({
‘query’: query3
})
})
.then(res => res.json())
.then(res => console.log(JSON.stringify(res, null, 2)));

error shows : {

“errors”: [
{
“message”: “Parse error on ":" (STRING) at [1, 88]”,
“locations”: [
{
“line”: 1,
“column”: 88
}
]
}
],
“account_id”: 8500196
}

Board Structure is :

Please suggest why this error came up.

Regards

Ashish Tiwari

Hello @knpashish!

I have edited your post to erase a big portion of your API key since you should not be sharing that information publicly.

It looks like your issue might lie on you not escaping outer quotes in your mutation. This should work for you:

mutation{ create_item(board_id: 3106812303, item_name: "new item", column_values: "{\"text\":\"ready 3\"}") { id }}

Let me know what happens!

Hi Team ,
Thanks for your response . we have applied the code below as suggested

let query3 = ‘mutation{ create_item(board_id: 3106812303, item_name: “new item”, column_values:“{"text":"ready 3"}”) { id }}’;
fetch(“https://api.monday.com/v2”, {
method: ‘post’,
headers: {
‘Content-Type’: ‘application/json’,
‘Authorization’: ‘Token’
},
body: JSON.stringify({
‘query’: query3
})
})
.then(res => res.json())
.then(res => console.log(JSON.stringify(res, null, 2)));

But still we are getting error from Mondy.com Api response
Error:
{
“errors”: [
{
“message”: “Parse error on ":" (STRING) at [1, 87]”,
“locations”: [
{
“line”: 1,
“column”: 87
}
]
}
],
“account_id”: 8500196
}

if we are missing any thing please let me know .

Hello there @knpashish!

I can see you are not using the same code as I sent. You have to use the backslashes as in my example “{"text":"ready 3"}”

Also, I see you have two different types of quotes for some reason. Maybe it is because of how the copy/paste looks like, but just in case, you should always use regular quotes.

Hope that helps!

Cheers,
Matias

Hi Team ,
Thanks for your response . we have applied the code below as suggested

let query3 = ‘mutation{ create_item(board_id: 3106812303, item_name: “new item”, column_values:“{\“text\”:\“ready 3\”}”) { id }}’;
fetch(“https://api.monday.com/v2”, {
method: ‘post’,
headers: {
‘Content-Type’: ‘application/json’,
‘Authorization’: ‘Token’
},
body: JSON.stringify({
‘query’: query3
})
})
.then(res => res.json())
.then(res => console.log(JSON.stringify(res, null, 2)));

But still we are getting error from Mondy.com Api response
Error:
{
“errors”: [
{
“message”: “Parse error on ":" (STRING) at [1, 87]”,
“locations”: [
{
“line”: 1,
“column”: 87
}
]
}
],
“account_id”: 8500196
}

Hi @knpashish,

The problem with the query is with the type of quote being used.

This type of quote:

Is different from this type of quote:

"

And it is causing the parsing error.

Please change the quotes in your query to use this quote:

"

To look like this:

mutation { create_item (board_id: 3106812303, item_name: "new item", column_values: "{\"text\" : \"ready 3\"}" ) { id }}

Please let us know if this is helpful :slight_smile:

Hi ,
we are using same quote which you have applied on your mutation , but when we past in our mutation in Monday.com reply editor (here) so it automatic change , and we are getting same error after using your suggested code with correct quotes mark
error :
{
“errors”: [
{
“message”: “Parse error on ":" (STRING) at [1, 87]”,
“locations”: [
{
“line”: 1,
“column”: 87
}
]
}
],
“account_id”: 8500196
}

Hello again @knpashish!

It is very probable that the use of the wrong quotes and/or not using the backslashes is the issue here, but please schedule a call with us here so we can solve it live with you.

Cheers,
Matias

Hi ,
Thanks now its working

1 Like