Gw2 Api how to start? — Guild Wars 2 Forums

Gw2 Api how to start?

hugo.4705hugo.4705 Member ✭✭✭✭
edited June 1, 2019 in API Development

I kinda informed myself, looking at the wiki page but... I don't understand anything! I would like to start developing an app but I have 0 ideas. I don't even know how I'm sensed to use it, should I have a website or something particular to start coding? The only thing I know is game maker and a little unity/eclipse but nothing great.
Any advice to start? I simply don't know where to go, I'm lost, I'm just understanding that we have several paths and categories sending information from your account through your API key...

+++In creative mood. New Engie Elite spec' , Housing , New asuran expansion , Designing a new lounge , New GameMode
+++NEW: AEP Asuran Expansion Project available on WIKI.
+++New: GEM GW2 Exploration Map: Discover unusual places around tyria: Here (OSM map)

Comments

  • Kelieto.6375Kelieto.6375 Member ✭✭

    I'm a beginner to using the API myself. So far, I've been using it to make spreadsheets in Excel. I know nothing about developing apps so I can't help you there.

    First of all, you need to understand what the API is and how it works. When you access one of the endpoints (basically the urls you can see on the wiki page) it returns the information you requested in a format called JSON. Here is a link example of using the API to access information for the item "Pile of Lucent Cystal" (I recommend opening it in Firefox). "Items" is the endpoint I'm accessing and "?ids=89271" is how I tell the API I want information specifically on the item that has the ID of 89271 which happens to be Pile of Lucent Crystal. The wiki pretty much lists all of the endpoints and explains how to use them!

    Here are what I think are some good basic steps you could follow to get started:
    1. Get some very basic knowledge to understand what the heck the JSON format is. (I didn't really do this for myself but I believe it may be important for you since you're trying to code an app vs me using Excel which already has built in features to handle JSON files.)
    2. Play around with the API endpoints and see what kind of information is available from it. (Trying is literally how you learn anything in life!)
    3. Figure out what you want to do with said available information. A quick example of something I did was create a list that calculates the highest value choice from the reward box from completing a Raid CM. (Hint: It's always going to be Bowl of Sweet and Spicy Butternut Squash Soup unless Level 500 cooking shakes things up.)

    I was clueless at first too but that's really all there is to it. See what you have and then figure out where you want to go!

    Good luck and I look forward to seeing what you come up with!

  • Rodolf.4530Rodolf.4530 Member
    edited June 2, 2019

    The 2 most important things you need to know if you want to work with the api is :

    • how to make a http request
    • understand how to retrieve data from a JSON

    Depending on what language you're using, you may need some librairies.

    Once you know that, it's all about how to get the informations you want.
    As Kelieto said, every resources have one or more endpoints. For instance https://api.guildwars2.com/v2/colors will get every color ids you can use. Knowing all those ids, you can pick one or more of them and get the related data. For example : https://api.guildwars2.com/v2/colors?ids=15,16. And then, it's all about what you want to do. Take those colors, you can now know the related dye object id and, for example get their price on the tp https://api.guildwars2.com/v2/commerce/prices?ids=20408,20398

    Note that, depending on how many data you want to retrieve, you may also need to look at the http response header.

  • hugo.4705hugo.4705 Member ✭✭✭✭

    @Kelieto.6375 said:
    I'm a beginner to using the API myself. So far, I've been using it to make spreadsheets in Excel. I know nothing about developing apps so I can't help you there.

    First of all, you need to understand what the API is and how it works. When you access one of the endpoints (basically the urls you can see on the wiki page) it returns the information you requested in a format called JSON.

    How to use it with excel? Can you enlighten me there?

    Also thanks both of you for your answers, isn't json related to java? Say that because in the past I codded some mods in minecraft.

    +++In creative mood. New Engie Elite spec' , Housing , New asuran expansion , Designing a new lounge , New GameMode
    +++NEW: AEP Asuran Expansion Project available on WIKI.
    +++New: GEM GW2 Exploration Map: Discover unusual places around tyria: Here (OSM map)

  • JSON is a data exchange format derived from javascript notations but you can use it with many programming languages. If you're using Java, you'll easily find examples on how to parse json into java objects

  • StevenL.3761StevenL.3761 Member ✭✭

    It helps if you learn the basics of object-oriented programming. ;) Just enough to know what objects are, what methods are, and how to build a system made up of objects that call each other's methods.

  • Kelieto.6375Kelieto.6375 Member ✭✭

    @hugo.4705 said:

    @Kelieto.6375 said:
    I'm a beginner to using the API myself. So far, I've been using it to make spreadsheets in Excel. I know nothing about developing apps so I can't help you there.

    First of all, you need to understand what the API is and how it works. When you access one of the endpoints (basically the urls you can see on the wiki page) it returns the information you requested in a format called JSON.

    How to use it with excel? Can you enlighten me there?

    Also thanks both of you for your answers, isn't json related to java? Say that because in the past I codded some mods in minecraft.

    Sure! Assuming you understood how my previous example for "Pile of Lucent Crystal" worked, this video shows you how to import the same API request (but with different items instead of the Lucent Crystal) into Excel. This was easy for me to pick up because you don't need to understand what's happening or how any of it works, you just need to be able to follow the steps in the video and then Excel will basically turn the retrieved data into a table format which you can then easily work from (that's pretty much what I meant by Excel being capable of handling JSON files). Only thing to be aware of is if you're using a newer version of Excel then "New Query" will now be "Get Data".

    Now hopefully you understand how to import the API data into Excel! From there, you can make another request to the API for the same items but this time for their TP price by accessing the "commerce/prices" endpoint. You can then merge it with the previous query (I don't know of a video tutorial for this but it's very intuitive to do and I figured it out myself in minutes) and you now have data for the TP buy price and sell price. Now, if the items you retrieved data for include the consumables in the raid CM box previously gave as an example, you already have enough data to make the same list I made about which consumable to pick and sell. From there you pretty much have to use your own Excel knowledge like using various formulas like VLOOKUP etc.

    I hope this helped! It's my 1st time explaining it so let me know if anything is unclear! The only problem is the API wasn't working earlier this weekend. It seems to be working right now but if something goes wrong for you in the future it might be the APIs fault instead of yours. It's definitely made me panic thinking I've messed my spreadsheet up before!

  • hugo.4705hugo.4705 Member ✭✭✭✭
    edited June 2, 2019


    I'm kinda proud I successfully made little things in excel, sorting, deleting the rows I don't want... Retrieving some datas I want, and now I have several questions! :o
    So if anyone can answer them would be very nice:
    Firstly: In api v1 a page display the map names and their ids really cool, but in v2 it's only ids.
    Here is the dilemma: If I import v1 in excel through query, I have [Record] instead of the name, if v2 I don't have the names... apart if I precisely ask the map I want. (eg: 1271 for sandswept isles) Also [List] when sub-rows with additional info.
    https://api.guildwars2.com/v1/map_names
    https://api.guildwars2.com/v2/maps

    Now about the information available:
    -Can I retrieve Points of Interest/Waypoints/Quests/Vistas from maps at https://api.guildwars2.com/v2/ ?
    -Is it possible to sort directly from https://api.guildwars2.com/v2/? Like, I want only maps with region_name = tarnished coast or Crystal desert?
    -How to load pictures from that online database? / Anywhere else in excel?

    +++In creative mood. New Engie Elite spec' , Housing , New asuran expansion , Designing a new lounge , New GameMode
    +++NEW: AEP Asuran Expansion Project available on WIKI.
    +++New: GEM GW2 Exploration Map: Discover unusual places around tyria: Here (OSM map)

  • Kelieto.6375Kelieto.6375 Member ✭✭

    For your "Record" problem for v1 you just need to do the same thing you did before and click convert to table in Power Query. It worked for me and it turned out like this so it's definitely working!

    I quickly tried looking into the other stuff but wasn't able to find a way to extract PoI info and stuff even though it seems like it's available at first glance. Maybe someone else has figured it out and is willing to share.

    You can't sort directly from the API link because it is strictly read only information. You can only sort through the information on your side once you've imported it into Excel or into anything you have coded yourself. From reading the wiki page I was able to figure out that you can request information for several maps like this and without much sorting I managed to get a table that looked like this and, as you can see, you can then filter it to show only Tarnished Coast etc.

    Finally, I don't think you can load images into Excel with Power Query specifically but here is a video that uses something in Excel called "Power View" to achieve that result. Hopefully it's something along the lines of what you're looking for!

  • hugo.4705hugo.4705 Member ✭✭✭✭
    edited June 3, 2019

    Firstly, thank you for helping me.

    Oki solved record issue by clicking on "expand column" when converting into table thanks.
    Here is what I want to achieve: I want to sort maps depending on their region_name, and picking only the POIs that interest me, it would be a kind of guide, showing some interesting place to visit for their architectures or the beautiful ambient dialogues.
    I achieved some little things by using long url like https://api.guildwars2.com/v2/continents/1/floors/1/regions/12/maps/1271.
    But oopsie seems like sandswept isles doesn't exist, in fact none of the lws4 map exist apart Istan, really need to be updated, double checked that i'm using the good continent, floor and maps id with https://api.guildwars2.com/v2/maps/1271 which is yeah I'm correct sandswept isles.

    Indeed your video of power view was really helpful thanks a lot.

    About the Specific infos I may have found how to do it:
    https://api.guildwars2.com/v2/continents/1/floors/1/regions/5/maps/139/pois?ids=1043,1044
    That way I can pick the POIs I want within a specific map, here rata sum.

    Also I want to load all the maps, did it successfully with v1:

    It worked, made that:

    So I just put how I did it in excel: (With maps v1)
    -Selected source, converting to table, expanding value, transposed table, promoted headers, changed type, expanded remaining categories

    Thanks a lot again, I think I'm starting understanding something...

    +++In creative mood. New Engie Elite spec' , Housing , New asuran expansion , Designing a new lounge , New GameMode
    +++NEW: AEP Asuran Expansion Project available on WIKI.
    +++New: GEM GW2 Exploration Map: Discover unusual places around tyria: Here (OSM map)

©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.