Add new item under specific group

Hello.
I would like to know how to add a new item under a specific group.
In the board i’m trying this API request on, the group name is ‘Email notifications’.

The API request i’m trying to make is this (with python):

query = 'mutation ($myItemName: String!, $columnVals: JSON!) ’
'{ create_item (board_id:%s, group_id:“Email notifications”, ’
‘item_name:$myItemName, column_values:$columnVals) { id } }’ % int(
MONDAY_BOARD_ID)

data = {‘query’: query, ‘variables’: {‘myItemName’: task_name,
‘columnVals’: json.dumps({‘date4’: {‘date’: str(date.today())}})}
}

res = requests.post(url=MONDAY_API_URL,
json=data,
headers={“Authorization”: MONDAY_API_TOKEN})

This returns:
res.json():
{‘error_code’: ‘ResourceNotFoundException’, ‘status_code’: 404, ‘error_message’: ‘Group not found’, ‘error_data’: {‘resource_type’: ‘group’, ‘group_id’: ‘Email notifications’, ‘board_id’: 946219731, ‘error_reason’: ‘store.monday.automation.error.missing_group’}}

I understand that i need to use a different parameter for group_id, but I can’t find it anywhere.

How can I make sure the item I am creating ends up under the ‘Email notifications’ group?

I’ll answer my question:

to find the group_id for a given board, run this query in the developers playground (or use the API):

{
boards(ids: [YOUR_BOARD_ID]) {
name
id
description
groups {
id
items {
id
name
}
}
}
}

you can identify the correct group by the tasks name.

1 Like