I am trying to fetch the following data (movie title, movie poster, year of release, and movie review) with an API from RapidAPI to Botpress chatbot. I used the code below but its not fetching the data. Is there a better way to write the code?
I tried the code below and I got an error message?
`const url = "https://moviesdatabase.p.rapidapi.com"
const params = {
title: workflow.title,
year: workflow.year,
genre: workflow.genre,
poster: workflow.poster,
plot: workflow.plot,
apiKey: env.moviesDatabase,
number: '3',
sort: 'popularity',
sortDirection: 'asc',
addmovieInformation: 'true'
}
const response = await axios.get(url, { params })
if (response.status === 200) {
workflow.movieInfo = response.data.results
}`