Avatar image for michaelbrooks
#1 Edited by MichaelBrooks (2 posts) - - Show Bio

Hello,

I have been attempting to use the API and have successfully used /characters, /search and /powers. The ones I am not sure on are the singular URIs such as /character. I thought I could replicated the filter url in /characters to get just a single character with a list of their powers etc.

Something like this...

http://www.comicvine.com/api/character/?api_key=xxx&filter=name:spiderman&format=json

This will error, but this is the proper URI

www.comicvine.com/api/character/4005-75487/?api_key=xxx&format=json

What I don't understand and what isn't explained in the documentation is the /4005-75487/ parameter of the URI.

I know I can always get this full character URL by requesting the characters URL first and querying my chosen character and then reading out the api_detail_url and grabbing the rest of the info from that, but then to me, that's one too many requests. I should be able to query the /character URI with a certain filter...

What are other people's opinions and best way to get around this sort of thing?

Avatar image for bdoss
#2 Edited by bdoss (1 posts) - - Show Bio

It won't work for me either. I think it's defective.

Avatar image for sebacancinos
#3 Edited by sebacancinos (3 posts) - - Show Bio

The API is poorly designed and documented, but the content is so good we put up with it. The 4005-75487 part is basically [type]-[resource-id]. You can call the "types" endpoint and get a list of all the supported types and their ids.

Avatar image for batguy74
#4 Posted by Batguy74 (7 posts) - - Show Bio

Has anyone figured out the solution for how to access the character object via the API?

Avatar image for jkbuys
#5 Edited by JKBuys (1 posts) - - Show Bio

@batguy74:

I was able to use the following:

https://comicvine.gamespot.com/api/characters/?api_key=xxxx&filter=name:spiderman&format=json

The character call appears to require the character ID, such as 4005-75487. The "characters" call does not have this same restriction, and can be filtered using the character name. The downside is that it returns any character with the same name in their name, for instance, a call with the name filter "batman" returns Batman and a bunch of obscure characters such as "Batman Robot", "Batman Junior", "Batman Predator", etc.