Jun 28, 2020 07:33 PM
when i create records,got a reeor about Authentication,the message is:{“error”:{“type”:“AUTHENTICATION_REQUIRED”,“message”:“Authentication required”}}
this is my code and data:
url = “https://api.airtable.com/v0/appjiuXPDkRCdDkhs/Pipeline”
h = {
“Authorization”:“keyE5yxxxxxxxxgb0x3”,
“Content-Type”:“application/json”
}
data_list = {“records”: [{“fields”: {“Name”: “a”, “Priority”: 3}}]}
print(requests.post(url,data=json.dumps(data_list),headers=h).text)
Jun 29, 2020 05:04 AM
You’re not using the right syntax for any of those lines.
Go to https://www.airtable.com/api and it will give you the appropriate syntax to use for each one of your bases and for each function you want to perform.
Jun 29, 2020 05:45 AM
I developed it based on the API
Can you tell me what’s wrong
Jun 29, 2020 05:48 AM
On first glance, it looks a bit odd until you realize this is Python.
Hi @wenju_fan, and welcome to the community!
I believe this is Python because the json.dumps()
method caught my eye and this only exists in Python. Can you confirm this is Python?
I believe the issue is in the header - change it to this:
'Authorization' : 'Bearer ' + cAirtableAPIKey,
Jun 29, 2020 05:58 AM
Thank you, @Bill.French!
Jun 29, 2020 06:57 AM
Yeah,this is python
as you said,I tried this:
Jun 29, 2020 07:02 AM
If you have a demo,i will appreciate it if you can send me a copy
thanks
Jun 29, 2020 07:35 AM
Okay - let’s be sure about your code - can you publish the latest version?
Oct 23, 2020 03:10 PM
the syntax looks fine. Probably you got the key or the url wrong.
Jan 20, 2022 03:06 PM
I’m running into the same issue when making any API call in the iOS Shortcuts app on my iPhone, but it works fine with curl and Postman, and even Shortcuts on my Macbook.
endpoint: https://api.airtable.com/v0/appw8uXq7gglhzgE5/Dictionary
header: “Authorization”:“keyxxxxxxxxxxxxx8Ng”,
I’ve double and triple checked and copypasted the url and key between the apps where it works and the ones where it doesn’t, but nothing changes