jerkeeler / aoestats-frontend

GatsbyJS repo for the aoestats frontend
MIT License
15 stars 3 forks source link

Create API with machine-readable interface file (openAPI) #7

Open simonsan opened 4 years ago

simonsan commented 4 years ago

Hey there, I would like to propose that we create an API for the data at aoestats.io so for example we can pull in some data and show it for a civilisation on an OBS-overlay.

I would further propose to use openAPI ("specification for machine-readable interface files for describing, producing, consuming, and visualizing RESTful web services"): https://swagger.io/specification/

To easily create and validate the API file we can use apibldr https://www.apibldr.com/

jerkeeler commented 4 years ago

@simonsan I am actively working on this. Should be released by/during this weekend. I wasn't planning on generating an OpenAPI spec, but that's easily doable for me. I'm using Django on the backend with Django rest framework which automatically supports generating a OpenAPI spec from my code. I'll update this ticket when it is in production.

simonsan commented 4 years ago

@simonsan I am actively working on this. Should be released by/during this weekend. I wasn't planning on generating an OpenAPI spec, but that's easily doable for me. I'm using Django on the backend with Django rest framework which automatically supports generating a OpenAPI spec from my code. I'll update this ticket when it is in production.

Wow, I'm quite happy to hear this as I was writing the openapi files for aoe2net and in this moment for aoe2map to make it easier to use those APIs. Great news for me hearing, that

I think you use this approach then? https://www.django-rest-framework.org/api-guide/schemas/

It wasn't working (till now) with aoe2map, the assumption was "that requires that the api routes derive from particular classes, but in aoe2map they're simple free functions" by someone from SE discord. I'm trying to let it run on my Linux machine again, as it could have been some filesystem permissions as well.

yellow commented 4 years ago

Hello. I see this json file being requested when accessing the website. Maybe you can use this? Or was this added after the issue, I don't know... I have made some basic APIs in Python Flask so maybe I'll be of help.

yellow commented 4 years ago

i stupid https://api.aoestats.io/de/