<?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: Spotify API Get Recently Played Track for Multiple Users in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5601043#M9744</link>
    <description>&lt;P&gt;It's not a simple switch. As you can read on that page, you will need a quota extension if you don't have it already.&lt;/P&gt;</description>
    <pubDate>Mon, 26 Jun 2023 14:38:14 GMT</pubDate>
    <dc:creator>Ximzend</dc:creator>
    <dc:date>2023-06-26T14:38:14Z</dc:date>
    <item>
      <title>Spotify API Get Recently Played Track for Multiple Users</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5601006#M9741</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Plan&lt;/P&gt;&lt;P&gt;Free&lt;/P&gt;&lt;P&gt;Country&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Device&lt;/P&gt;&lt;P&gt;All Devices&amp;nbsp;&lt;/P&gt;&lt;P&gt;Operating System&lt;/P&gt;&lt;P&gt;All OS&lt;/P&gt;&lt;P&gt;My Question or Issue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm building a web app that will display most popular song for my user base. In Spotify API docs I call&amp;nbsp;Get Recently Played Tracks&lt;/P&gt;&lt;P&gt;It works fine for the first users however when I'm looping to the second (third and so on) I get a 504 error. I've checked Spotify forms and looked for other recommendations but unfortunately I've not seen another way without looping through each users and calling the Get Recently Played Tracks.&lt;/P&gt;&lt;P&gt;I also tried spacing out my calls to Spotify (every 1 min, 5min, etc.) with no luck.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;private async Task&amp;lt;SpotifyRecentlyPlayedModel&amp;gt; GetSpotifyRecentlyPlayedData(DateTime afterTime, string AccessToken, long SpotifyUserMappingId) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;long afterTimeTimestamp = new DateTimeOffset(afterTime).ToUnixTimeMilliseconds();&lt;/P&gt;&lt;P&gt;//await Task.Delay(1000);&lt;/P&gt;&lt;P&gt;string requestURI = $"&lt;A href="https://api.spotify.com/v1/me/player/recently-played?after={afterTimeTimestamp" target="_blank" rel="noopener"&gt;https://api.spotify.com/v1/me/player/recently-played?after={afterTimeTimestamp&lt;/A&gt;}";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using (HttpClient client = new())&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;using HttpRequestMessage request = new(HttpMethod.Get, requestURI);&lt;/P&gt;&lt;P&gt;request.Headers.Clear();&lt;/P&gt;&lt;P&gt;request.Headers.Add("ContentType", "application/json");&lt;/P&gt;&lt;P&gt;request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using HttpResponseMessage response = await client.SendAsync(request);&lt;/P&gt;&lt;P&gt;if (response.IsSuccessStatusCode) {&lt;/P&gt;&lt;P&gt;string apiResponse = await response.Content.ReadAsStringAsync();&lt;/P&gt;&lt;P&gt;SpotifyRecentlyPlayedModel result = JsonConvert.DeserializeObject&amp;lt;SpotifyRecentlyPlayedModel&amp;gt;(apiResponse);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;return result;&lt;/P&gt;&lt;P&gt;} else {&lt;/P&gt;&lt;P&gt;= await spotifyDataErrorLogRepository.AddAsync(new() {&lt;/P&gt;&lt;P&gt;SpotifyUserMappingId = SpotifyUserMappingId,&lt;/P&gt;&lt;P&gt;ErrorCode = (int)response.StatusCode,&lt;/P&gt;&lt;P&gt;ErrorMessage = response.ReasonPhrase });&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;return null;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 12:49:07 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5601006#M9741</guid>
      <dc:creator>anitteam</dc:creator>
      <dc:date>2023-06-26T12:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Spotify API Get Recently Played Track for Multiple Users</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5601010#M9742</link>
      <description>&lt;P&gt;You'll need the tokens of every user in your user base, and use them in a for each loop.&lt;/P&gt;&lt;P&gt;If your app is still in &lt;A href="https://developer.spotify.com/documentation/web-api/concepts/quota-modes" target="_blank" rel="noopener"&gt;development mode&lt;/A&gt;&lt;SPAN&gt;, it has some limitations.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 14:01:24 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5601010#M9742</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2023-06-26T14:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: Spotify API Get Recently Played Track for Multiple Users</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5601018#M9743</link>
      <description>&lt;P&gt;Thank you for the reply Ximzend.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently I'm using tokens for each users and regenerating them if it's older than 50 minutes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will try to switch the mode from development mode to see if there is something there that is blocking me.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 13:12:33 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5601018#M9743</guid>
      <dc:creator>anitteam</dc:creator>
      <dc:date>2023-06-26T13:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: Spotify API Get Recently Played Track for Multiple Users</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5601043#M9744</link>
      <description>&lt;P&gt;It's not a simple switch. As you can read on that page, you will need a quota extension if you don't have it already.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 14:38:14 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5601043#M9744</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2023-06-26T14:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Spotify API Get Recently Played Track for Multiple Users</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5601106#M9746</link>
      <description>&lt;P&gt;I agree it is in depth, I've started the process and hope to complete it soon.&lt;/P&gt;&lt;P&gt;I will let you know after I run a test with live cred if it resolved the issue.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 16:56:28 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5601106#M9746</guid>
      <dc:creator>anitteam</dc:creator>
      <dc:date>2023-06-26T16:56:28Z</dc:date>
    </item>
    <item>
      <title>Re: Spotify API Get Recently Played Track for Multiple Users</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5602412#M9777</link>
      <description>&lt;P&gt;Yeah we have the same issue getting 504s for subsequent calls to fetch recently-played items. We're trying to request a quota extension to see if that fixes it, too.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2023 08:58:17 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5602412#M9777</guid>
      <dc:creator>mdc405</dc:creator>
      <dc:date>2023-06-29T08:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: Spotify API Get Recently Played Track for Multiple Users</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5610343#M10013</link>
      <description>&lt;P&gt;I'm also getting a 504 error for multiple users when fetching from recently played:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Yooooomi/your_spotify/issues/260" target="_blank"&gt;https://github.com/Yooooomi/your_spotify/issues/260&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has anyone resolved this yet?&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jul 2023 14:19:03 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5610343#M10013</guid>
      <dc:creator>xKevz</dc:creator>
      <dc:date>2023-07-16T14:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: Spotify API Get Recently Played Track for Multiple Users</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5632499#M10644</link>
      <description>&lt;P&gt;Just wanted to check if you've made any progress with the application? I'm having the same issue and think it's a bit ridiculous that I have to go through an entire process and wait 6 weeks + just to get my friend's recently played tracks haha.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 15:29:41 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Spotify-API-Get-Recently-Played-Track-for-Multiple-Users/m-p/5632499#M10644</guid>
      <dc:creator>alex_wood6</dc:creator>
      <dc:date>2023-09-06T15:29:41Z</dc:date>
    </item>
  </channel>
</rss>

