Kiran Panesar
Kiran Panesar

Reputation: 3194

SoundCloud Track List API Returns 504

For the past couple of years our app has been using SoundCloud's API without any issue. Recently we've started running into 504 errors when trying to request a user's track list. The request for the user's metadata are perfectly fine, but the track list will return a 504 about 80% of the time now.

Has anyone else experienced this? Any SoundCloud engineers able to give some support?

A sample URL is: https://api.soundcloud.com/users/1887081/tracks.json?client_id=[OUR_APP_ID]

The docs for this call can be found here: https://developers.soundcloud.com/docs/api/reference#tracks

Example response for the error: enter image description here

Upvotes: 3

Views: 568

Answers (1)

mansilladev
mansilladev

Reputation: 988

That user ID, 1887081 has 78 tracks. The length of the search query and fetch is clearly longer than what their middleware/API is willing to wait for. I have two recommendations:

  1. Write their support and ask them to optimize their backend, or query/index. In lieu of that, they could also increase the timeout.

  2. You should use pagination. limit=10 and offset=0 to fetch the first 10. offset=10 to fetch the next page, etc.

Also, if this is a production level app on your end, I would recommend use an API monitoring tool like Runscope. You can do automated scheduled monitoring with simple assertions (no programming), such as checking for a status 200, or even specific content that you know should be there in the JSON, etc. That way, when things go south, or performance degrades in any way, you'll know ahead of time, rather than having to figure it out after your app breaks because of 403s.

Upvotes: 4

Related Questions