I am currently working on retrieving data from the SeatGeek API when a user inputs a performer's name. To test my API key, I have been manually entering the query string into the URL. For example:
https://api.seatgeek.com/2/events?performers.slug=new-york-mets&client_id=MY_CLIENT_ID
This method works well as it returns a JSON with information about New York Mets events such as total count, page number, and event details.
On the server side, I handle fetching data through a POST request to /events
:
app.post('/events', function(req, res) {
let band = req.body.bandName;
band = band.split(' ').join('-')
fetch(`https://api.seatgeek.com/2/events?performers.slug=${band}&client_id=MY_CLIENT_ID`)
.then(function(data){
res.json(data);
}).catch(function(error){
console.log(error);
});
});
However, when I make the POST request I receive different data than expected, with an unfamiliar structure like:
{
"url": "https://api.seatgeek.com/2/events?performers.slug=new-york-mets&client_id=OTk1Mzg2MXwxNTEzMTkwMDUyLjI3",
"status": 200,
"statusText": "OK",
"headers": { ... },
"body": { ... }
This has left me questioning if there is an issue with how I am handling the fetch request. Any insights would be greatly appreciated.