I have a dashboard in which I am creating new items with a Python script.
The group I am creating items in has columns I would like to be populated with data as soon as an item is created.
This is an example of how i’d like one of the columns to look after creating the item (This was done manually):
"column_values": :
{
"id": "status_2",
"title": "Who has the ball",
"text": "Customer",
"value": "{\\"index\\":7,\\"post_id\\":null,\\"changed_at\\":\\"2021-02-17T09:16:52.085Z\\"}",
"type": "color",
"additional_info": "{\\"label\\":\\"Customer\\",\\"color\\":\\"#fdab3d\\",\\"changed_at\\":\\"2021-02-17T09:16:52.085Z\\"}"
},
This is the code, which is obviously not working:
query = 'mutation ($myItemName: String!, $columnVals: JSON!) ' \\
'{ create_item (board_id:%s, group_id:"%s", ' \\
'item_name:$myItemName, column_values:$columnVals) { id } }' % (
board_id, group_id)
data = {'query': query, 'variables':
{'myItemName': task_name,
'columnVals': json.dumps(s{'date4': {'date': str(date.today())}},
{"status_2": "{\\"label\\":\\"Customer\\",\\"color\\":\\"#fdab3d\\"}"}])}
}
res = requests.post(url=MONDAY_API_URL, json=data, headers={"Authorization": MONDAY_API_TOKEN})
It creates an item with the columns i’d like updated blank (The date4 is created Ok).
Any help would be appreciated.