Integrating Google Sheets and RapidAPI
I am attempting to work with APIs for the first time and thought it would be a straightforward task to set up a Google Sheet that fetches movie details based on their titles.
I discovered that RapidAPI offers an add-on for Google Sheets, but I’ve struggled to find comprehensive documentation and have encountered some roadblocks.
What I’ve Discovered So Far
There appears to be a single implementation example using the =FETCH() function to pull financial data, demonstrated like this:
=FETCH("https://api.example.com/stock/{ticker}/info", "data.company", "YOUR_API_KEY", "ticker", "GOOGL")
Unfortunately, I couldn’t get this example functioning, and the code snippet for retrieving IMDB data looks a bit varied, particularly concerning the use of curly braces around {ticker}.
var fetch = require("node-fetch");
var settings = {
method: 'GET',
headers: {
'x-rapidapi-host': 'example-api.p.rapidapi.com',
'x-rapidapi-key': 'YOUR_API_KEY_HERE'
}
};
fetch('https://example-api.p.rapidapi.com/title/search?q=Dredd', settings)
.then(response => response.json())
.then(data => console.log(data))
.catch(err => console.error(err));
During a standard query on IMDB, I received a URL structured like this:
https://www.imdb.com/find?q=dredd&ref_=nv_sr_sm
I noticed the q parameter in the URL seems crucial.
- I am unclear on how to shape the =FETCH() command to pull IMDB data since examples imply different formats. Specifically, the function takes the parameters: “FETCH(url, selectPaths, rapidApiKey).”
- I’m puzzled about the purpose of the curly braces in the given URL example.
- My attempts consistently return the same error message:
Error
Request failed for https://example-api.p.rapidapi.com returned code 400. Truncated server response: 400 - Bad Request (use muteHttpExceptions option to examine full response).
Request for Assistance
Could anyone provide a more effective tutorial for this setup or suggest some reading materials suitable for beginners?