Fetching multiple pages using Netlify Graph

Fetching data from Spotify, using Netlify Graph, a max of 50 records is allowed. I’m trying to fetch 2 pages or up to 100 records at a time by using a combined query. However, it still seems I am limited to 50 records – “message”: “API rate limit exceeded”

Is there a way around this? Or do I need to create a whole new query for the second page?

Hey @djmtype,

We’ve escalated this to the engineers to take a look and would keep you in the loop.

In the meantime, would be you able to share your site name (or id)?

@djmtype do you have an example query you could share, that we can investigate? Depending on what you’re trying to do, we might suggest an alternative path, such as using your own OAuth client for Spotify when using Netlify Graph, as then you wouldn’t be sharing the API limits with every Graph customer that uses the Spotify API.

I was using this which I was hoping would return up to 100 records, but it looks like 50 is the limit regardless.

query MyPlaylists($page: String!) {
  pageOne: me {
    spotify {
      id
      playlistsConnection {
        nodes {
          id
          name
          public
          description
          uri
          externalUrls {
            spotify
          }
          images {
            height
            width
            url
          }
          ...Playlists
        }
      }
    }
  }
  pageTwo: me {
    spotify {
      id
      playlistsConnection(after: $page) {
        nodes {
          id
          name
          public
          description
          uri
          externalUrls {
            spotify
          }
          images {
            height
            width
            url
          }
          ...Playlists
        }
      }
    }
  }
}

fragment Playlists on SpotifyPlaylist {
  tracksConnection {
    nodes {
      id
      name
      durationMs
      artists {
        name
      }
      externalUrls {
        spotify
      }
      previewUrl
    }
  }
}

Query variables:

{
  "page": "xxxxxxxxxxxxx"
}

@djmtype you could likely run two sequential queries to get the full list rather than try to combine them into one (since you would need the page reference from the previous query). The limitation of 50 records per call is actually one that is set by Spotify.