I'm testing Google Maps Autocomplete API from RapidAPI, while the GET request work with postman, it is failed with status code 404. I have attached POSTMAN image and code.
API Call
export const getLocations = (searchTerm) => async (dispatch) => {
try {
const {data} = await api.fetchLocations(searchTerm);
console.log(`response: ${JSON.stringify(data)}`);
// dispatch({type: actionTypes.FETCH_LOCATIONS, payload: response?.predictions});
} catch (e) {
console.error(`error: ${e}`);
}
}
const API = axios.create({
baseURL: 'https://google-maps-autocomplete-plus.p.rapidapi.com/autocomplete',
headers: {
'X-RapidAPI-Key': 'API-KEY',
'X-RapidAPI-Host': 'google-maps-autocomplete-plus.p.rapidapi.com'
},
});
export const fetchLocations = (query) => API.get(`?query=${query}&limit=5`);
