Can't work out the Character request

Avatar image for michaelbrooks
MichaelBrooks

2

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#1  Edited By MichaelBrooks

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
bdoss

1

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#2  Edited By bdoss

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

Avatar image for sebacancinos
sebacancinos

3

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#3  Edited By sebacancinos

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
Batguy74

15

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

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

Avatar image for jkbuys
JKBuys

1

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#5  Edited By JKBuys

@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.

Avatar image for ingjuanmolina
ingjuanmolina

1

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

This is how you can get single character data:

https://comicvine.gamespot.com/api/character/4005-XXX/?api_key=your_api_key

Where XXX es the id of the character. For example,

https://comicvine.gamespot.com/api/character/4005-1456/?api_key=your_api_key is for Doctor Strange