Launching /v2/characters

Launching /v2/characters

in API Development

Posted by: Lawton Campbell

Lawton Campbell

Web Programmer

Next

Just turned on the first half of another authenticated endpoint — /v2/characters. This endpoint provides the non-inventory-related bits detailed in this pull request, and requires an API key with “characters” permission from the person whose data you want to access.

Some examples — it basically works in the same manner as most of the other endpoints. The base URL returns a list of all the account’s character names:

    GET /v2/characters HTTP/1.1
    Authorization: Bearer <api-key>

    HTTP/1.1 200 OK
    Content-Type: application/json

    [ "Logan Thackeray", "Eir Stegalkin"]
 

You can retrieve individual character blobs by putting them in the next URL component (or in a comma-delimited ids query parameter). Also note that you can pass the API key via the access_token query parameter if you’re making CORS requests (rather than setting the Authorization header):

    GET /v2/characters/Logan%20Thackeray?access_token=<api-key>

    HTTP/1.1 200 OK
    Content-Type: application/json

    {
        "name": "Logan Thackeray",
        "race": "Charr",
        "gender": "Male",
        "profession": "Guardian",
        "level": 80,
        "guild": "4BBB52AA-D768-4FC6-8EDE-C299F2822F0F"
    }
 

Alternatively, you can make paginated requests. Metadata about the pagination details (e.g., the number of pages/results that can be requested) is returned in the response headers for ease-of-use.

    GET /v2/characters?page=0&page_size=50 HTTP/1.1
    Authorization: Bearer <api-key>

    HTTP/1.1 200 OK
    Content-Type: application/json
    Link: </v2/characters?page=0&page_size=50>; rel=self, </v2/characters?page=0&page_size=50>; rel=first, </v2/characters?page=0&page_size=50>; rel=last
    X-Page-Size: 50
    X-Page-Total: 1
    X-Result-Count: 2
    X-Result-Total: 2

    [
        {
            "name": "Logan Thackeray",
            "race": "Charr",
            "gender": "Male",
            "profession": "Guardian",
            "level": 80,
            "guild": "4BBB52AA-D768-4FC6-8EDE-C299F2822F0F"
        },
        {
            "name": "Eir Stegalkin",
            "race": "Sylvari",
            "gender": "Female",
            "profession": "Thief",
            "level": 80
        }
    ]
 

Right now the information returned is fairly basic, but we’ll be adding in the ability to pull character inventories, equipment, traits and skills later on.

Due to technical constraints (wibbly wobbly distributed systems) the character blobs may be a bit stale (up to 5 minutes, I think), so factor that in if you’re making a guild rep tracking system or something (because I know someone’s going to do that).

Let me know if you’ve got any questions/concerns and I’ll do my best to answer ’em.

Launching /v2/characters

in API Development

Posted by: smiley.1438

smiley.1438

Neat ^.^

Edit:

https://api.guildwars2.com/v2/characters?page=0&page_size=50&access_token=API_KEY doesn’t seem to work, i get a {text: "ErrPermission"}

same for https://api.guildwars2.com/v2/characters/<NAME>?access_token=API_KEY

https://api.guildwars2.com/v2/characters?access_token=API_KEY works fine

&ids=all also doesn’t work… would be fine though.

(edited by smiley.1438)

Launching /v2/characters

in API Development

Posted by: Lawton Campbell

Previous

Lawton Campbell

Web Programmer

Next

That’s super weird, they should all be working. Can you PM me the API key you’re using?

FWIW, they all seem to be working for me:

(EDIT: noting that there’s a bug in the forum redirection thing that converts & to &amp; which isn’t very helpful).

(edited by Lawton Campbell.8517)

Launching /v2/characters

in API Development

Posted by: smiley.1438

smiley.1438

(EDIT: noting that there’s a bug in the forum redirection thing that converts & to &amp; which isn’t very helpful).

This is a known bug for ages. Can’t you just switch to… say Invision Power Board?

Launching /v2/characters

in API Development

Posted by: Pat Cavit.9234

Previous

Pat Cavit.9234

Web Programming Lead

Next

This is a known bug for ages. Can’t you just switch to… say Invision Power Board?

No, for reasons. Stay on-topic please.

