apiKey = “MySecretKey”
apiUrl = “https://api.monday.com/v2”
headers = {“Authorization” : apiKey}
########
query5 = ‘mutation ($myItemName: String!, $columnVals: JSON!) { create_item (board_id:myBoard_ID, item_name:$myItemName, column_values:$columnVals) { id } }’
vars = {
‘myItemName’ : billingAddressVariable, #works as is, variable
‘columnVals’ : json.dumps({
'WorkID : {‘value’ : workIDVariable}, #does not work, variable
‘Ticket#’ : {‘text’ : ticketNumberVariable}, #does not work, variable
‘status’ : {‘label’ : 'Working on it '}, #works as is; constant
‘date4’ : {‘date’ : dueDateVariable} #works as is; variable
})
}
data = {‘query’ : query5, ‘variables’ : vars}
r = requests.post(url=apiUrl, json=data, headers=headers) # make request
print(r.json())
No errors, date and status columns fill no problem, same with myItemName. This is but one of many attempted formats of implementation. Nothing changes. Ticket# and WorkID refuse to fill. I am using official docs as far as I am able.
Thanks, I’m glad to be here. And thanks for taking some time to assist. I’m still not getting WorkID and Ticket# to post to the generated items on the board.
apiKey = "MySecretKey"
apiUrl = "https://api.monday.com/v2"
headers = {"Authorization" : apiKey}
########
query5 = 'mutation ($myItemName: String!, $columnVals: JSON!) { create_item (board_id:3467404663, item_name:$myItemName, column_values:$columnVals) { id } }'
vars = {
'myItemName' : billingAddress,
'columnVals' : json.dumps({
'WorkID' : workIDVariable, #still not working, variable
'Ticket#' : ticketNumberVariable, #still not working, variable
'status' : {'label' : 'Working on it'}, #works as is, constant
'date4' : {'date' : date} #works as is, variable
})
}
data = {'query' : query5, 'variables' : vars}
r = requests.post(url=apiUrl, json=data, headers=headers) # make request
print(r.json())
Still no errors, date, status and item name columns fill. I know the workID and ticket# variables aren’t empty, I print all variables to the console to make sure of it. Thanks!
Nevermind, I just figured it out. Just learned about column IDs and why date4 is what it is and how to find them. I kept googling to find additional topics and found a topic by leokushnir in June '20 with a similar issue that you @Matias.Monday solved for me by mentioning actual column ID’s. So thanks for that! I also didn’t realize a developer account won’t have developer mode enabled by default .
Keep on your toes, because I’ll probably come back with more questions!
Edit: for solution thanks to @Matias.Monday 2 years ago:
Edit column values by enabling developer mode. Click on your avatar on bottom left, go to monday.labs, enable developer mode. Now when you click on a column the Id will be visible. Use that for column value pairs like so: {column_ID : myColumnValue} or {numbers6: aNumber}.
Here is my solution for anyone else: