#1 Posted by perezmu (15 posts) - - Show Bio

Hi,


I am trying to find a given issue (let's say #33) of a given series (let's say "Thor (1966)".

First I get the series id, no problem: search volumes for "thor" and get the one I want: series.id = 2994.

Now, I need to search for issue #33. This is harder than it seems.

1. The obvious approach would be to get this from a simple query to the volume (api.comicvine.com/volume/2994). But since the query for volume=2994 returns all the issues but providing their name and id, not issue_number, I would need to loop querying through all issues until I find #33... which requires many connections for a single issue!!!!

2. Next, I tried searches over the issue resource and did not get anywhere.

3. Last, I was left with trying to filter, from the huge list of all issues, those belonging to a given volume:
http://api.comicvine.com/issues/?api_key=....&volume=2294&format=xml
but this did not work either.

So, since I cannot search on issues or filter as shown, I need to resort to way 1, which is the less efficient. Am I missing something or doing something wrong?

Thanks.



#2 Posted by aslambilal (11 posts) - - Show Bio

Ok, looking at

http://api.comicvine.com/volume/2294/?api_key=(API)&format=xml&field_list=issues

The very last issue in results is the first one on this page
http://www.comicvine.com/thor/49-2294/?sort=issue_number

Second last is second on same page
Third last is third and so forth

Which seems to me it's sorting by issue ID from Highest to Lowest, or most recent to least assuming the issues were added sequentially in a timely manner, so you only have to grab the first/last issue and check if the numbers match. Or check once very 25? issues. For Example

1
..
25 - do you have 25 entries and on issue 1 + 24? good
..
50 - do you have 50 entries and on issue 25 + 24? good
..
75 - do you have 75 entries and on issue 50 + 24? good
..
100 - do you have 100 entries and on issue 75 + 24 ? no, go back however many results you have ( you wont have 25 ) and check where it breaks down? ( check my algorithm, i scaped by in college )

I wish we could have sort=id and sort=!id or something for reverse lol but who am i to complain? this is my first api that i'm learning.

Let me know if this works out for you. I'd really like to know.

#3 Posted by perezmu (15 posts) - - Show Bio

That is an idea to explore, but it seems like a longshot! But I will definitely try!


However, I have to stop coding for a week or so, but I will update you as soon as I get back to the project.

Thanks!
#4 Posted by .Johnny_Blazed* (63 posts) - - Show Bio

guess you never got back

#5 Posted by perezmu (15 posts) - - Show Bio
@.Johnny_Blazed*:  
 
I just did!  The trick proposed did not work... the ids are sequential according to the time the book was added not to the release date or the like. I finally decided to locally cache the pairs (id - issue) so, first time you need a long search, but after that i look up the cached table and it is fast. You can check the script at comicrack site!