Jump to content
  • Sign Up

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


Mauchkiv.8074

Recommended Posts

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!

Link to comment
Share on other sites

To get your list of character you need an API keys, you can create it here

To get list of character inside an account:https://api.guildwars2.com/v2/characters?access_token=<API Keys>

To get basic info about an specific characterhttps://api.guildwars2.com/v2/characters/<Character Name>/core?access_token=<API Keys>

For more info about character you can change the "core" text to "equipment" / "inventory" / etc. Example:https://api.guildwars2.com/v2/characters/<Character Name>/inventory?access_token=<API Keys>

Hope it helps ;)

Link to comment
Share on other sites

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?

I also have never found out how to get a list of character-ids, so I use the characters names (encoded) as the ":id"-part of the api-endpoints.

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...