-
Notifications
You must be signed in to change notification settings - Fork 2
Description
As discussed in: dwyl/app#273 having a REST and WebSocket API is a Top Priority for us. 🔝
We want anyone to be able to securely query their data using the API and an AUTH_API_KEY or JWT; this is our API Roadmap. For now we just need something super basic so that we can get moving on the Flutter MVP: dwyl/product-roadmap#40
Todo
We are breaking down this EPIC into 3 stages, an attempt chunk the work
so 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:
- Create a
newfile:API.mdin the root of the project where we write-up the details of the `API
Stage 1: No Auth 📖
- Create an unauthenticated API endpoint [
:authOptional] in theMVPApp
that enables the basicCRUDoperations foritemsandtimers: -
POSTtocreateanitemanonymously,/api/items/new
should only accept thetextdata and return anitem.id, e.g:200 '{"id":42}' -
PATCHtoEdit/Updateanitem.text: `/api/items/:id/update -
GETtoREADthe 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 the tags 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:
- API Consumer Tests: Feat: API Consumer Testing #268
Stage 2: Tags 🏷️
Creating tags and associating them to items is a bit more involved because it can require multiple API requests if we follow traditional REST conventions. We should definitely do that for completeness. But for UX we should also allow people to create an item and specify the tags in a single API request. 💭
- Create the
/api/tagsresource with: -
POSTfor/api/tags/new -
GETfor/api/tags/:idand -
PATCHfor/api/tags/:id/update
Next:
- Retrofit the
POST /api/items/newandPATCH /api/items/:id/updateendpoints to allow sending the tags onitemcreation 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. - Modify the
GET /api/items/:idto return thetagswith theiteme.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 the API 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 a JWT within the App which they can use to make authenticated API 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. 👌
Note: What we will eventually do is have an
api.dwyl.comsimilar to howGitHubdoes it: https://docs.github.com/en/rest/overview/resources-in-the-rest-api so theAPIwill run on a completely different server/service
@LuchoTurtle please take a look at this and LMK if it's clear enough for you to start work on it today. 🙏
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
