Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
modul:m290:learningunits:lu09:theorie:01 [2024/10/17 16:03] – vdemir | modul:m290:learningunits:lu09:theorie:01 [2024/11/21 11:57] (aktuell) – cbolzern | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ====== LU11a - CRUD and HTTP Methods | + | ====== LU11a - CRUD and HTTP Methods ====== |
**Source**: [[https:// | **Source**: [[https:// | ||
===== Learning Objectives ===== | ===== Learning Objectives ===== | ||
- | - Describe the four module relevant HTTP Methods | + | |
- | - Explain at least three differnences between the POST and GET method | + | - Explain at least three differnences between the POST and GET method |
- | | + | - Assign |
===== Introcuction ===== | ===== Introcuction ===== | ||
Zeile 18: | Zeile 18: | ||
**Practical Example:** | **Practical Example:** | ||
+ | |||
Imagine a website displaying a list of products. To retrieve the list of products from a server, the client would use a GET request. | Imagine a website displaying a list of products. To retrieve the list of products from a server, the client would use a GET request. | ||
Zeile 33: | Zeile 34: | ||
**Practical Example:** | **Practical Example:** | ||
+ | |||
Let’s say a user wants to add a new product to a database. They would submit a POST request containing the product data. | Let’s say a user wants to add a new product to a database. They would submit a POST request containing the product data. | ||
Zeile 54: | Zeile 56: | ||
**Practical Example:** | **Practical Example:** | ||
+ | |||
If a user wants to update the price of an existing product, they would send a PUT request with the updated information. | If a user wants to update the price of an existing product, they would send a PUT request with the updated information. | ||
Zeile 71: | Zeile 74: | ||
Here, the product with ID 123 is updated with the new name and price. | Here, the product with ID 123 is updated with the new name and price. | ||
+ | === 4. DELETE - Removing Data === | ||
+ | The DELETE method is used to delete a specified resource from the server. Like PUT, it is idempotent, meaning if you send the same DELETE request multiple times, the result (the resource being deleted) will be the same. | ||
+ | |||
+ | **Practical Example:** | ||
+ | |||
+ | If a user wants to remove a product from the database, they would issue a DELETE request specifying the resource to be deleted. | ||
+ | |||
+ | **Request: | ||
+ | |||
+ | http | ||
+ | DELETE / | ||
+ | |||
+ | **Example URL:** | ||
+ | |||
+ | https:// | ||
+ | |||
+ | This would delete the product with ID 123 from the server. | ||
+ | | ||
+ | |||
+ | ===== Correlation Between CRUD and HTTP Methods ===== | ||
+ | CRUD (Create, Read, Update, Delete) refers to the basic operations that can be performed on data in most applications, | ||
+ | |||
+ | {{: | ||
==== Vocabulary ==== | ==== Vocabulary ==== | ||
Zeile 76: | Zeile 102: | ||
| to fetch | abrufen, herholen| | | to fetch | abrufen, herholen| | ||
| to submit | zustellen, etwas vorlegen | | | to submit | zustellen, etwas vorlegen | | ||
+ | | to perform | ausführen | | ||
+ | |||
+ | |||