Authentication required

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)

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.

I developed it based on the API

Can you tell me what’s wrong

image002.jpg

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,

1 Like

Thank you, @Bill.French!

Yeah,this is python
as you said,I tried this:

image002.jpg

If you have a demo,i will appreciate it if you can send me a copy

thanks

image002.jpg

Okay - let’s be sure about your code - can you publish the latest version?