WoW API inconsistent response for active_title

/profile/wow/character/<realm-slug>/<character> returns active_title as a string for some
old characters for some reason

{
    "active_title": "Hand of A'dal"
}

while for 99.9% of the characters active_title is a object like so:

{
    "active_title": {
        "key": {
            "href": "<blizz link>"
        },
        "name": "charactername",
        "id": 123,
        "display_string": "{name} Lurker of api"
    }
}

This breaks stuff :confused:

json: cannot unmarshal string into Go struct field CharacterProfileSummary.active_title · Issue #37 · FuzzyStatic/blizzard (github.com)

Kind regards, Joakim

1 Like

I followed the Github link you posted and checked that some profiles you linked there are inactive.

When you request data from the API the API return 2 very important headers: Battlenet-Schema and Battlenet-Schema-Revision.

If you search for data on those characters you’ll notice the ones returning simple string are in revision 15 while the current revision is 24.

In your case you should check for the revision before decoding the data to a struct.

1 Like

Hey Schiller

Thank you very much for the answer!

However now I am slightly more confused though.

If the characters are inactive. isn’t the API supposed to give me 404 messages on them so I know they are inactive and should be removed.

Or is this also related to the older schema version and characters using it will still show up even if they are inactive?

Have a nice day!

Edit:

My bad, it’s the /profile/wow/character/realm/character/status that should return the 404. Case closed

Not really. Even /profile/wow/character/realm/character/status will not return 404 unless the player has disabled the option to share information with 3rd parties.

Old data just means that particular character has not been played in a while.

Wait, isn’t that what the 403 is for?