Skip to main content

I am updating a board with items where I need to pass a date value to a date column. It keeps coming with parsing errors when reaching the column_values part of the query. I’ve gotten different parsing errors depending on where I escape and where I put quotes. som errors even generate a full html page for a technical issue page in monday. Here is my code:


headers = {"Authorization" : apiKey, "Content-Type": "application/json"}

date = valueu9:19]

query3 = '''mutation {create_item (board_id: 1135506612, group_id: "topics", item_name: "Finished W&D", column_values: "{\\"date1\\" : \\"%s\\"}") {id}}''' % (f'{date}')

data3 = {'query' : query3}

r3 = requests.post(url=apiUrl, json=data3, headers=headers)

response = r3.json()

The weird thing is, that when I post this into the playground, it creates a new item with the date.


mutation {create_item (board_id: 1135506612, group_id: "topics", item_name: "Finished W&D", column_values: "{\\"date1\\" : \\"2023-01-01\\"}") {id}}

What am I missing? Been working on this for way too long, and I’ve tried every possible combination of escaping and quoting.


A few parsing error examples:


{'errors': s{'message': 'Parse error on " " (STRING) at  1, 132]'

t{'message': 'Parse error on " : " (STRING) at  1, 132]', 'locations': s{'line': 1, 'column': 132}]}]

For anyone finding this, I solved it, this is the correct query:


query3 = '''mutation {create_item (board_id: 1135506612, group_id: "topics", item_name: "Finished W&D", column_values: "{\\\\\\"date1\\\\\\" : \\\\\\"%s\\\\\\"}") {id}}''' % (f'{date}')

Hello @PatrickAPI and welcome to the community!


I am glad you found the issue!


Let us know if you have any other questions 🙂


Cheers,

Matias


Reply