Create Item from Zoho Deluge Environment

Hi all! I wanted to create an item in monday.com but upon calling the API, it returns a parsing error. The query string is the one in the documentation but still gives an error. If i remove the column values data, it successfully creates an item. Please help!! Here’s my query:

params = Map();
// Define your GraphQL mutation query
mutationQuery = “mutation { create_item(board_id: 12345566, group_id: "topics", item_name: "testonly", column_values: "{\"text8\":\"TESTONLY\"}") { id }}”;
params.put(“query”,mutationQuery.toString());
// Define the API headers with your API key
headers = Map();
headers.put(“Content-Type”,“application/json”);
headers.put(“Authorization”,“MY API KEY”);
// Make the API request using invokeurl
response = invokeurl
[
url :“https://api.monday.com/v2
type :POST
parameters:params
headers:headers
];
info response;

[quote=“Jubel Alferez CoveredCA, post:1, topic:83792, full:true, username:jubelalferez”]
Hi all! I wanted to create an item in but upon calling the API, it returns a parsing error. The query string is the one in the documentation but still gives an error. If i remove the column values data, it successfully creates an item. Please help!! Here’s my query:

params = Map();
// Define your GraphQL mutation query
mutationQuery = “mutation { create_item(board_id: 12345566, group_id: “topics”, item_name: “testonly”, column_values: “{"text8":"TESTONLY"}”) { id }}”;
params.put(“query”,mutationQuery.toString());
// Define the API headers with your API key
headers = Map();
headers.put(“Content-Type”,“application/json”);
headers.put(“Authorization”,“MY API KEY”);
// Make the API request using invokeurl
response = invokeurl
[
url :
type :POST
parameters:params
headers:headers
];
info response;
[/quote]

Hello, @jubelalferez

It looks like you’re encountering a parsing error with your GraphQL mutation query when using the monday. com API. This is often due to incorrect formatting of the query string, especially within the column_values JSON object. Here’s a corrected version of your query:
mutation {
create_item(
board_id: 12345566,
group_id: “topics”,
item_name: “testonly”,
column_values: “{"text8":"TESTONLY"}”
) {
id
}
}
Make sure that:

The board_id is correct and corresponds to an existing board.
The group_id exists within the specified board.
The column_values JSON is properly escaped. In your original query, the double quotes inside the JSON object need to be escaped with backslashes.
Here’s how you can set up your request in a more structured way:

var params = {
query: mutation { create_item( board_id: 12345566, group_id: "topics", item_name: "testonly", column_values: "{\\"text8\\":\\"TESTONLY\\"}" ) { id } }
};

var headers = {
“Content-Type”: “application/json”,
“Authorization”: “YOUR_API_KEY”
};

var response = invokeurl({
url: “https://api.monday.com/v2”,
type: “POST”,
parameters: params,
headers: headers
});

console.log(response);

Replace YOUR_API_KEY with your actual API key.

I hope my suggestion is hekpful for you.

Best Regard,
Ryan1969

Hi @ryan1969

This is my updated code. This is written in Zoho Deluge. Please advise. Thank you!

params = Map();
mutationQuery = “mutation { create_item(board_id: 1234567, group_id: \test_group", item_name: "itemtest", column_values: "{\"text8\":\"TEST1\"}") { id }}”;
params.insert(“query”:mutationQuery.toString());
// Define the API headers with your API key
headers = Map();
headers.put(“Content-Type”,“application/json”);
headers.put(“Authorization”,“my_api_key”);
// Make the API request using invokeurl
response = invokeurl
[
url :“https://api.monday.com/v2
type :POST
parameters:params.toMap()
headers:headers
];
info response;

image