elliotttate / beatsaver-laravel

Rewrite of beatsaver.com (https://github.com/beatsaver/beatsaver) using the laravel framework
https://discord.gg/8B44zqM
MIT License
39 stars 19 forks source link

API Inconsistent #15

Closed AlinaNova21 closed 6 years ago

AlinaNova21 commented 6 years ago

I've been using the beatsaver api for my BeatManager program. Within the past few days, the API has started returning different formats for a few urls. Pages 2-7 return in the wrong format. As an example, requesting https://beatsaver.com/api/songs/top/0 gives an array of songs, https://beatsaver.com/api/songs/top/15 gives a keyed object. I suspect it has something to do with the 0-100 caching since at 15 songs per page, page 7 is the last that would hit the cache, while the rest would be DB lookups

Byorun commented 6 years ago

I will look into that. I noticed that while implementing the cache. If the there was an index or not didn't matter for my test so I kept it that way. What exactly is the problem? The inconsistency or the the index itself?

AlinaNova21 commented 6 years ago

The inconsistency is the only problem I have, on my end, I always assumed it would be an array, so when it returned as an object, it failed to load. My current patch is to call Object.values(songs) to force it to an array on my end.

Byorun commented 6 years ago

ah for PHP / laravel it is all the same if I parse the json so I didn't really noticed it.