0

Hi I have this cURL request that I have been trying and failing to get it right, it gives me a 500 Error (Internal Error)

Please see my curl request below:

curl --location --request POST "https://api.monday.com/v2" --header "Authorization: XXXXX" --header "Content-Type: application/json" --data-raw "{\"query\":\"mutation { create_item (board_id: 1622487816,group_id: \"emailed_items\", item_name: \"Test from Curl\") { id } }\"}" -v

I get back an empty object as a response but on the response header I see a 500 error message

enter image description here

Mxolisi
  • 63
  • 1
  • 1
  • 7

2 Answers2

1

Make sure your quotes are nested and escaped properly.

Your code:

"{\"query\":\"mutation { create_item (board_id: 1622487816,group_id: \"emailed_items\", item_name: \"Test from Curl\") { id } }\"}"

You are right to begin with a double quote and you are right to escape the first set of quotes within those quotes.

However, when you get further in the query, "emailed_items" also needs to be escaped, but since you are already in a set of quotes, you actually need three backslashes.

Corrected code:

"{\"query\":\"mutation { create_item (board_id: 1622487816,group_id: \\\"emailed_items\\\", item_name: \\\"Test from Curl\\\") { id } }\"}"
Jennifer Goncalves
  • 1,442
  • 1
  • 12
  • 29
0

Make use of the npm package for monday.com queries. One such package is monday-sdk-js

Assigning parameters could be confusing thus make use of this package which takes query as a parameter and makes things easy.

sakigo
  • 95
  • 8