Need help with API (know id for an achievement with only the name) — Guild Wars 2 Forums

Need help with API (know id for an achievement with only the name)

ReActif.9251ReActif.9251 Member ✭✭
edited July 28, 2019 in API Development

Hello, I come to you to find people who have knowledge or help with API.

I am in charge of a distribution of the GW2 TacO overlay oriented more towards helping beginners and indicating achievements.
Recently the overlay has integrated two new options in the creation of markers allowing via the given API key, to check if a achievement or a sub-element is made or not, in order to hide it directly. The executable calls the API: https://api.guildwars2.com/v2/achievements

The markers are XML tags and therefore the scripts and query part of the API is done directly by the overlay.
There are just two variables in the XML tag of the marker:

  • achievementID (integer) : achievement IDs
  • achievementBits (integer): Bits of the sub-element (if existing but not so important if I have to do without)

I don't know the IDs of the achievements, i only know the names.

So I'm looking for ways to use the name of a achievement to get the necessary information.
Or if possible a way to have a complete list of all IDs and names as well as sub-element bits if available.
Again I have no knowledge of how to do this, and via the link directly, I couldn't get anything conclusive because it would require me to do all the possible IDs one by one.
And I have several hundred marked achievements in distribution.

Unfortunately, the Wiki doesn't give the API ID info on the achievement pages, which would have been perfect to the limit for me to integrate this.

Thank you for reading this message, and thank you for all the answers.

Comments

  • What you could do is retrieve all of the achievements from the API, and create a mapping from name to ID that way.

    You can start with https://api.guildwars2.com/v2/achievements?page=1, and then either use the x-page-total header or use the next URL in the link header.

  • ReActif.9251ReActif.9251 Member ✭✭
    edited July 28, 2019

    WAOUH i love you !

    I have never read or know the "page" variable
    It's not a full listing but this is nearly it, i will use it to add the new function to my distribution with that.

    For not use too many link, i have find the server can response 200 items by page.
    With this link for example : https://api.guildwars2.com/v2/achievements?page=0&page_size=200
    With it there is only 17 pages.

    Thanks a lot !

  • ReActif.9251ReActif.9251 Member ✭✭
    edited July 28, 2019

    Just another question for done this question.

    In this example, in Bits, the first item is call with 0 or 1 ?
    I never know if in this case the 0 is the first or not

    {
    "id": ###,
    "name": "###",
    "bits": [
    {
    "type": "Text",
    "text": "Blah Blah 1"
    },
    {
    "type": "Text",
    "text": "Blah Blah 2"
    },
    {
    "type": "Text",
    "text": "Blah Blah 3"
    },
    {
    "type": "Text",
    "text": "Blah Blah 4"
    }
    ]
    }

©2010–2018 ArenaNet, LLC. All rights reserved. Guild Wars, Guild Wars 2, Heart of Thorns, Guild Wars 2: Path of Fire, ArenaNet, NCSOFT, the Interlocking NC Logo, and all associated logos and designs are trademarks or registered trademarks of NCSOFT Corporation. All other trademarks are the property of their respective owners.