seatgeek / api-support

A support channel for the SeatGeek Platform
9 stars 7 forks source link

New API getting a 403 (Forbidden) #165

Closed lindapescatore closed 7 months ago

lindapescatore commented 7 months ago

Hello, I signed up for an API key yesterday and have been working on a project for a course I'm taking (they recommended your API!). BTW I'm obviously still learning so please go easy on me. I ran my query url in a browser and it worked no problem. I ran it from my program using fetch() and I got 403.

I checked to see if I needed to verify email and took care of that. It says I'm verified. I reran the program with the same result. Not sure how much of the error messages you want. I put Xs where my client_id was.

What I tried to do:

const fetchAllConcerts = async() => {
    try {
      const response = await fetch(
        "https://api.seatgeek.com/2/events?type=concert&venue.country=us&listing_count.gt=0&per_page=20&client_id=" + API_KEY
      );
      if (!response.ok) {
        throw new Error(`HTTP error. status: ${response.status}`);
      }
      const json = await response.json();
      setList(json);
    } catch (error) {
      console.error('Problem with fetch: ' + error.message);
    }
  }

  useEffect(() => {
    fetchAllConcerts().catch(console.error);
  }, []);

What happened:

GET https://api.seatgeek.com/2/events?type=concert&venue.country=us&listing_count.gt=0&per_page=20&client_id=xxx 403 (Forbidden)
fetchAllConcerts @ App.jsx:16
(anonymous) @ App.jsx:30
commitHookEffectListMount @ react-dom_client.js?v=347d0ce3:16902
commitPassiveMountOnFiber @ react-dom_client.js?v=347d0ce3:18150
commitPassiveMountEffects_complete @ react-dom_client.js?v=347d0ce3:18123
commitPassiveMountEffects_begin @ react-dom_client.js?v=347d0ce3:18113
commitPassiveMountEffects @ react-dom_client.js?v=347d0ce3:18103
flushPassiveEffectsImpl @ react-dom_client.js?v=347d0ce3:19484
flushPassiveEffects @ react-dom_client.js?v=347d0ce3:19441
(anonymous) @ react-dom_client.js?v=347d0ce3:19322
workLoop @ react-dom_client.js?v=347d0ce3:195
flushWork @ react-dom_client.js?v=347d0ce3:174
performWorkUntilDeadline @ react-dom_client.js?v=347d0ce3:382
Show 11 more frames
Show less
(index):13816 Problem with fetch: HTTP error. status: 403
overrideMethod @ (index):13816
fetchAllConcerts @ App.jsx:25
await in fetchAllConcerts (async)
(anonymous) @ App.jsx:30
commitHookEffectListMount @ react-dom_client.js?v=347d0ce3:16902
commitPassiveMountOnFiber @ react-dom_client.js?v=347d0ce3:18150
commitPassiveMountEffects_complete @ react-dom_client.js?v=347d0ce3:18123
commitPassiveMountEffects_begin @ react-dom_client.js?v=347d0ce3:18113
commitPassiveMountEffects @ react-dom_client.js?v=347d0ce3:18103
flushPassiveEffectsImpl @ react-dom_client.js?v=347d0ce3:19484
flushPassiveEffects @ react-dom_client.js?v=347d0ce3:19441
(anonymous) @ react-dom_client.js?v=347d0ce3:19322
workLoop @ react-dom_client.js?v=347d0ce3:195
flushWork @ react-dom_client.js?v=347d0ce3:174
performWorkUntilDeadline @ react-dom_client.js?v=347d0ce3:382
Show 11 more frames
Show less
App.jsx:16 

       GET https://api.seatgeek.com/2/events?type=concert&venue.country=us&listing_count.gt=0&per_page=20&client_id=xxx 403 (Forbidden)
fetchAllConcerts @ App.jsx:16
(anonymous) @ App.jsx:30
commitHookEffectListMount @ react-dom_client.js?v=347d0ce3:16902
invokePassiveEffectMountInDEV @ react-dom_client.js?v=347d0ce3:18318
invokeEffectsInDev @ react-dom_client.js?v=347d0ce3:19695
commitDoubleInvokeEffectsInDEV @ react-dom_client.js?v=347d0ce3:19680
flushPassiveEffectsImpl @ react-dom_client.js?v=347d0ce3:19497
flushPassiveEffects @ react-dom_client.js?v=347d0ce3:19441
(anonymous) @ react-dom_client.js?v=347d0ce3:19322
workLoop @ react-dom_client.js?v=347d0ce3:195
flushWork @ react-dom_client.js?v=347d0ce3:174
performWorkUntilDeadline @ react-dom_client.js?v=347d0ce3:382
Show 10 more frames
Show less
(index):13816 Problem with fetch: HTTP error. status: 403