fission-codes / fission

Fission CLI & server
https://runfission.com/docs
119 stars 14 forks source link

Versioned REST API #546

Closed expede closed 3 years ago

expede commented 3 years ago

Currently Deployed

Today our API is unversioned:

»  curl https://runfission.net/ping
"pong"

This has lead to breaking changes downstream in JS when the return types changed to support a feature in the CLI

This PR

»  curl https://runfission.net/v2/api/ping
"pong"

Why the version first? Because we're also going to having things like versioned docs (/v2/docs). I have no strong feelings on this; just seemed to make sense.

While I Had the Hood Up 👩‍🔧

We've had folks try to use 3rd party tools to check if our server is up. We have nothing at the root, so these didn't return a success code and show as failed. For example:

»  curl -i https://runfission.com/
HTTP/2 404
date: Sun, 29 Aug 2021 05:05:10 GMT
server: Warp/3.3.17

https://downforeveryoneorjustme.com/runfission.com

Screen Shot 2021-08-27 at 16 47 31

...except it's not down; it's just not returning a 200-level code!

So I added an empty path at the root that returns a 200 and no body:

»  curl -i https://runfission.net/
HTTP/2 200
date: Fri, 27 Aug 2021 23:40:40 GMT
content-type: application/json;charset=utf-8
server: Warp/3.3.17
Screen Shot 2021-08-27 at 16 48 29

Docs

Latest

Screen Shot 2021-08-28 at 16 35 40

V2

(Currently the latest)

Screen Shot 2021-08-28 at 16 35 34