These are chat archives for arenanet/api-cdi

19th
Mar 2018
Quaggan BooOOoot
@QuagganBooOOoot
Mar 19 2018 13:07
New discussion in API Development:

Newbie question regarding API request/response speed
by ThD.7964 in API Development

Hi!
I'm starting a project and for training, I wanted to use the GW2 API. My project will be base on a restful API.
I created a API key (with Account+Characters+Builds) and I wanted to know, when I make a simple request on the url browser, it can take 5 to 6 seconds (max i got was 11sec!) to get the response. And sometimes, It takes only 1 to 2 secs max (using Google Chrome Console -> Network).

Exemple URL : https://api.guildwars2.com/v2/characters/MYCHARACTERNAME?access_token=MYKEY

It's the second time I'm working with an API and I was wondering if I'm doing something wrong.

Thank you very much

Daniel Snider
@dsnider-anet
Mar 19 2018 18:54
I made a comment on #560. Does anyone have some use cases for flip_skill, next_chain, and prev_chain?
darthmaim
@darthmaim
Mar 19 2018 19:01
I'm using next_chain for https://preview.gw2.be/
To display tooltips for the chained skills
(this is not yet in the deployed version)
I think I have a branch somewhere doing something with flip_skills, but can't find that right now
might have just been some test I ended up deleting
darthmaim
@darthmaim
Mar 19 2018 19:06
Most of the mechanics stuff isn't implemented in our build editor yet, so we didn't need to use flip_skill yet
Something I ran into when using next_chain though: We are loading all skills referenced from the selected /v2/profession/:id, then I have to find all next_chain (and other related skills) in the loaded skills, and load those, and repeat that until no more new skill ids are encountered
It would be nice to have some way to load all those skills in one request
darthmaim
@darthmaim
Mar 19 2018 19:15
the other skills we are currently loading are skill.next_chain, skill.subskills and skill.toolbelt_skill
Daniel Snider
@dsnider-anet
Mar 19 2018 20:07
Thanks for the info. Looking at this, I assume knowing which skills change based on traits would be of interest to you.
darthmaim
@darthmaim
Mar 19 2018 20:07
yes
darthmaim
@darthmaim
Mar 19 2018 20:15
Why does stuff like A.E.D. even change the skill instead of using traited facts like most other skills?
oh yeah, description...
just having a required_trait: 1679 on the traited A.E.D. would probably enough to automate it
I'm doing something similar for subskills/attunements
Daniel Snider
@dsnider-anet
Mar 19 2018 20:19
Hmmm
darthmaim
@darthmaim
Mar 19 2018 20:21
    getCurrentSkill(id) {
        const skill = this.props.availableSkillObjects[id];

        if(skill && skill.subskills) {
            const availabeSubskills = skill.subskills.filter(
                (subskill) => subskill.attunement === this.props.selectedElementalistAttunementId
            );

            if(availabeSubskills.length > 0) {
                console.assert(availabeSubskills.length === 1, `${availabeSubskills.length} available subskills for skill ${id} (https://api.guildwars2.com/v2/skills/${id}.`);
                return this.props.availableSkillObjects[availabeSubskills[0].id];
            }
        }

        return skill;
    }
thats the code handling the subskills/attunement
Daniel Snider
@dsnider-anet
Mar 19 2018 20:21
The problem with doing things like required_trait is that the data is complex enough that it could allow, say, two possible traits or a whole bunch of different conditions to use that skill instead
darthmaim
@darthmaim
Mar 19 2018 20:21
hmm
Daniel Snider
@dsnider-anet
Mar 19 2018 20:22
It would probably work as the content is now, but who knows what it looks like in the future.
I bet a lot of bugs/quirks of this API were built on similar assumptions
darthmaim
@darthmaim
Mar 19 2018 20:22
probably
/shrug
Quaggan BooOOoot
@QuagganBooOOoot
Mar 19 2018 20:22
¯\_(ツ)_/¯
Daniel Snider
@dsnider-anet
Mar 19 2018 20:23
I think the approach of something-that-may-become-quirky-in-the-future is better than nothing at all though
Also, the api versioning as is makes it hard to change anything
darthmaim
@darthmaim
Mar 19 2018 20:24
Maybe something like this could work:
flip_skills: [{
  id: 30881,
  trait: 1679
}]
on the original skill
or for stuff like the stealth alternatives it would be { id: 1234, stealth: true } or something along those lines
Daniel Snider
@dsnider-anet
Mar 19 2018 20:25
yeah, I was thinking something like that
that might be the most useful
at that point "flip_skill" is the wrong name maybe
darthmaim
@darthmaim
Mar 19 2018 20:27
I'm all for changing the versioning scheme if that helps to get new features out faster and fixing bugs
replacement_skills, alternative_skills, ...
Daniel Snider
@dsnider-anet
Mar 19 2018 20:28
yeah
replacement_skills: [{
  id: 123,
  chain: true,
},{
  id: 345,
  stealth: true,
}]
^ that still requires deriving stuff from the data
darthmaim
@darthmaim
Mar 19 2018 20:30
What is the id in chain referring to?
Daniel Snider
@dsnider-anet
Mar 19 2018 20:30
err mistake
chain: true is what i meant
darthmaim
@darthmaim
Mar 19 2018 20:31
Could that be changed to chain: 1, chain: 2, ...? That would allow loading all skills with just one roundtrip
Daniel Snider
@dsnider-anet
Mar 19 2018 20:31
yeah it should be possible
darthmaim
@darthmaim
Mar 19 2018 20:31
that would be awesome
not a fan of loading the skills recursively atm
Daniel Snider
@dsnider-anet
Mar 19 2018 20:31
yeah that's bad