kevinclement / SimpleArmory

World of Warcraft armory site that presents your armory in a simple manor.
http://simplearmory.com
MIT License
86 stars 71 forks source link

Exposing an API #428

Open maxdekrieger opened 2 years ago

maxdekrieger commented 2 years ago

Hi maintainers,

Over the past years, SimpleArmory has become the go-to ground truth on how many mounts someone has collected in my group of friends and guild, due to the logic that is applied combined with the well-maintained JSON data.

For a personal hobby project, I would like to use your logic to quickly check how much pets/mounts someone has, but looking at the source code, I didn't see an API that exposes this. However, I would like there to be one.

This is a big feature request from me and I'm looking to help create it, if you guys think it's doable and reasonable.

Let me know!

kevinclement commented 2 years ago

Hey Max. I'd love to learn more about your project and how you might be able to leverage the curated data and brainstorm. Just off the bat for some context, I'm not sure how familiar you are with some of this so I'll just lay it out.

SimpleArmory has been very intentionally a mostly client side driven experience. It leverages calls into blizzard and uses wowhead script and assets to render the experience for the most part without requiring much traditional hosting.

For a long time we were able to operate like this. The app gets deployed to a CDN, but didn't require any services running that we owned or had to pay for. We just use client side rendering and javascript to present the experience. This is commonly referred to as JamStack. It has some nice ergonomics, and is cheap.

About two years so ago blizzard went through a bunch of API changes. The major one being that they required authentication to the endpoint. A lot of sites have integrations into blizzard login and I could have made that work, but this kind of felt like a take back for the site. I liked that I didn't need to login just to checkout the armory of myself or other characters. In order to work around this requirement I did have to setup a proxy server. So this is now a service that is deployed that is utilized. For the most part though that thing is pretty hands off. It's been running for 2 years in cloudflare edge workers and I haven't had to update it and it's cheap.

That brings us to today, and your question/request. I suspect you want an api endpoint you can call, from some other codebase, and get back a json response you can reason over. As you suspected this isn't available as the logic is in the client code and depending on what your building likely isn't consumable. I can think on it some more to figure out how to help but will need a bit more info on what you're hoping to build and the tech you want to use, e.g. standalone app, written in xxx language, etc.

From there we can chat about how to help. I have some thoughts.

kevinclement commented 2 years ago

@maxdekrieger forgot to tag in reply :)

maxdekrieger commented 2 years ago

@kevinclement Wow thanks a lot for your interest and the detailed explanation!

I was familiar with the client-side nature of the project and that SimpleArmory didn't maintain persisted data but instead uses external resources (Wowhead, Armorystats, etc.). The Jamstack architecture and benefits are new to me. It sounds great for applications that can function properly and securely without server-side computation, although the exact role and responsabilities of Netlify still are a bit of magic to me 🪄.

The project I've been thinking about for some time is a completionist Discord bot. While progressing through mythic raids, my guildies and I need some way to keep us entertained and have mini-competitions going. I haven't fully determined the scope of the project, but a fun first version would include features like:

To achieve the goal of the bot being aware of updates in the collections of participants, I figured it would be useful to have background tasks run every x hours/days that persists and timestamps some collection data of participants. Since SimpleArmory is the ground truth for a lot of completionists and we love the project, I would like for SimpleArmory to provide this data such that it strengthens the role of SimpleArmory and it might attract more contibutors to SimpleArmory.

To build a Discord bot I would have to expose a web API for Discord to communicate with, and most likely host a database so I'll probably rent a VPS somewhere. I haven't decided on the tech I'm going to be using, everything is fine to me, but a language with a decent library that abstracts over the Discord communication protocols seems helpful.

Technically, exposing an API from SimpleArmory is not necessary since I could fetch a character from SimpleArmory in a headless browser, and parse the resulting HTML to extract the values I need, but this would introduce some overhead in performance and computation power needed.

I'd like to hear your thoughts! If you'd like, I'm also available for a chat over Zoom/Discord/Skype 😄

kevinclement commented 2 years ago

Sorry for delay commenting here. I read this last week, but never replied. I really like this idea, sounds like a fun project. I have a couple of ideas on a couple different ways we could enable this, but I need a bit more time to sit with my thoughts. I can circle back next week and either post here or figure out how to have higher bandwidth discussion.