Feb 13, 2021 02:37 AM
I just got metadata api and I’m trying to connect it with my airtable and get data but it is not connecting and keeps throwing me errors.
HelloWorld = () => {
axios
.get(
"https://api.airtable.com/v0/mykey" + "/" + 'Table 1',
{ headers: { Authorization: "Bearer " + 'api-key-from-airtable' } },
)
.then(resp => console.log(resp))
.catch(error => console.log(error))
}
This throws the error of Error: Request failed with status code 404 and 404 not found.
I tried performing a GET request on postman as well but it still did not work.
Feb 13, 2021 11:22 AM
myKey is the problem.
Feb 14, 2021 12:51 AM
At myKey I add airtable metadata key I got, what’s wrong with it?
Feb 14, 2021 06:02 AM
Your code suggests the URL you are making the request to is this - and this will almost certainly cause a 404 error.
https://api.airtable.com/v0/mykey/Table 1
Even if we assume “myKey” is something other than what you have shown, “Table 1” is not URL encoded, yet again, almost certainly why you would see a 404 result code.
Feb 15, 2021 12:48 AM
How do I call it then?
Feb 15, 2021 05:46 AM
The table name must be URI Encoded like this.
"https://api.airtable.com/v0/mykey" + "/" + encodeURI('Table 1')
Dec 07, 2023 07:00 AM - edited Dec 07, 2023 07:01 AM
1)
https://api.airtable.com/v0/<myApiKey>/Table 1
does not work for me too, what is working:
a) request
https://api.airtable.com/v0/meta/bases/INSERT_BASE_ID_HERE/tables
b) in returned JSON find a table by name in tables array.
More: https://airtable.com/api/meta
2) apiKey is not suitable for Metadata calls, what is required - Personal access token, make one here: https://airtable.com/create/tokens