Skip to main content
Solved

Create Field API End Point

  • October 6, 2023
  • 2 replies
  • 73 views

Forum|alt.badge.img+3

Hi everyone, 

Excited to be using the Airtable API!

I'm trying to add new fields to a given table in a given base via this endpoint, but keep getting a 404 {'error': 'NOT_FOUND'}

Here's my code:

payload = json.dumps(payload)
response = requests.get("https://api.airtable.com/v0/meta/bases/{base_id}/tables/{table_id}/fields".format(base_id=base_id,table_id=table_id),
headers={"Authorization":"Bearer {token}".format(token=API_TOKEN),"Content-Type": "application/json",},
data=payload)
 
Could anyone advise?

Best answer by kuovonne

Can you tell a little more about where this code came from,  what language you are using, and how you are running it?

These issues jumped out at me. There may be other issues.

- You are using GET request instead of a POST request.

- You are using an API key, which is not supported for creating fields. You should use a personal access token (or oAuth) instead.

2 replies

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • Answer
  • October 6, 2023

Can you tell a little more about where this code came from,  what language you are using, and how you are running it?

These issues jumped out at me. There may be other issues.

- You are using GET request instead of a POST request.

- You are using an API key, which is not supported for creating fields. You should use a personal access token (or oAuth) instead.


Forum|alt.badge.img+3
  • Author
  • New Participant
  • October 10, 2023

Thank you so much! Yes, my bad, I changed this to a post request, and it works now. I was using a personal access token, but realize the labeling was probably confusing. Will fix.

This code is in python, I'm running it within a script.