Launching /v2/characters

in API Development

Posted by: Lawton Campbell

Previous

Lawton Campbell

Web Programmer

Next

(EDIT: noting that there’s a bug in the forum redirection thing that converts & to &amp; which isn’t very helpful).

This is a known bug for ages. Can’t you just switch to… say Invision Power Board?

Uhhh no comment.

WRT the ErrPermission; not sure what the cause of the issue is yet, but one of the backend servers in the EU DC is causing some ruckus. The NA one seems fine though; will have this fixed in a bit.

Launching /v2/characters

in API Development

Posted by: JoluMarti.9165

JoluMarti.9165

https://www.gw2bltc.com/ <-Trading Post, Database and Dye Matcher

Launching /v2/characters

in API Development

Posted by: smiley.1438

smiley.1438

This is a known bug for ages. Can’t you just switch to… say Invision Power Board?

No, for reasons. Stay on-topic please.

Attachments:

Launching /v2/characters

in API Development

Posted by: Crudelis.8640

Crudelis.8640

Great work
Maybe, if possible from the technical side, you can add an image of the character? I don’t know how it’s mashed up in your systems, but showing the user’s avatar, like in the character selection screen, would be awesome.

Elona Reach [DE]

Launching /v2/characters

in API Development

Posted by: Lawton Campbell

Previous

Lawton Campbell

Web Programmer

Next

Maybe, if possible from the technical side, you can add an image of the character? I don’t know how it’s mashed up in your systems, but showing the user’s avatar, like in the character selection screen, would be awesome.

Rest assured, this is something I really, really want too. There’s a lot of moving parts that need to be ironed out before it’s feasible though, so we’ll probably be sticking to low-hanging fruit for awhile yet :<

Launching /v2/characters

in API Development

Posted by: Crudelis.8640

Crudelis.8640

Thank you for having it in your mind, and keep up the great work with the new API!

Elona Reach [DE]

Launching /v2/characters

in API Development

Posted by: Lawton Campbell

Previous

Lawton Campbell

Web Programmer

Next

We might not actually have the EU DC issue fixed until next week — any requests that get routed there won’t work for now. My bad for shipping stuff on a Friday :<

In the meanwhile, NA’s IP address is 64.25.40.16. Requests sent to that IP should work correctly while we figure out the issue.

Launching /v2/characters

in API Development

Posted by: smiley.1438

smiley.1438

Thanks for the heads-up, Lawton!

https://twitter.com/iamdevloper/status/450905958139834368
https://twitter.com/iamdevloper/status/438408934458941440

:D

git commit -am “DEAL WITH IT” && git push -f origin master

(edited by smiley.1438)

Launching /v2/characters

in API Development

Posted by: Giltheryn.8603

Giltheryn.8603

I’ve been messing with this API just for fun and I was wondering if it’s be possible to add a field like last_played or is_online to individual characters?

I feel like the guild rep info would be more useful if we could see what character, if any, is being played at a given time. That said, it’s just an idea; I don’t actually need it for anything and I don’t know how easy it’d be to implement.

Anyway thanks for all the great work on the API stuff and for being so responsive to feedback/concerns.

Launching /v2/characters

in API Development

Posted by: nightzirch.3126

nightzirch.3126

Was messing around with the API as well, and gotta say it’s a lot of fun to see how the authorized API is progressing!

I am currently working on a new version of gw2wardrobe.com, and am using the new API v2 for it. I am so excited for the ability to see which skins your account has unlocked! I have mostly everything ready for when that goes live.

A question about /v2/character/:id/equipment: will we get access to what skins the character is wearing as well? Say, for the chest piece, we get the ID for equipment, rune, infusions and skin?

Getting an image/portrait of the character would be sick as well! For now I’ll just have to stick with generic images.

Hi, I’m Chris aka nightzirch
Snow Crows [SC]
Front-end developer – SecretToymaker.com

Launching /v2/characters

in API Development

Posted by: Lawton Campbell

Previous

Lawton Campbell

Web Programmer

Next

A question about /v2/character/:id/equipment: will we get access to what skins the character is wearing as well? Say, for the chest piece, we get the ID for equipment, rune, infusions and skin?

