You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/01_course_intro/04_what_is_rest_api/README.md
+52-1Lines changed: 52 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,4 +110,55 @@ The main characteristics (or constraints) of a REST API are:
110
110
4.**Cacheable**. The client or server must be able to cache the resources returned by the API. This is a very general constraint, but it's an important one.
111
111
5.**Layered system**. REST APIs may be developed as multiple layers, where each layer interacts [only with the layer above and below it](https://excalidraw.com/#json=or3Umoigss4yIeuKg3cO8,qH6uDDCXc7DSjweqNvlmzw).
112
112
113
-
If you'd like to read a very complete and exhaustive guide about everything that a REST API is, check out [this guide](https://restfulapi.net/).
113
+
If you'd like to read a very complete and exhaustive guide about everything that a REST API is, check out [this guide](https://restfulapi.net/).
114
+
115
+
## The API we'll build in this course
116
+
117
+
In this course we'll build a REST API to expose interactions with stores, items, tags, and users. The API will allow clients to:
118
+
119
+
- Create and retrieve information about stores.
120
+
- Create, retrieve, search for, update, and delete items in those stores.
121
+
- Create tags and link them to items; and search for items with specific tags.
122
+
- Add user authentication to the client apps using the API.
123
+
124
+
The API will have these endpoints:
125
+
126
+
- Users
127
+
-`POST /register` to create user accounts given an `email` and `password`.
128
+
-`POST /login` to get a JWT given an `email` and `password`.
129
+
-`POST /logout` to revoke a JWT.
130
+
-`POST /refresh` to get a fresh JWT given a refresh JWT.
131
+
-`GET /user/{user_id}` (dev-only) to get info about a user given their ID.
132
+
-`DELETE /user/{user_id}` (dev-only) to delete a user given their ID.
133
+
- Stores
134
+
-`GET /stores` to get a list of all stores.
135
+
-`POST /stores` to create a store.
136
+
-`GET /stores/{id}` to get a single store, given its unique id.
137
+
-`DELETE /stores/{id}` to delete a store, given its unique id.
138
+
- Items
139
+
-`GET /items` to get a list of all items in all stores.
140
+
-`POST /items` to create a new item, given its name and price in the body of the request.
141
+
-`GET /items/{id}` to get information about a specific item, given its unique id.
142
+
-`PUT /items/{id}` to update an item given its unique id. The item name or price can be given in the body of the request.
143
+
-`DELETE /items/{id}` to delete an item given its unique id.
144
+
- Tags
145
+
-`GET /stores/{id}/tags` to get a list of tags in a store.
146
+
-`POST /stores/{id}/tags` to create a new tag.
147
+
-`POST /items/{id}/tags` to link an item in a store with a tag from the same store. This will take a list of tags in the body of the request so clients can link one or more tags at the same time.
148
+
-`DELETE /items/{item_id}/tags/{tag_id}` to unlink a tag from an item.
149
+
-`GET /tags/{id}` to get information about a tag given its unique id.
150
+
-`DELETE /tags/{id}` to delete a tag, which must have no associated items.
151
+
152
+
As you can see, we've got a lot to build!
153
+
154
+
We'll start building REST APIs in section 3, "Your first REST API". Here we'll create a simpler version of the REST API detailed above, without tags or user authentication.
155
+
156
+
Then, over the following sections, we'll improve on this REST API. We'll add:
157
+
158
+
- Flask extensions to simplify our code.
159
+
- Use Docker to run the API more reliably.
160
+
- Use PostgreSQL for data storage.
161
+
- Add user authentication.
162
+
- Add item tagging.
163
+
- Add an admin panel so changing data manually is a bit easier.
0 commit comments