API Lib for node.js

API Lib for node.js

in API Development

Posted by: TimeBomb.3427

TimeBomb.3427

Hi all. I have put together a node.js module that enables easy access to the JSON API.
You can install it with npm: npm install gw2nodelib
Or view the source: https://github.com/TimeBomb/GW2NodeLib

I’ve added some decent documentation to the readme (see above github link), and the source code is also decently commented.

The library allows you to retrieve the JSON of each of the API pages, and caches it either for the session or in a file, as you can see by the readme.
When I have more time (and assuming there is enough interest), I plan to add more specific methods to the lib, so you can more easily get the data you want from the API.

If you have any questions/feedback/etc, feel free to either post here, PM me, or, if applicable, create an issue on GitHub. Thanks all, and happy programming!

(edited by TimeBomb.3427)

API Lib for node.js

in API Development

Posted by: Sayana.5923

Sayana.5923

It looks great, nice job. I’ve been playing with writing an AMD module in a very similar fashion.

API Lib for node.js

in API Development

Posted by: Yoone.9461

Yoone.9461

Thank you for your work, I may use it in the future.

API Lib for node.js

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

Just what I was looking for, thanks!

Creator of GW2Kit

API Lib for node.js

in API Development

Posted by: TimeBomb.3427

TimeBomb.3427

Thanks for the feedback, all; I’m glad you found this useful.

Because the GW2 API is reliant on itself for certain pieces of information, some of you may find the function waterfall inside of the node module async quite useful. It runs an array of functions one after another, waiting for a callback to be made in each function before continuing to the next. Each function is passed the results of the last. See: https://github.com/caolan/async#waterfall

Here is an example usage of this function I whipped up. The wvw match data is passed to the world name data and that information is combined to get a list of all wvw match-ups by name rather than by world ID.

The code: http://pastebin.mozilla.org/2448260

API Lib for node.js

in API Development

Posted by: TimeBomb.3427

TimeBomb.3427

I have just updated the github and npm of GW2NodeLib to add three new APIs:
guildDetails: /guildDetails.json
build: /build.json
colors: /colors.json