Getting "Invalid DNS record type" with correct format of JSON

Hello, I’m trying to make a python script that edits all of my A records to have my IP address. I programatically get the zone and record ID (and made sure it always gets only the A record).

This is the call to edit the record (as a test):

edit_response = requests.put("{}/dns_record/{}".format(zone_id, a_record["id"]),
	headers={"Content-Type":"application/json", "Authorization":"Bearer {}".format(zone_editor_token)},
	params={"type":"A","name":a_record["name"], "Content":""})

Checked the JSON multiple times and it is of correct format. Tried capitalizing the first letter of the keys, changing the “name” parameter for a constant that I know exists, manually changing it and going into my “Audit Log” and then checking the parameters in the meta section as recomended by this other thread about the same error, and many other things.

Is this a bug? Or is there something I’m not seeing.


Just solved it. The mistake was very dumb.

When using the requests library you’re supposed to send the parameters using “data={}” and not “params={}”.

Or in this case you have to use “json={}”.