I am unable to get the introductory API script from the Monday documentation to work. Can someone look at this short script and point out the issue? Even better, could someone run the script on their own system (with their own token) and tell me whether it works for them?
I want to pull information from some of my Monday boards using Python. I am unable to get past the first step, which is to successfully get a request returned from the API.
I am using the sample python script from this page: https://developer.monday.com/api-reference/docs/getting-started
That article suggests that I enable developer mode. I am not able to enable it based on my work account permissions. However, I can go to the Developer Center page and get my GraphQL API token, which is a 227 character string.
The article gives an introductory example in various languages. The python example is an 11 line script.
I replaced YOUR_API_KEY_HERE with my 227 character API token and added three print statements for testing. The resulting script is (with the token removed for privacy):
import requests
import json
apiKey = "removed for this post"
apiUrl = "https://api.monday.com/v2"
headers = {"Authorization" : apiKey, "API-Version" : "2023-04"}
query2 = 'query { boards (limit:1) {id name} }'
data = {'query' : query2}
print("***Ready for the request call.***")
r = requests.post(url=apiUrl, json=data, headers=headers)
print("***Returned from the request call.***")
print(r)I am using uv. To run the script, I type "uv run apisample.py" and the result displayed is:
***Ready for the request call.***
***Returned from the request call.***
<Response [504]>
It takes a full minute for the script to run so I assume [504] is a timeout error.
Any help is appreciated. Thank you.