<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Web API 502 Bad Gateway for top items endpoints when offset and limit exceed total in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/Web-API-502-Bad-Gateway-for-top-items-endpoints-when-offset-and/m-p/5910738#M12855</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;ReubenF, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I just wanted to say thank you for reporting this. Indeed we did do a change in the backend where we replaced one upstream with another, and there was a bug with the pagination there. After you reported this we looked into it together with them and we believe we managed to sort it out.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Let us know if you are still experiencing issues with this. Otherwise, have a great day!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Feb 2024 10:48:51 GMT</pubDate>
    <dc:creator>LambertSpot</dc:creator>
    <dc:date>2024-02-27T10:48:51Z</dc:date>
    <item>
      <title>Web API 502 Bad Gateway for top items endpoints when offset and limit exceed total</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Web-API-502-Bad-Gateway-for-top-items-endpoints-when-offset-and/m-p/5897842#M12779</link>
      <description>&lt;P&gt;Hi, I have started getting 502 Bad Gateway errors when paginating using the "next" link from the API response body, when "limit" is not initially set to a factor of the total items.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ReubenF_1-1708481959678.png" style="width: 400px;"&gt;&lt;img src="https://community.spotify.com/t5/image/serverpage/image-id/169437iAD14371011925029/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ReubenF_1-1708481959678.png" alt="ReubenF_1-1708481959678.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was successfully paginating with a "limit" of 49, which allowed me to get 49 more items beyond the stated total:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;/me/top/{type}?limit=49 ("next" link /me/top/{type}?offset=49&amp;amp;limit=49)&lt;/LI&gt;&lt;LI&gt;/me/top/{type}?offset=49&amp;amp;limit=49 ("next" link /me/top/{type}?offset=98&amp;amp;limit=49)&lt;/LI&gt;&lt;LI&gt;/me/top/{type}?offset=98&amp;amp;limit=49 (no "next" link)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Now, I get a 502 Bad Gateway error for the last request to /me/top/{type}?offset=98&amp;amp;limit=49, despite the API providing the link.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When paginating in this way, this is only an issue for a "limit" which is not a factor of 100 (total number of items). You can see that for a "limit" of something that is a factor, like 25, there is no "next" link for the final response body:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;/me/top/{type}?limit=25 ("next" link /me/top/{type}?offset=25&amp;amp;limit=25)&lt;/LI&gt;&lt;LI&gt;/me/top/{type}?offset=25&amp;amp;limit=25 ("next" link /me/top/{type}?offset=50&amp;amp;limit=25)&lt;/LI&gt;&lt;LI&gt;/me/top/{type}?offset=50&amp;amp;limit=25 ("next" link /me/top/{type}?offset=75&amp;amp;limit=25)&lt;/LI&gt;&lt;LI&gt;/me/top/{type}?offset=75&amp;amp;limit=25 (no "next" link)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;For more context, &lt;A href="https://community.spotify.com/t5/Spotify-for-Developers/Bad-Gateway-error-but-not-constantly/m-p/5873677" target="_blank" rel="noopener"&gt;see this related topic&lt;/A&gt; and&amp;nbsp;&lt;A href="https://github.com/Matatika/tap-spotify/issues/26" target="_blank" rel="noopener"&gt;this GItHub issue&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 02:24:48 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Web-API-502-Bad-Gateway-for-top-items-endpoints-when-offset-and/m-p/5897842#M12779</guid>
      <dc:creator>ReubenF</dc:creator>
      <dc:date>2024-02-21T02:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: Web API 502 Bad Gateway for top items endpoints when offset and limit exceed total</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Web-API-502-Bad-Gateway-for-top-items-endpoints-when-offset-and/m-p/5910738#M12855</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;ReubenF, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I just wanted to say thank you for reporting this. Indeed we did do a change in the backend where we replaced one upstream with another, and there was a bug with the pagination there. After you reported this we looked into it together with them and we believe we managed to sort it out.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Let us know if you are still experiencing issues with this. Otherwise, have a great day!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 10:48:51 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Web-API-502-Bad-Gateway-for-top-items-endpoints-when-offset-and/m-p/5910738#M12855</guid>
      <dc:creator>LambertSpot</dc:creator>
      <dc:date>2024-02-27T10:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: Web API 502 Bad Gateway for top items endpoints when offset and limit exceed total</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Web-API-502-Bad-Gateway-for-top-items-endpoints-when-offset-and/m-p/5913017#M12883</link>
      <description>&lt;P&gt;Hi, all looks good now - thanks! Was this change also responsible for allowing more than 100 top items to be retrieved in total? That's what I was referring to by "factor of 100" in the original post, where I was previously using that pagination quirk to get more than 100 top items back at a time (this is now not necessary as this limit seems to have been removed).&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 14:01:35 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Web-API-502-Bad-Gateway-for-top-items-endpoints-when-offset-and/m-p/5913017#M12883</guid>
      <dc:creator>ReubenF</dc:creator>
      <dc:date>2024-02-28T14:01:35Z</dc:date>
    </item>
  </channel>
</rss>

