alexmat
(alex)
April 8, 2020, 12:44pm
1
Hello
I try to update a column value for an item but I have a strange error. My column type is numeric, here the code I use (python) :
import requests
token = "xxx"
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': token
}
url = "https://api.monday.com/v2/"
mutation_query = """
mutation {
change_column_value(
board_id: 123,
item_id: 123,
column_id: "numbers53",
value:"\"3\"") {
id
}
}
"""
response = requests.post(
url,
json={"query": mutation_query},
headers=headers)
print(response.status_code)
print(response.json())
And here the response I get :
{'errors': [{'message': 'Parse error on "3" (INT) at [7, 16]', 'locations': [{'line': 7, 'column': 16}]}], 'account_id': xxx}
Is the value I send to the API correctly formatted ?
Hi @alexmat ,
I do not have experience with python, but the values you supply in the mutation for board_id and item_id do not look like real id’s. Is that on purpose, just to show here? The board_id can we derived from the address bar of your browser and the item_id can be found in a column named PulseID
Have fun,
alexmat
(alex)
April 9, 2020, 6:23am
3
Yes of course I put fake ids on purpose for the example
basdebruin
(Bas de Bruin)
April 9, 2020, 12:33pm
4
Hi Alex,
The Phyton code generated from a working Postman request is:
import requests
url = “https://mycompany.monday.com/v2 ”
payload = {‘query’: ‘mutation {change_column_value(board_id: 524382854, item_id: 524382857, column_id: numbers, value:“\“3\””) {id}}’}
files = [
]
headers = {
‘Authorization’: ‘my_secret_monday_token’
}
response = requests.request(“POST”, url, headers=headers, data = payload, files = files)
Hope this helps a bit. Postman is wonderful for testing
dipro
(Dipro Bhowmik)
July 16, 2020, 4:35pm
5
If it’s helpful, here is a quickstart tutorial for Python with our API: Quickstart