Yeah, skins, upgrades, and infusions are going to be accessible on both the current equipment and in the inventory/bank. One of the Guthub PRs has details about a unified “item stack” structure that exposes this in a normalized form.

I’ve been messing with this API just for fun and I was wondering if it’s be possible to add a field like last_played or is_online to individual characters?

That’s data that can be exposed, but we should have a discussion about how to do it in a way that makes your users happy. I have a hunch that we may want to hide that data behind a separate permission, but I haven’t thought about it enough to have a well-formed opinion.

Launching /v2/characters

in API Development

Posted by: Giltheryn.8603

Giltheryn.8603

I don’t have any users per se, I’m just a self taught programmer messing with it for fun and don’t really have a particular project in mind right now. I’m sure there’s some people here that would benefit from that data more than I would. Though I do agree that it should be somehow separate as a permission since it could be considered sensitive information to some players.

Launching /v2/characters

in API Development

Posted by: quenoz.3859

quenoz.3859

That’s data that can be exposed, but we should have a discussion about how to do it in a way that makes your users happy. I have a hunch that we may want to hide that data behind a separate permission, but I haven’t thought about it enough to have a well-formed opinion.

talking about permissions, i think it might be really useful to have the equipment and inventory of characters behind separate permissions too.

for example i will definitely write a quick tool gathering all the builds of guild members directly from the api (at the moment everyone has to do that manually), but it might make some people uncomfortable that i will basically also be able to view their inventories for whatever reason.

The Unlikely Plan [TUP] Raid Leader

Launching /v2/characters

in API Development

Posted by: rodadams.5963

rodadams.5963

I’ve been messing with this API just for fun and I was wondering if it’s be possible to add a field like last_played or is_online to individual characters?

That’s data that can be exposed, but we should have a discussion about how to do it in a way that makes your users happy. I have a hunch that we may want to hide that data behind a separate permission, but I haven’t thought about it enough to have a well-formed opinion.

It should go with the Guild permissions, since you can see this of any guild member in game.

Launching /v2/characters

in API Development

Posted by: Pilot.6094

Pilot.6094

Great to see progress with the new character API, very useful.

One concern I have since OAuth was removed is that it will be near impossible to instruct ordinary users which permissions they need to add to their API key. This will be especially challenging given the new permissions being added as the API evolves.

Have you given any thought on how to enhance the usability of the API key generation with permissions?

Perhaps it could default to all permissions checked since we can’t pass a parameter of the permissions we require (ideal).

Launching /v2/characters

in API Development

Posted by: Ruhrpottpatriot.7293

Ruhrpottpatriot.7293

Perhaps it could default to all permissions checked since we can’t pass a parameter of the permissions we require (ideal).

NO! NO! Never ever do that! The less restrictions are accessible by default, the better. A user should have to grant permissions, not revoke them.

Administrator of GW2.NET: GitHub , Forum , NuGet

Launching /v2/characters

in API Development

Posted by: DeviantShark.6548

DeviantShark.6548

NO! NO! Never ever do that! The less restrictions are accessible by default, the better. A user should have to grant permissions, not revoke them.

Absolutely correct. It might seem convenient, but definitely is not the way to go.

That’s data that can be exposed, but we should have a discussion about how to do it in a way that makes your users happy. I have a hunch that we may want to hide that data behind a separate permission, but I haven’t thought about it enough to have a well-formed opinion.

This is something I really thought about a lot already. I did an automated VPN Management software once, where a requirement was to actually see online clients, so I riddled about how handling this in GW2 could be achieved. The conclusion i drew was that without actually reworking the Online-status-management within the game client it is really hard. Mostly because I can see people who want to announce their online-status ingame correctly, but not to announce it to the public (or api, in that matter). Alternatively using a seperate permission for that would definitely be a proper solution, which is completely necessary.
However, the feature itself would be incredibly useful, when it comes to organizing teams, groups, guilds and generate statistics such as average online time per guildmember per day or just how much logged in at least once a day.

Squirreltail? What’s that? [AUT] Oachkatzlschwoaf
We are constantly looking for Guildmembers which contribute to an awesome community

Launching /v2/characters

in API Development

Posted by: Lawton Campbell

Previous

Lawton Campbell

Web Programmer

Next

