curlmonday.com

How to add multiple text values in single API call in monday.com


I need to add multiple text values to my group on monday.com. How can I achieve that? The below code is working fine for single-column insertion

curl -X POST \
  https://api.monday.com/v2/ \
  -H 'Accept: */*' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ0aWQiOjE4NDcyNDg1LCJ1aWQiOjk2MDE3NDUsImlhZCI6IjIwMTktMDc' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -d '{
   "query" :"mutation {create_item (board_id: 279985058, group_id: \"incoming_request\", item_name: \"Apple\", column_values:\"{\\\"text\\\":\\\"jihin\\\"}\") {id}}"
}
'

Solution

  • I got the solution, use column id to insert values

    curl -X POST \
      https://api.monday.com/v2/ \
      -H 'Accept: */*' \
      -H 'Accept-Encoding: gzip, deflate' \
      -H 'Authorization: eyJhbGciOiJIUzI1NiJ9.NDcyNDg1LCJ1aWQiOjk2MDE3NDUsImlhZCI6IjIwMTktMDc' \
      -H 'Cache-Control: no-cache' \
      -H 'Content-Type: application/json' \
      -H 'cache-control: no-cache' \
      -d '{
       "query" :"mutation {create_item (board_id: 279985058, group_id: \"incoming_request\", item_name: \"Apple\", column_values:\"{\\\"text_column_id\\\":\\\"jihin\\\"}\") {id}}"
    }'
    

    Use this to get column ids

    curl -X POST \
      https://api.monday.com/v2/ \
      -H 'Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ0aWQiOjE4NDcyNDg1LCJ1a.x_rgVRieSHvzbidQbFw9v8qmnIREubYpundTmbfQDKU' \
      -H 'Content-Type: application/json' \
      -H 'Postman-Token: 551e9ec4-d442-4310-88a9-c19f16407e90' \
      -H 'cache-control: no-cache' \
      -d '{
       "query" :"{boards (ids: 279985058) { columns { id title type } }}"
    }
    '