"No Query String Present" for Python-based queries

Hey @jmeehan – welcome to the community!

I built a little Python program last week and used this function to create a new item. Looks like I’m also passing the data as a dict, and works fine:

def add_to_board(name, status="", high_tag="", low_tag="", link=""):
	headers = {"Authorization" : monday_key}
	monday_url = 'https://api.monday.com/v2'
	
	# store column data in a dict
	column_data = {"link" : {"url" : link, "text" : "ZD Link"}, "status1" : status, "high_level9" : high_tag, "low_level3" : low_tag}

	# store request body in a dict, including variables
	req_data = {"query" : "mutation($name: String!, $columns: JSON!)\
				{create_item(item_name:$name, board_id:XXXX, column_values:$columns) \
				{name id column_values {id value}}\
				}",

                # send columns as a variable to prevent string manipulation
				"variables" : {"name" : name, "columns" : json.dumps(column_data)}} 

	r = requests.post(url=monday_url, json=req_data, headers=headers)
	if r.status_code != 200:
		print('Status:', response.status_code)
		raise Exception("Add to board failed.")

Let me know if that helps! I’ll post the rest of my code as a little example and tutorial later this week :slight_smile: