Skip to content

Commit a6a6ec0

Browse files
committed
style(endpoints): Use /item and /store instead of plural
1 parent 027a0d2 commit a6a6ec0

File tree

192 files changed

+1285
-1285
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+1285
-1285
lines changed

docs/docs/01_course_intro/04_what_is_rest_api/README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -147,33 +147,33 @@ We'll deal with user authentication in a later section, but that's what the lock
147147

148148
### Stores
149149

150-
| Method | Endpoint | Description |
151-
| ------ | -------------- | ---------------------------------------- |
152-
| `GET` | `/stores` | Get a list of all stores. |
153-
| `POST` | `/stores` | Create a store. |
154-
| `GET` | `/stores/{id}` | Get a single store, given its unique id. |
155-
| `POST` | `/stores/{id}` | Delete a store, given its unique id. |
150+
| Method | Endpoint | Description |
151+
| ------ | ------------- | ---------------------------------------- |
152+
| `GET` | `/store` | Get a list of all stores. |
153+
| `POST` | `/store` | Create a store. |
154+
| `GET` | `/store/{id}` | Get a single store, given its unique id. |
155+
| `POST` | `/store/{id}` | Delete a store, given its unique id. |
156156

157157
### Items
158158

159-
| Method | Endpoint | Description |
160-
| ---------------- | ------------- | --------------------------------------------------------------------------------------------------- |
161-
| 🔒 <br/> `GET` | `/items` | Get a list of all items in all stores. |
162-
| 🔒🔒 <br/> `POST` | `/items` | Create a new item, given its name and price in the body of the request. |
163-
| 🔒 <br/> `GET` | `/items/{id}` | Get information about a specific item, given its unique id. |
164-
| `PUT` | `/items/{id}` | Update an item given its unique id. The item name or price can be given in the body of the request. |
165-
| 🔒 <br/> `DELETE` | `/items/{id}` | Delete an item given its unique id. |
159+
| Method | Endpoint | Description |
160+
| ---------------- | ------------ | --------------------------------------------------------------------------------------------------- |
161+
| 🔒 <br/> `GET` | `/item` | Get a list of all items in all stores. |
162+
| 🔒🔒 <br/> `POST` | `/item` | Create a new item, given its name and price in the body of the request. |
163+
| 🔒 <br/> `GET` | `/item/{id}` | Get information about a specific item, given its unique id. |
164+
| `PUT` | `/item/{id}` | Update an item given its unique id. The item name or price can be given in the body of the request. |
165+
| 🔒 <br/> `DELETE` | `/item/{id}` | Delete an item given its unique id. |
166166

167167
### Tags
168168

169-
| Method | Endpoint | Description |
170-
| -------- | ----------------------- | ------------------------------------------------------- |
171-
| `GET` | `/stores/{id}/tags` | Get a list of tags in a store. |
172-
| `POST` | `/stores/{id}/tags` | Create a new tag. |
173-
| `POST` | `/items/{id}/tags/{id}` | Link an item in a store with a tag from the same store. |
174-
| `DELETE` | `/items/{id}/tags/{id}` | Unlink a tag from an item. |
175-
| `GET` | `/tags/{id}` | Get information about a tag given its unique id. |
176-
| `DELETE` | `/tags/{id}` | Delete a tag, which must have no associated items. |
169+
| Method | Endpoint | Description |
170+
| -------- | --------------------- | ------------------------------------------------------- |
171+
| `GET` | `/store/{id}/tag` | Get a list of tags in a store. |
172+
| `POST` | `/store/{id}/tag` | Create a new tag. |
173+
| `POST` | `/item/{id}/tag/{id}` | Link an item in a store with a tag from the same store. |
174+
| `DELETE` | `/item/{id}/tag/{id}` | Unlink a tag from an item. |
175+
| `GET` | `/tag/{id}` | Get information about a tag given its unique id. |
176+
| `DELETE` | `/tag/{id}` | Delete a tag, which must have no associated items. |
177177

178178
As you can see, we've got a lot to build!
179179

docs/docs/03_first_rest_api/05_make_request_to_rest_api/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Then, create a new Request Collection. Call it "Stores REST API".
3737
In the Request Collection, we can now add requests! Each request has a few parts:
3838

3939
- A **method**, such as `GET` or `POST`. The method is just a piece of data sent to the server, but _usually_ certain methods are used for certain things.
40-
- The **URL** that you want to request. For our API, this is formed of the "Base URL" (for Flask apps, that's `http://127.0.0.1:5000`), and the endpoint (e.g. `/stores`).
40+
- The **URL** that you want to request. For our API, this is formed of the "Base URL" (for Flask apps, that's `http://127.0.0.1:5000`), and the endpoint (e.g. `/store`).
4141
- The **body**, or any data that you want to send in the request. For example, when creating stores or items we might send some data.
4242
- The **headers**, which are other pieces of data with specific names, that the server can use. For example, a header might be sent to help the server understand _who_ is making the request.
4343

docs/docs/03_first_rest_api/07_creating_items/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def create_store():
8080

8181
# highlight-start
8282
@app.post("/store/<string:name>/item")
83-
def create_item_in_store(name):
83+
def create_item(name):
8484
request_data = request.get_json()
8585
for store in stores:
8686
if store["name"] == name:

docs/docs/06_sql_storage_sqlalchemy/02_create_simple_sqlalchemy_model/end/resources/item.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
blp = Blueprint("Items", "items", description="Operations on items")
1010

1111

12-
@blp.route("/items/<string:item_id>")
12+
@blp.route("/item/<string:item_id>")
1313
class Item(MethodView):
1414
@blp.response(200, ItemSchema)
1515
def get(self, item_id):
@@ -24,7 +24,7 @@ def put(self, item_data, item_id):
2424
raise NotImplementedError("Updating an item is not implemented.")
2525

2626

27-
@blp.route("/items")
27+
@blp.route("/item")
2828
class ItemList(MethodView):
2929
@blp.response(200, ItemSchema(many=True))
3030
def get(self):

docs/docs/06_sql_storage_sqlalchemy/02_create_simple_sqlalchemy_model/end/resources/store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
blp = Blueprint("Stores", "stores", description="Operations on stores")
1111

1212

13-
@blp.route("/stores/<string:store_id>")
13+
@blp.route("/store/<string:store_id>")
1414
class Store(MethodView):
1515
@blp.response(200, StoreSchema)
1616
def get(self, store_id):
@@ -20,7 +20,7 @@ def delete(self, store_id):
2020
raise NotImplementedError("Deleting a store is not implemented.")
2121

2222

23-
@blp.route("/stores")
23+
@blp.route("/store")
2424
class StoreList(MethodView):
2525
@blp.response(200, ItemSchema(many=True))
2626
def get(self):

docs/docs/06_sql_storage_sqlalchemy/02_create_simple_sqlalchemy_model/start/resources/item.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
blp = Blueprint("Items", "items", description="Operations on items")
1010

1111

12-
@blp.route("/items/<string:item_id>")
12+
@blp.route("/item/<string:item_id>")
1313
class Item(MethodView):
1414
@blp.response(200, ItemSchema)
1515
def get(self, item_id):
@@ -24,7 +24,7 @@ def put(self, item_data, item_id):
2424
raise NotImplementedError("Updating an item is not implemented.")
2525

2626

27-
@blp.route("/items")
27+
@blp.route("/item")
2828
class ItemList(MethodView):
2929
@blp.response(200, ItemSchema(many=True))
3030
def get(self):

docs/docs/06_sql_storage_sqlalchemy/02_create_simple_sqlalchemy_model/start/resources/store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
blp = Blueprint("Stores", "stores", description="Operations on stores")
1111

1212

13-
@blp.route("/stores/<string:store_id>")
13+
@blp.route("/store/<string:store_id>")
1414
class Store(MethodView):
1515
@blp.response(200, StoreSchema)
1616
def get(self, store_id):
@@ -20,7 +20,7 @@ def delete(self, store_id):
2020
raise NotImplementedError("Deleting a store is not implemented.")
2121

2222

23-
@blp.route("/stores")
23+
@blp.route("/store")
2424
class StoreList(MethodView):
2525
@blp.response(200, ItemSchema(many=True))
2626
def get(self):

docs/docs/06_sql_storage_sqlalchemy/03_one_to_many_relationships_sqlalchemy/end/resources/item.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
blp = Blueprint("Items", "items", description="Operations on items")
1010

1111

12-
@blp.route("/items/<string:item_id>")
12+
@blp.route("/item/<string:item_id>")
1313
class Item(MethodView):
1414
@blp.response(200, ItemSchema)
1515
def get(self, item_id):
@@ -24,7 +24,7 @@ def put(self, item_data, item_id):
2424
raise NotImplementedError("Updating an item is not implemented.")
2525

2626

27-
@blp.route("/items")
27+
@blp.route("/item")
2828
class ItemList(MethodView):
2929
@blp.response(200, ItemSchema(many=True))
3030
def get(self):

docs/docs/06_sql_storage_sqlalchemy/03_one_to_many_relationships_sqlalchemy/end/resources/store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
blp = Blueprint("Stores", "stores", description="Operations on stores")
1111

1212

13-
@blp.route("/stores/<string:store_id>")
13+
@blp.route("/store/<string:store_id>")
1414
class Store(MethodView):
1515
@blp.response(200, StoreSchema)
1616
def get(self, store_id):
@@ -20,7 +20,7 @@ def delete(self, store_id):
2020
raise NotImplementedError("Deleting a store is not implemented.")
2121

2222

23-
@blp.route("/stores")
23+
@blp.route("/store")
2424
class StoreList(MethodView):
2525
@blp.response(200, ItemSchema(many=True))
2626
def get(self):

docs/docs/06_sql_storage_sqlalchemy/03_one_to_many_relationships_sqlalchemy/start/resources/item.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
blp = Blueprint("Items", "items", description="Operations on items")
1010

1111

12-
@blp.route("/items/<string:item_id>")
12+
@blp.route("/item/<string:item_id>")
1313
class Item(MethodView):
1414
@blp.response(200, ItemSchema)
1515
def get(self, item_id):
@@ -24,7 +24,7 @@ def put(self, item_data, item_id):
2424
raise NotImplementedError("Updating an item is not implemented.")
2525

2626

27-
@blp.route("/items")
27+
@blp.route("/item")
2828
class ItemList(MethodView):
2929
@blp.response(200, ItemSchema(many=True))
3030
def get(self):

docs/docs/06_sql_storage_sqlalchemy/03_one_to_many_relationships_sqlalchemy/start/resources/store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
blp = Blueprint("Stores", "stores", description="Operations on stores")
1111

1212

13-
@blp.route("/stores/<string:store_id>")
13+
@blp.route("/store/<string:store_id>")
1414
class Store(MethodView):
1515
@blp.response(200, StoreSchema)
1616
def get(self, store_id):
@@ -20,7 +20,7 @@ def delete(self, store_id):
2020
raise NotImplementedError("Deleting a store is not implemented.")
2121

2222

23-
@blp.route("/stores")
23+
@blp.route("/store")
2424
class StoreList(MethodView):
2525
@blp.response(200, ItemSchema(many=True))
2626
def get(self):

docs/docs/06_sql_storage_sqlalchemy/04_configure_flask_sqlalchemy/end/resources/item.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
blp = Blueprint("Items", "items", description="Operations on items")
1010

1111

12-
@blp.route("/items/<string:item_id>")
12+
@blp.route("/item/<string:item_id>")
1313
class Item(MethodView):
1414
@blp.response(200, ItemSchema)
1515
def get(self, item_id):
@@ -24,7 +24,7 @@ def put(self, item_data, item_id):
2424
raise NotImplementedError("Updating an item is not implemented.")
2525

2626

27-
@blp.route("/items")
27+
@blp.route("/item")
2828
class ItemList(MethodView):
2929
@blp.response(200, ItemSchema(many=True))
3030
def get(self):

docs/docs/06_sql_storage_sqlalchemy/04_configure_flask_sqlalchemy/end/resources/store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
blp = Blueprint("Stores", "stores", description="Operations on stores")
1111

1212

13-
@blp.route("/stores/<string:store_id>")
13+
@blp.route("/store/<string:store_id>")
1414
class Store(MethodView):
1515
@blp.response(200, StoreSchema)
1616
def get(self, store_id):
@@ -20,7 +20,7 @@ def delete(self, store_id):
2020
raise NotImplementedError("Deleting a store is not implemented.")
2121

2222

23-
@blp.route("/stores")
23+
@blp.route("/store")
2424
class StoreList(MethodView):
2525
@blp.response(200, ItemSchema(many=True))
2626
def get(self):

docs/docs/06_sql_storage_sqlalchemy/04_configure_flask_sqlalchemy/start/resources/item.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
blp = Blueprint("Items", "items", description="Operations on items")
1010

1111

12-
@blp.route("/items/<string:item_id>")
12+
@blp.route("/item/<string:item_id>")
1313
class Item(MethodView):
1414
@blp.response(200, ItemSchema)
1515
def get(self, item_id):
@@ -24,7 +24,7 @@ def put(self, item_data, item_id):
2424
raise NotImplementedError("Updating an item is not implemented.")
2525

2626

27-
@blp.route("/items")
27+
@blp.route("/item")
2828
class ItemList(MethodView):
2929
@blp.response(200, ItemSchema(many=True))
3030
def get(self):

docs/docs/06_sql_storage_sqlalchemy/04_configure_flask_sqlalchemy/start/resources/store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
blp = Blueprint("Stores", "stores", description="Operations on stores")
1111

1212

13-
@blp.route("/stores/<string:store_id>")
13+
@blp.route("/store/<string:store_id>")
1414
class Store(MethodView):
1515
@blp.response(200, StoreSchema)
1616
def get(self, store_id):
@@ -20,7 +20,7 @@ def delete(self, store_id):
2020
raise NotImplementedError("Deleting a store is not implemented.")
2121

2222

23-
@blp.route("/stores")
23+
@blp.route("/store")
2424
class StoreList(MethodView):
2525
@blp.response(200, ItemSchema(many=True))
2626
def get(self):

docs/docs/06_sql_storage_sqlalchemy/05_insert_models_sqlalchemy/end/resources/item.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
blp = Blueprint("Items", "items", description="Operations on items")
1010

1111

12-
@blp.route("/items/<string:item_id>")
12+
@blp.route("/item/<string:item_id>")
1313
class Item(MethodView):
1414
@blp.response(200, ItemSchema)
1515
def get(self, item_id):
@@ -24,7 +24,7 @@ def put(self, item_data, item_id):
2424
raise NotImplementedError("Updating an item is not implemented.")
2525

2626

27-
@blp.route("/items")
27+
@blp.route("/item")
2828
class ItemList(MethodView):
2929
@blp.response(200, ItemSchema(many=True))
3030
def get(self):

docs/docs/06_sql_storage_sqlalchemy/05_insert_models_sqlalchemy/end/resources/store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
blp = Blueprint("Stores", "stores", description="Operations on stores")
1111

1212

13-
@blp.route("/stores/<string:store_id>")
13+
@blp.route("/store/<string:store_id>")
1414
class Store(MethodView):
1515
@blp.response(200, StoreSchema)
1616
def get(self, store_id):
@@ -20,7 +20,7 @@ def delete(self, store_id):
2020
raise NotImplementedError("Deleting a store is not implemented.")
2121

2222

23-
@blp.route("/stores")
23+
@blp.route("/store")
2424
class StoreList(MethodView):
2525
@blp.response(200, ItemSchema(many=True))
2626
def get(self):

docs/docs/06_sql_storage_sqlalchemy/05_insert_models_sqlalchemy/start/resources/item.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
blp = Blueprint("Items", "items", description="Operations on items")
1010

1111

12-
@blp.route("/items/<string:item_id>")
12+
@blp.route("/item/<string:item_id>")
1313
class Item(MethodView):
1414
@blp.response(200, ItemSchema)
1515
def get(self, item_id):
@@ -24,7 +24,7 @@ def put(self, item_data, item_id):
2424
raise NotImplementedError("Updating an item is not implemented.")
2525

2626

27-
@blp.route("/items")
27+
@blp.route("/item")
2828
class ItemList(MethodView):
2929
@blp.response(200, ItemSchema(many=True))
3030
def get(self):

docs/docs/06_sql_storage_sqlalchemy/05_insert_models_sqlalchemy/start/resources/store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
blp = Blueprint("Stores", "stores", description="Operations on stores")
1111

1212

13-
@blp.route("/stores/<string:store_id>")
13+
@blp.route("/store/<string:store_id>")
1414
class Store(MethodView):
1515
@blp.response(200, StoreSchema)
1616
def get(self, store_id):
@@ -20,7 +20,7 @@ def delete(self, store_id):
2020
raise NotImplementedError("Deleting a store is not implemented.")
2121

2222

23-
@blp.route("/stores")
23+
@blp.route("/store")
2424
class StoreList(MethodView):
2525
@blp.response(200, ItemSchema(many=True))
2626
def get(self):

docs/docs/06_sql_storage_sqlalchemy/06_get_models_or_404/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ We're going to use `.get_or_404()` repeatedly in our resources!
3131
For now, and since we'll need an `ItemModel` instance in all our `Item` resource methods, let's add that:
3232

3333
```python title="resources/item.py"
34-
@blp.route("/items/<string:item_id>")
34+
@blp.route("/item/<string:item_id>")
3535
class Item(MethodView):
3636
@blp.response(200, ItemSchema)
3737
def get(self, item_id):
@@ -58,7 +58,7 @@ class Item(MethodView):
5858
Similarly in our `Store` resource:
5959

6060
```python title="resources/store.py"
61-
@blp.route("/stores/<string:store_id>")
61+
@blp.route("/store/<string:store_id>")
6262
class Store(MethodView):
6363
@blp.response(200, StoreSchema)
6464
def get(self, store_id):

docs/docs/06_sql_storage_sqlalchemy/06_get_models_or_404/end/resources/item.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
blp = Blueprint("Items", "items", description="Operations on items")
1010

1111

12-
@blp.route("/items/<string:item_id>")
12+
@blp.route("/item/<string:item_id>")
1313
class Item(MethodView):
1414
@blp.response(200, ItemSchema)
1515
def get(self, item_id):
@@ -28,7 +28,7 @@ def put(self, item_data, item_id):
2828
raise NotImplementedError("Updating an item is not implemented.")
2929

3030

31-
@blp.route("/items")
31+
@blp.route("/item")
3232
class ItemList(MethodView):
3333
@blp.response(200, ItemSchema(many=True))
3434
def get(self):

0 commit comments

Comments
 (0)