talking about permissions, i think it might be really useful to have the equipment and inventory of characters behind separate permissions too.

Hmm, it might make sense to move the equipment over to the “characters” permission (it currently requires the “inventories” permission). I hesitate to make a permission for everything; my goal is to keep the number to 7 or fewer.

Mostly because I can see people who want to announce their online-status ingame correctly, but not to announce it to the public (or api, in that matter). Alternatively using a seperate permission for that would definitely be a proper solution, which is completely necessary.

I think a separate permission is probably best. Putting it into the guild permission (as suggested earlier), I think is a bit unintuitive (and awkward as the guild permission is currently only useful for guild leaders).

Launching /v2/characters

in API Development

Posted by: Devilsown.9376

Devilsown.9376

Hmm, it might make sense to move the equipment over to the “characters” permission (it currently requires the “inventories” permission). I hesitate to make a permission for everything; my goal is to keep the number to 7 or fewer.

Can you put the Look / Wardrobe and Colors to the characters permission and only the Stats to the inventories (and later to the skills)?
An other Idea could be an easy and an advanced mode for the permissions. Or an easy mode with opt out for all subpoints.
Some ppl are already a little bit unhappy with the Guilds in the basics and even more with the Guilds in the characters.

Launching /v2/characters

in API Development

Posted by: MatHack.4316

MatHack.4316

If you call /v2/characters you get an ordered list (by descending last logged in), however if you call /v2/characters?page=0&page_size=50 the order of the characters is randomize with every call. Is there something you can do about this or is this intended?

EDIT: edited in the correct order.

Far Shiverpeaks

(edited by MatHack.4316)

Launching /v2/characters

in API Development

Posted by: darthmaim.6017

darthmaim.6017

If you call /v2/characters you get an ordered list (by date/time of creation)

No. They are not order by creation time. Its the same order I get when requesting a page, although it doesn’t seem to change as often when requesting it repeatedly.

I still would like to see creation_time and a unique identifier for characters though.

[…] character GUIDs are strictly secret. We could theoretically pass them through a one-way transform (e.g., a hash function), but I think it would take significant backend work to plumb that through everything. The character name is at least unique; the mutability is just a constraint I think we’ll have to live with.

I’ll spend some more time looking into it though. It’s a really horrible constraint to live with.

~lye (source).

Launching /v2/characters

in API Development

Posted by: MatHack.4316

MatHack.4316

Whoops, you are right, they are in descending last logged out order (same as the character select screen in-game).
The /v2/characters?page=0&page_size=50 result is just randomized everytime (between de results you get for that page). You can actually still get the same order from /v2/characters if you use a page_size of 1 and just handle each page as one character.

Far Shiverpeaks

Launching /v2/characters

in API Development

Posted by: darthmaim.6017

darthmaim.6017

Ah you are right But requesting with page_size=50 gets me the same order as /characters most of the time (60-70%), only sometimes the order seems the be random.

Launching /v2/characters

in API Development

Posted by: Devilsown.9376

Devilsown.9376

Do you plan a translation for Characters (lang=)?
Of course, it’s no problem to translate Race, Gender and Profession by my self. So I do not need a translation by API, but if it’s planed I would wait

Launching /v2/characters

in API Development

Posted by: Lawton Campbell

Previous

Lawton Campbell

Web Programmer

Next

Do you plan a translation for Characters (lang=)?

Nah, those values are intended to be the string representation of numerical constants, i.e., meant for machine rather than human consumption. IMO, you should localize them in the application.

Launching /v2/characters

in API Development

Posted by: Markus.6492

Markus.6492

Hi all,

I follow the API development for quite a while now and am as a guild leader pleased that now the characters API is available.

And since I also have an immediate proposal to extend:

We use our guild page a plugin to display the characters of our members. Unfortunately, each member has to enter all of his characters by hand and also maintain it.

We have in addition to those already in the API information such as name, race and profession even the crafts profession, the associated orders, the commander, the fractal level and the Dungeons concluded Story Modes.

Is it planned to be able to read this information about the API and the best to even a character image, so you only need an API key and all the information of the members to be able to automatically display on the guild page.

Best regards

Markus

Guild: Teufelspack [Arrr]
Function: Captain

Launching /v2/characters

in API Development

