Re: [bitfolk] usage API

Top Page

Reply to this message
Author: Matthew Copperwaite
Date:  
To: users
Subject: Re: [bitfolk] usage API
On Fri, 14 Feb 2020, 23:31 Andy Smith, <andy@???> wrote:

> Hi Conrad,
>
> On Fri, Feb 14, 2020 at 09:59:31AM +0000, Conrad Wood wrote:
> > is there an API endpoint I can query for current & predicted traffic
> > usage?
>
> I'm sorry but no there isn't.
>
> There could be one. I must admit I have never designed an API
> before, nor written the backend for one. I'm willing to give it a go
> but it might be slow to arrive and the first few iterations
> scrapped.
>
> Can you recommend any resources for learning how to do this?
>
> For authentication do I really need to go the whole OAuth 2 route or
> can API keys be enough?
>
> Let's assume you have authenticated by whatever method. It's
> probably best if that be valid for the whole customer record, so
> something like this:
>
> GET https://api.bitfolk.com/v1/guest
>
> …gives you a list of guests. But is that a list of IDs, or a list of
> guest names? Let's say it's a list of ID numbers.
>
> GET https://api.bitfolk.com/v1/guest/1234/xfer
>
> gives you back JSON for the current and predicted amounts in and out
> for the current accounting period as well as the period start and
> end times for guest id 1234?
>
> This is a big project for someone who has never done it before,
> unfortunately.
>
> Cheers,
> Andy
>
> --
> https://bitfolk.com/ -- No-nonsense VPS hosting
> _______________________________________________
> users mailing list
> users@???
> https://lists.bitfolk.com/mailman/listinfo/users



I would strongly recommend defining the API in OpenAPI V3.

I found it pretty easy to get going with. This also allows you to build an
open specification which can be shared in version control, the
documentation as a hosted static site, but also allows you to build stubs
in pretty much every language.

This means you could write it down, generate some code and fill in the
blanks.

And we can use that same document to generate our own code and integrate it
how we like.

As a note OpenAPI was previously Swagger but was wrapped up in a load of
trademarks and closed source stuff. OpenAPI is much more... Open.

Sorry, sounds like an advert, but it is pretty cool.

Matt