-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EPIC: Basic REST API
#256
Comments
Just an update on this.
This error occurs in It's weird, this error shouldn't be happening according to the This could easily be surpassed by. just creating the pipeline :authOptional do
plug :fetch_session
plug(AuthPlugOptional)
end However, I feel like |
@LuchoTurtle in this instance a PR with tests is very welcome. 🙏 |
# Conflicts: # api.md # lib/app_web/router.ex # test/api/item_test.exs # test/api/timer_test.exs
@LuchoTurtle this is what I had mentioned for API docs: https://github.com/Doctave/doctave 💭 |
Would it make sense to use it for our API docs? Or do you want to battle-test it first? |
Fairly confident that doctave will work for our needs. 💭 question is: will we get API docs by using doctave or will we still need to use a tool like: https://github.com/open-api-spex/open_api_spex/blob/v3.16.1/README.md |
Should this issue be closed? A basic API Rest is already implemented (albeit without |
@LuchoTurtle as much as I would love to close this, |
As discussed in: dwyl/app#273 having a
REST
andWebSocket
API
is a Top Priority for us. 🔝We want anyone to be able to securely query their data using the
API
and anAUTH_API_KEY
orJWT
; this is ourAPI
Roadmap. For now we just need something super basic so that we can get moving on theFlutter MVP
: dwyl/product-roadmap#40Todo
We are breaking down this
EPIC
into 3 stages, an attempt chunk the workso that we can ship each stage as fast as possible.
We expect there to be 3 separate Pull Requests; one for each stage.
Rather than extending the already very long
BUILDIT.md
file,which is
75 pages
at the latest viewing:We will instead:
new
file:API.md
in the root of the project where we write-up the details of the `APIStage 1: No Auth 📖
:authOptional
] in theMVP
Appthat enables the basic
CRUD
operations foritems
andtimers
:POST
tocreate
anitem
anonymously,/api/items/new
should only accept the
text
data and return anitem.id
, e.g:200 '{"id":42}'
PATCH
toEdit/Update
anitem.text
: `/api/items/:id/updateGET
toREAD
the contents of theitem
, e.g:/api/items/:id
You'll notice that we are not doing
tags
in the first stage; this is deliberate because there's quite a lot going on in thetags
and we want to get the first!important
The purpose of this first stage is to ensure we have a good foundation for testing the
API
.That means having automated:
Stage 2:
Tags
🏷️Creating
tags
and associating them toitems
is a bit more involved because it can require multiple API requests if we follow traditionalREST
conventions. We should definitely do that for completeness. But for UX we should also allow people to create anitem
and specify thetags
in a singleAPI
request. 💭/api/tags
resource with:POST
for/api/tags/new
GET
for/api/tags/:id
andPATCH
for/api/tags/:id/update
Next:
POST /api/items/new
andPATCH /api/items/:id/update
endpoints to allow sending the tags onitem
creation and update.e.g:
{"text": "my awesome update", "tags": "awesome, priority-1"}
This will add some complexity so make sure you break it down into tiny + testable functions.GET /api/items/:id
to return thetags
with theitem
e.g:{"text": "Learn elixir", "tags": "learn"}
This is definitely a denormalisation and potentially "frowned upon" by some
REST
purists. But we don't care. We only care about UX. If the person using theAPI
can make fewer requests and get their data faster, we are happy. 😊Stage 3: With Authentication! 🔐
Once the Basic
REST API
is working [deployed!] we will allow people to view aJWT
within theApp
which they can use to make authenticatedAPI
Requests. There are a few extra steps to enable this so as soon as the previous 2 stages are complete (PRs merged & deployed) we will re-visit and expand on this stage. 👌@LuchoTurtle please take a look at this and LMK if it's clear enough for you to start work on it today. 🙏
The text was updated successfully, but these errors were encountered: