I have to upload a file to Airtable. I don’t quite understand the documentation for file upload. I have this code that is in python that should upload a file to airtable via a link but it gives me a 422 error. How can I fix this?
ATBASEID = "****************************"
ATTABLENAME = "DEV"
AIRTABLE_API_KEY = "*************************"
ENDPOINT = "https://api.airtable.com/v0/" + \
ATBASEID + "/" + ATTABLENAME
HEADERS2 = {"Authorization": f"Bearer {AIRTABLE_API_KEY}", "Content-Type": "application/json"}
data2 = [
{
"id": "attqyuWADmKW9DgDG",
"size": 26317,
"url": "https://www.filepicker.io/api/file/5YTJXioCQG0tYWPw6OPw",
"type": "image/jpeg",
"filename": "33823_3_xl.jpg",
"thumbnails": {
"small": {
"url": "https://www.filepicker.io/api/file/Dy5gioxaShSUvHX0LgIC",
"width": 54,
"height": 36
},
"large": {
"url": "https://www.filepicker.io/api/file/ueYi00yRiqhuUn420UZA",
"width": 197,
"height": 131
}
}
}
]
r_1 = requests.patch(ENDPOINT, json=data2, headers=HEADERS2)
print(r_1.status_code)
All help is greatly appreciated.