Q: (API newbie) How do I get character id? — Guild Wars 2 Forums
Home API Development

Q: (API newbie) How do I get character id?

Hello guild devs!

I have plans to make some app for personal use and just explored the gw2wiki to check out the endpoints.

I'm especially interested in /v2/characters. What I wan to know is how can I get a list of my characters ids? This endpoint only list the character names.
But according to wiki I have to use id if I want to get data for one character, like so v2/characters/:id/core. But how do I get it?

After playing around more I found I can get data for one character by URL encoding its name and use it as id. That's a bit surprising.

• How do I get character id? Am I doing something wrong?
• Is using name as id intentional? Why?

Best regards!

Best Answers

  • WeAreTwO.9780WeAreTwO.9780 ✭✭
    Accepted Answer

    It feels a little strange to use the character-name (that can have special characters) as an index/id. Maybe it was planned to return real IDs (e.g. numbers) but it was not finished and then it stayed that way.

    You are doing the right thing. There isn't something like an id for a character. I totally agree, that using that character name as 'id' is a bad idea, because of special characters.
    I think the whole game servers are not designed to have an API and therefore people have to do hacky things to get the information into a database.

Answers

  • SkyShroud.2865SkyShroud.2865 Member ✭✭✭✭
    edited October 30, 2017

    If you are doing it on script or code, you can put your auth code via the http headers with "Authorization:[key]"

    Founder & Retired Leader of Equinox Solstice [TIME], a Singapore-Based International PvX Guild
    Henge of Denravi
    https://discord.gg/P5dj7fd

  • Thank you all for your replies! I got what I wanted to learn. :smiley: