Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Looking for a solution to target_year

Looking for a solution to target_year

Plan

Premium

Country

US

 

My Question or Issue

I'm working with the recommendations API and want to utilize something like "target_year" to fetch songs from a certain decade. I know it's not possible currently, but does anyone have an idea of how I might be able to hack that together?

Reply
3 Replies

Sadly what you want isn't supported by the Get Recommendations endpoint, but you can filter on a single year: or a range (e.g. 1955-1960) using the Search for Item endpoint.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Thank you! Unfortunately, I’m not sure that would work quite right for my app.

 

I’m thinking I can just loop through the recommendations response and only grab the songs that fit a certain year range. In theory, the code will:

  1. Get 100 recommendations
  2. Find 30 songs that fall within ±5 years of a target year.
  3. If 30 songs are not found, the program will get another 100 recommendations.
  4. Repeat until 30 songs within target year are found.

In terms of rate limiting, is there a difference between getting 100 recommendations vs say 50 songs?

You need less request when you use the maximum amount in of the endpoint. The rate limit is about the number of requests in a fixed timeframe, and not about the size.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Suggested posts