Hi, I have been struggling with this API, it could just be me but I don’t find the docs very useful.
I find the use of $ in variables names (within the examples) odd (in python context) and am not sure if they have any significance, I removed them and got different errors so I’m guessing they have.
I am attempting to get particular dashboard columns updated. This was the attempt (I cant see anything to mark text as code so apologies if this isn’t formatted as expected.
import requests
import jsonapiKey = “value”
apiUrl = “https://api.monday.com/v2”
headers = {“Authorization” : apiKey}query5 = ‘mutation ($myItemName: String!, columnVals: JSON!) { create_item (board_id:BOARDID, item_name:$myItemName, column_values:$columnVals) { id } }’
vars = {
‘$myItemName’ : ‘Test’,
‘$columnVals’ : json.dumps({
‘text0’: ‘Title’,
‘text’: ‘Company’,
‘status’: ‘Customer’,
‘status5’: ‘High’,
‘phone’: ‘01234567890’,
‘email’: ‘Test@mail.com’,
‘date’: {‘date’ : ‘2020-08-27’},
‘text4’: ‘Lots of notes’
})
}data = {‘query’ : query5, ‘variables’ : vars}
r = requests.post(url=apiUrl, json=data, headers=headers) # make request
print(r.json())
This of course doesn’t work, the error being
{‘errors’: [{‘message’: ‘Parse error on “columnVals” (IDENTIFIER) at [1, 33]’, ‘locations’: [{‘line’: 1, ‘column’: 33}]}], ‘account_id’: REMOVED}