Posted by: Lawton Campbell

Previous

Lawton Campbell

Web Programmer

Next

Is it planned to be able to read this information about the API and the best to even a character image, so you only need an API key and all the information of the members to be able to automatically display on the guild page.

In the long run, I hope to be able to provide all that information, given that you have an API key for each guild member.

I don’t think we’ll allow the guild leader’s API key to act as a skeleton key for their guild members. There’d have to be some kind of opt-in system for guild members, and at that point we might as well just stick to the key per-person approach.

(Posting this before I’ve had my coffee so I might not have understood/answered the correct question)

Launching /v2/characters

in API Development

Posted by: rodadams.5963

rodadams.5963

I could, however, see an argument made for “show me what I can see in game”. As such, I’d be able to see the account.1234 of everyone in the guild, along with their AP total, and some stats on currently logged in character, such as name, locataion, and crafting skills.

I can pass on the crafting skills, but if the above were available via API, one could poll it every so often, and slowly build a list of characters that people play with, thus delivering roughly what Markus wanted.

I don’t see this as a guild leader skeleton key, just a base feature.

Launching /v2/characters

in API Development

Posted by: Lawton Campbell

Previous

Lawton Campbell

Web Programmer

Next

Ah yeah, we definitely plan to expose that kind of information. There’s some details in the github repo about the upcoming endpoint.

Launching /v2/characters

in API Development

Posted by: Asuaka.1528

Asuaka.1528

Maybe I haven’t seen it but are there any plans to include a characters age?
And maybe account age in the general account API.

List of unavailable armor and weapon skins:
[Collection] Wardrobe/Skin Bugs & Anomalies

Launching /v2/characters

in API Development

Posted by: Markus.6492

Markus.6492

In the long run, I hope to be able to provide all that information, given that you have an API key for each guild member.

I don’t think we’ll allow the guild leader’s API key to act as a skeleton key for their guild members. There’d have to be some kind of opt-in system for guild members, and at that point we might as well just stick to the key per-person approach.

Hi,

I think I have expressed myself wrong, of course I did not mean “the one key to rule them” but an API key by each member of the guild.

However, it would be nice if the information would not be until next year. Assuming that stand by the information already in a database, and so parts should already be made available from this database, it’s not too difficult to provide also the remaining information.

regards

Markus

Guild: Teufelspack [Arrr]
Function: Captain

Launching /v2/characters

in API Development

Posted by: Lawton Campbell

Previous

Lawton Campbell

Web Programmer

Next

Maybe I haven’t seen it but are there any plans to include a characters age?
And maybe account age in the general account API.

Not formal plans, no, but it’ll probably make it in there at some point.

However, it would be nice if the information would not be until next year. Assuming that stand by the information already in a database, and so parts should already be made available from this database, it’s not too difficult to provide also the remaining information.

I can’t really comment meaningfully on our release timeline. The data doesn’t come from a database, per se, but is handled by multiple backend servers that have to be kept in-sync with the normal game release processes. Regardless, I’ll try to get everything out as soon as I can.

Launching /v2/characters

in API Development

Posted by: Tiscan.8345

Tiscan.8345

IMHO, querying Chars by their name is a very bad idea. Not only is there a huge potential for messesd up queries (i know lots of players using strange unicode-stuff in their names – and we all know how “well” a lot of proxies/http-libs handle that stuff) and its making managing characters a major pita because people can always change their name using a name-change contract (which means: they are changing the “primary key” by which you can find their data in your database).

It would be nice if you could add a GUID for the characters as well and probably add the possibility to query by that GUID instead of the charname.

Launching /v2/characters

in API Development

Posted by: Lawton Campbell

Previous

Lawton Campbell

Web Programmer

Next

It would be nice if you could add a GUID for the characters as well and probably add the possibility to query by that GUID instead of the charname.

I threw an issue into github for this; it was something I was meaning to do before release but it slipped my mind. Querying by id is going to be surprisingly difficult (since the id will have to be generated from some immutable private per-character data), but throwing it into the character blob as a unique identifying field should be pretty straightforward.

Launching /v2/characters

in API Development

Posted by: Atomix.7053

Atomix.7053

If you call /v2/characters you get an ordered list (by descending last logged in)

