API Library Update

Up until yesterday, I'd only been grabbing the fields that I feel I would personally ever want to use.  This consisted of the majority of fields, but I didn't think I cared much for the Aliases field for everything besides Characters since it is hardly used, same goes for Deck, and I wasn't grabbing Date_Added or Date_Last_Updated, and I wasn't grabbing Api_Detail_Url or Site_Detail_Url.  

In the interest of completion, I decided that these fields should be possible for the user of my c# library to gather and utilize in whatever manner they see fit.

So I've spent the last day of development going through all of the work that's been done to completion up to this point and retooling everything so that ALL fields are possible to gather.
Start the Conversation

Volume & Issue resources are complete (ComicVine API C#)

So I've been hard at work on my C# library for the ComicVine API.  Volumes are fully searchable and the class is fully functional, with all data related to a volume object easily retrievable.  The Issue resource is also complete in terms of gathering the API details, but it's not a searchable resource because I don't really personally find them to be all that relevant of a resource to search among.  I may implement it in the future just for completeness, but for now I don't find it too useful so I will focus my attentions elsewhere.
I developed a new class called Role, which is sort of the opposite of the Person members of an Issue resource.  Each person affiliated with an Issue has roles assigned to them, that's built in to the API, but my own Role class is now a new member of the Issue class and it parses the person_credits to build a role_credits listing, so to explain: each issue has a list of roles, and each role has a list of the persons who completed that role for the issue.  So with this you can easily print out the person_credits for an issue by Person or by Role, as an example for The Walking Dead #65 you could have it by persons:

Robert Kirkman: writer
Charlie Adlard: penciler, inker, cover
Cliff Rathburn: cover
Rus Wooten: letterer
Aubrey Sitterson: editor

(this being built in to the API) Or you could have it by roles (this being what I just implemented myself into my library):

Writer: Robert Kirkman
Penciler: Charlie Adlard
Inker: Charlie Adlard
Cover: Charlie Adlard, Cliff Rathburn
Letterer: Rus Wooten
Editor: Aubrey Sitterson

I thought it was nice to have an easy method of presenting the Issue person_credits in a couple of different ways.

Next up on my plate: Complete the Person class with all fields as properties and include a Search functionality so we can have easy ways to find out, for instance, every issue that Stan Lee was ever involved in, or even involved in for a particular role.  Should be fun.

Start the Conversation

XML Encoding Issue with the ComicVine API

This post deals with an XML encoding issue that I found, and I can only attest to the existence of this issue when XML is the delivery format, because I haven't worked with JSON or JSONP.

I noticed that I wasn't getting all of the characters_credits when I parsed the XML for Batman: Harley and Ivy.  I was supposed to be getting 13 characters, but wasn't getting one of them.  So after a bit of digging I discovered that Fawny Cougérre was the character that wasn't coming through.  It jumped out at me pretty quickly: it's that character with the diacritical mark, that é, that's the culprit.  The XML returned by the API is UTF-8 encoded, but, as I just learned, can contain characters that require a UTF-16 encoding to be read by an XML parser.

So in order to correctly read the XML without any errors when situations like this pop up in the XML results, I made a utility for my ComicVine API library that converts the encoding of the incoming XML to UTF-16.  So rather than take the URL for the API query and use that in an XmlTextReader to get the XML, now I'm downloading the source from the API query URL directly into a string, replacing the XML attribute encoding='UTF-8' with encoding='UTF-16', then loading the string into a MemoryStream, then loading the MemoryStream into a StringStream with character encoding specified to UTF-16.  THEN I read the StringStream into the XmlTextReader and I've got a properly encoded XML document that I can parse and have no problem reading results with non-standard characters.
Start the Conversation