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.
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.
It's not working either.
I made a simple fetch request in an extension like below and its throwing error too.
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
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.
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.
* ScopesWith this token, you will be able to:
I have done both.
* ScopesWith this token, you will be able to:
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));
@msafi04 MyEnvoyAir wrote:
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
Have you checked if your API endpoint and headers are correct? Also, make sure you have a valid personal access token in the "Authorization" header. If you've done all that, please provide more details about the error message or any specific issues you're facing.
Hi, thank you for your response. This is my code
const headers = {
Authorization: "Bearer API_KEY",
"Content-Type": "application/json",
};
const options = {
method: "GET",
headers: headers,
};
const response = await fetch(airtableURL, options);
const tableData = await response.json();
console.log(tableData);
This the error
Uncaught (in promise) TypeError: Failed to fetch
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