HTTP verbs for CRUD

Now that you have designed clean endpoints for your API, it is time to take advantage of what we learned about HTTP verbs. You might be asking yourself how do you differentiate when you want to create, update, or delete a product if you are using the same endpoint, /products? This is the case where we use HTTP verbs. For example, for the /products endpoint, we will have something like the following verbs:

Endpoint HTTP Verb Goal
/products POST To create a new product
/products PUT To update an existing product
/products DELETE To delete an existing product

 

So from the preceding table, you can note that the key differentiator is the HTTP Verb. In short, an endpoint is composed by one path and an HTTP Verb.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.64.66