when is that this data is refreshed?
I get :
[“Atamix”,“Atimax”,“Atimyx”,“Atamïx”,“Atomöx”,“Atimox”,“Arlequizayy”,“Atomïx”]

but my order on login screen:
Atamyx, Atomïx, Atamix, Atimax, Atamïx, Atomöx, Atimox, Arlequizayy

explain me that please? i’m confused

Launching /v2/characters

in API Development

Posted by: MatHack.4316

MatHack.4316

@Atomix: Lawton never confirmed (or responded to my question) that the characters are sorted in a specific order, this is just my own observation. For me it updated as soon as I was back in the character select screen. Keep in mind that the data is cached up to 5 minutes on the API-server.

Far Shiverpeaks

Launching /v2/characters

in API Development

Posted by: Lawton Campbell

Previous

Lawton Campbell

Web Programmer

Next

@Atomix: Lawton never confirmed (or responded to my question) that the characters are sorted in a specific order, this is just my own observation. For me it updated as soon as I was back in the character select screen. Keep in mind that the data is cached up to 5 minutes on the API-server.

Pretty much this.

I haven’t looked into the code to verify that the character order is roughly sorted from most→least recently played, but my observations match yours.

Launching /v2/characters

in API Development

Posted by: DeviantShark.6548

DeviantShark.6548

Quick Question related to /v2/characters
Is there a possibility to push the /age of a character to the API?

Squirreltail? What’s that? [AUT] Oachkatzlschwoaf
We are constantly looking for Guildmembers which contribute to an awesome community

Launching /v2/characters

in API Development

Posted by: darthmaim.6017

darthmaim.6017

Launching /v2/characters

in API Development

Posted by: Divine Don.9752

Divine Don.9752

Not sure if this relates to the questions asked above but I’m having problems with the order of characters.

When requesting character info by Id’s (‘https://api.guildwars2.com/v2/characters?ids=’ + namesString), I get all characters but they come in different order everytime. For example, If I request [A,B,C]; The return data will be [A,C,B] or [C,B,A] etc…

~Don

Launching /v2/characters

in API Development

Posted by: Lawton Campbell

Previous

Lawton Campbell

Web Programmer

Next

I’d recommend just sorting them client-side if you want them ordered — there’s going to be <=64 strings, so it’s not that big of a deal.

I hesitate to sort them on the server, since there might be some useful meaning in the ordering (e.g., determining which characters have been played most recently). I’d rather not take that datum away.

Launching /v2/characters

in API Development

Posted by: Divine Don.9752

Divine Don.9752

I ended up doing what you recommended. Thanks.

Any ETA on /v2/characters/:id/equipment? No rush, with school and work the site that I’m creating won’t be done for another 3-4 months; I would just like a status on how things are coming along so I can adjust my schedule.

Thanks again,

~Don

Launching /v2/characters

in API Development

Posted by: Pat Cavit.9234

Previous

Pat Cavit.9234

Web Programming Lead

Next

I ended up doing what you recommended. Thanks.

Any ETA on /v2/characters/:id/equipment? No rush, with school and work the site that I’m creating won’t be done for another 3-4 months; I would just like a status on how things are coming along so I can adjust my schedule.

Thanks again,

https://github.com/arenanet/api-cdi/pull/36

We should be able to turn it on sometime after the next patch hits, IIRC.

Launching /v2/characters

in API Development

Posted by: rodadams.5963

rodadams.5963

https://github.com/arenanet/api-cdi/pull/36

We should be able to turn it on sometime after the next patch hits, IIRC.

I presume we’ll get /v2/account/bank at the same time? The two pretty much go hand in hand, and I’d expect similar challenges with the two, but I’m not in your codebase.

Launching /v2/characters

in API Development

Posted by: Lawton Campbell

Previous

Lawton Campbell

Web Programmer

Next

https://github.com/arenanet/api-cdi/pull/36

We should be able to turn it on sometime after the next patch hits, IIRC.

I presume we’ll get /v2/account/bank at the same time? The two pretty much go hand in hand, and I’d expect similar challenges with the two, but I’m not in your codebase.

Yeah, we’re hoping to turn on /v2/account/bank and /v2/account/materials around the same time, barring any catastrophes.