Unexpected null "TotalPages" values in response

13 views
Skip to first unread message

PDT

unread,
Jun 25, 2012, 11:36:40 PM6/25/12
to 8tracks-p...@googlegroups.com
 
I got back a null "total-pages" value for this query:

http://8tracks.com/mixes?page=1&sort=hot&per_page=20&q_artist=beck&format=xml&hide_nsfw=1&api_key=<apikey>&api_version=2

I have seen TotalPages come back as zero, and so I can compute it by dividing the per-page and the total-entries.  But here, the total-entries is coming back as 20 which is the same as the "per-page".  The name of the response is "9000+ mixes with tracks by "Beck"" which makes me think the total-entries should be over 9000, not 20.

The null value for total-pages actually caused a parsing error in my code.  I have not encountered null for total-pages before.  Is there any type of document that spells out which numerical values may be null in the various responses?  This definately does not happen on every response, so I don't know how many user's are affect. 

Thanks!

Paul

 

 

Remi - 8tracks

unread,
Jun 26, 2012, 12:48:39 AM6/26/12
to 8tracks-p...@googlegroups.com
Hi Paul, thanks for reporting this issue.

I reproduced it right away and indeed there is a strange bug. I wrote
a hack around it for now and you should get something like :

<total-entries>9387</total-entries>
<page>1</page>
<per-page>20</per-page>
<next-page>2</next-page>
<previous-page nil="true"/>
<total-pages>470</total-pages>

And sorry but we don't have a document spec'ing out our responses,
it's all about trial and error around here.
--
Rémi Gabillet
8tracks CTO & co-founder

PDT

unread,
Jun 26, 2012, 9:20:28 AM6/26/12
to 8tracks-p...@googlegroups.com
That was fast!  Thanks for the quick fix, and I verified I can get all of the "Beck" mixes for a years worth of listening.
 
No worries about the document.  In general, the responses are not hard to figure out. Was having total pages come back null just a bug, or can that happen in some circumstances? Until now I had only seen 'prev-page' and 'next-page' come back null.

On Monday, June 25, 2012 9:48:39 PM UTC-7, Remi Gabillet wrote:
Hi Paul, thanks for reporting this issue.

I reproduced it right away and indeed there is a strange bug. I wrote
a hack around it for now and you should get something like :

<total-entries>9387</total-entries>
<page>1</page>
<per-page>20</per-page>
<next-page>2</next-page>
<previous-page nil="true"/>
<total-pages>470</total-pages>

And sorry but we don't have a document spec'ing out our responses,
it's all about trial and error around here.


Reply all
Reply to author
Forward
0 new messages