How to get hero list and issue list

Avatar image for twaffles
twaffles

5

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

Hey everyone,

I know a lot of people were wondering how to get a list of issues based on a character or characters based off of a publisher. I figured out a non-janky way to do that with the api.

1. Hand enter a list of publishers:

Yes, I know this may be inconvenient for you, but there's a good chance you are only looking for Marvel and DC, possibly Imagery as well. The best way to deal with this: Enter the ones you need and add a "Request Publisher" link. Whether this is a mailto or a form, either works. The important thing about hand entering your publisher: You will need the ID as well. This is the numbers in the URL, so make a list or enter them at the end. For example: Marvel's ID is 4010-31

2. Create dynamic URLs with placeholders:

Since the API calls resemble the site URLs a ton, you can model your API calls off of their links. Trust me, this isn't nearly as hard as it looks. API Call:
https://www.comicvine.com/api/character/[insert a placeholder value here. I used heroName]/?api_key=[API KEY WITHOUT BRACKETS]&field_list=issue_credits&format=json
This lists the issues that whatever the character based on the ID you use is in. From here, you can use an each function and create objects for each superhero. You can replace the word "character" with "publisher" and replace the number with the appropriate publisher number.

3. (Optional) With Each Function:

To pull out the appropriate data to create objects, I used the following in Underscore and Meteor:

_.each(herolist.data.results.issue_credits, function(issue){
Volumes.insert({
title: issue.name,
issueId: issue.id,
heroName: heroname
});
});

*Note: if you are using Meteor, I recommend using this concept with methods. I also recommend only executing this if the collection is empty. I'm going to also look into inserting recent releases


If you need help on executing this or retrieving the data, let me know. I can answer any questions. Yes, this does limit the data returned all at once, but it also speeds up load time.

Avatar image for adrianrodriguez
adrianrodriguez

16

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#2  Edited By adrianrodriguez

I will try this out, right now I am filtering through and checking for a matching string that matches my search query in the description, name, or volume name. Why? Because I would run into the issue where I got John Wayne comics for Damian Wayne.... so very frustrating, I will try this out and see how it works out.

(Update, tried this and I just get a 404) :/