Help

Re: API Error in React with axios

Solved
Jump to Solution
3844 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Antonina
4 - Data Explorer
4 - Data Explorer

Hello!
I am getting error while requesting api - using your javascript example

var Airtable = require('airtable'); 
var base = new Airtable({apiKey: 'YOUR_API_KEY'}).base('XXXXXXXXXXXXXXX');
base(
'Settings').find('recKrP4fJsCmnavbd', function(err, record) {
if (err) { console.error(err); return; }
console.log('Retrieved', record.id); });

Spoiler
GET https://api.airtable.com/v0/undefined/Settings/recKrP4fJsCmnavbd? 404
AirtableError {error: 'NOT_FOUND', message: 'Could not find what you are looking for', statusCode: 404}






1 Solution

Accepted Solutions

"the very beginning" meaning the first line of the code that you posted? If so, that's likely an indicator that the environment where the React code is running isn't on a Node.js server. The require() function will only work when running the script on a Node.js server. On top of that, you would need to install the "airtable.js" module onto the server from the link provided in the API docs.

See Solution in Thread

4 Replies 4

Could you please share more details about where and how you're trying to use this code? The code itself isn't providing any clues as to the source of the problem.

I got the code from the Airtalbe Help API.
I want to use this code on a React website in order to read the data.
I have a problem from the very beginning - the API returns an error.

"the very beginning" meaning the first line of the code that you posted? If so, that's likely an indicator that the environment where the React code is running isn't on a Node.js server. The require() function will only work when running the script on a Node.js server. On top of that, you would need to install the "airtable.js" module onto the server from the link provided in the API docs.

Thank you, Justin.
Today I found confirmation of your remark in the video on YouTube - but I did not have time to check it. I think everything will work fine now.