I am trying to create a python script that reads an XML file and imports the data to Monday.com Board.
I have the XML scraper built, now i need to learn the API side…
I have this example working without the 2 “Text” fields,
After i added the 2 text fields I get a ‘error_code’: ‘ColumnValueException’,
Can someone please help me understand why this error is happening? even chatGPT agree’s it should work but isnt…
MY CODE BELOW
Creating a new item with column values populated
apiKey = "apikey here"
apiUrl = "https://api.monday.com/v2"
headers = {"Authorization": apiKey}
query5 = 'mutation ($myItemName: String!, $columnVals: JSON!) { create_item (board_id:3716595122, item_name:$myItemName, column_values:$columnVals) { id } }'
vars = {
'myItemName': 'Item 1',
'columnVals': json.dumps({
'status': {'label': 'Working on it'},
'date4': {'date': '2022-12-31'},
'text': {'text': 'text here'},
'text1': {'text': 'text here'}
})
}
data = {'query': query5, 'variables': vars}
r = requests.post(url=apiUrl, json=data, headers=headers)
# make request
pprint(r.json())
MY ERROR BELOW
{‘error_code’: ‘ColumnValueException’,
‘error_data’: {‘column_type’: ‘TextColumn’, ‘column_value’: ‘{“text”=>“”}’},
‘error_message’: 'invalid value, please check our API documentation for the ’
'correct data structure for this column. ’
‘Guide to Changing Column Values’,
‘status_code’: 200}
Board Dump returns this
‘items’: [{‘column_values’: [{‘id’: ‘status’,
‘text’: ‘Working on it’,
‘title’: ‘Status’,
‘type’: ‘color’},
{‘id’: ‘date4’,
‘text’: ‘2022-12-31’,
‘title’: ‘Date’,
‘type’: ‘date’},
{‘id’: ‘text’,
‘text’: ‘’,
‘title’: ‘Text’,
‘type’: ‘text’},
{‘id’: ‘text1’,
‘text’: ‘’,
‘title’: ‘Text 1’,
‘type’: ‘text’}],
‘name’: ‘Item 1’},