Help

400 Bad Request in Postman GET

Solved
Jump to Solution
4386 12
cancel
Showing results for 
Search instead for 
Did you mean: 
msafi04
5 - Automation Enthusiast
5 - Automation Enthusiast

I am trying to do a simple GET request using Airtable API in Postman to retrieve my records. But it's not working. I am a newbie here, any help is much appreciated.

GET: https://api.airtable.com/v0/appkEdlvHkUVyG1QC/Sample%201?maxRecords=3

Headers: "Authorization": Bearer Personal_Access_token

1 Solution

Accepted Solutions
msafi04
5 - Automation Enthusiast
5 - Automation Enthusiast

silly mistake from my side

https://api/airtable.com/v0/${baseName}/${tableName}

should be https://api.airtable.com/v0/${baseName}/${tableName}

 

Thank you all for your response

See Solution in Thread

12 Replies 12
ScottWorld
18 - Pluto
18 - Pluto

 

You may want to specify either a formula or a view (or both).

This tool will help you create a valid GET request that you can use in Postman:
https://codepen.io/airtable/full/MeXqOg

Alternatively, for a no-code way of retrieving records from Airtable (or interacting with Airtable through its API), you can always use Make’s Airtable integrations.

@SeanKeenan may have more insights.

msafi04
5 - Automation Enthusiast
5 - Automation Enthusiast

Thank you @ScottWorld for your response. I tried your suggestion but its not working. 

https://api.airtable.com/v0/appkEdlvHkUVyG1QC/Sample%201?maxRecords=3&view=Grid%20view

ScottWorld
18 - Pluto
18 - Pluto

Then the problem seems to be with either your authorization or your personal access token.

Your quotation marks look incorrectly placed in your authorization example above, so I would play around with that.

Also, make sure that your personal access token is configured to give you access to what you want.

msafi04
5 - Automation Enthusiast
5 - Automation Enthusiast

It's not working either.

I made a simple fetch request in an extension like below and its throwing error too.

const url = "https://api/airtable.com/v0/appkEdlvHkUVyG1QC/Sample%201?view=Grid%20view";
const headers = {
"Authorization":
"Bearer MY_PERSONAL_ACCESS_TOKEN",
"Content-Type": "application/json",
};

const options = {
headers: headers,
method: "GET",
};
const api = await fetch(url, options);
const data = await api.json();
 
Uncaught (in promise) TypeError: Failed to fetch
 
 
ScottWorld
18 - Pluto
18 - Pluto

Did you check your personal access token settings?

Sorry, I don't know Javascript, so I can't help you there. I would try doing it with Make's Airtable modules because Make doesn't require any coding at all on your end. Then, after Make is successful, you can examine all the code that Make successfully sent to Airtable.

There can be a bit of a learning curve with Make, which is why I created this basic navigation video for Make, along with the links to a few other Make training resources.

msafi04
5 - Automation Enthusiast
5 - Automation Enthusiast

Yes I did. I have given read access to my particular base. 

Just in case, make sure that you've got it set for both "data.records:read" and "schema.bases:read".

If that doesn't work, I would try the Make route that I mentioned above.

msafi04
5 - Automation Enthusiast
5 - Automation Enthusiast

ScopesWith this token, you will be able to:

  • data.records:read
    See the data in records
  • data.recordComments:read
    See comments in records
  • schema.bases:read
    See the structure of a base, like table names or field types

I have done both.

Here, this code works for me within a scripting extension.  Once you've swapped out "YOUR_TOKEN" you should be good to go

Could you provide a screenshot of the relevant table and view as well?

If this doesn't work DM me an invite link to your base and I'll take a look at it for you

 

var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer YOUR_TOKEN");

var requestOptions = {
 method: 'GET',
 headers: myHeaders,
 redirect: 'follow'
};

await fetch("https://api.airtable.com/v0/appkEdlvHkUVyG1QC/Sample%201?maxRecords=3", requestOptions)
 .then(response => response.text())
 .then(result => console.log(result))
 .catch(error => console.log('error', error));