M
M
MyHardWay2017-02-14 11:38:58
RESTful API
MyHardWay, 2017-02-14 11:38:58

Is it possible to use REST architecture for an online store?

Actually I study django in my free time, by creating a web store. I saw a lot of vacancies at the headhunter where knowledge of the REST framework is required, so I thought it would be nice to do my store through it. I would like to know if REST is used to create an online store? And if used, how? For example, to add a book to the basket PUT - /book/4/, to delete DELETE /book/4/, and to go to the page with a description GET /book/4/ ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-02-14
@MyHardWay

REST can be applied almost anywhere. The main thing is to understand why? Now you are trying to get a skill without knowing if it is needed in this or that place? Explore the scope first. What are the pros and cons of using it. Not knowing the answers to "Why?" and why?" about REST, it makes no sense to think about the questions "Can REST be applied to object X?"
GET /v1/books/ - show all books
GET /v1/books/1 - show book with ID equal to 1
DELETE /v1/books/ - delete all books - this is only with appropriate
privileges DELETE /v1/books/1 - delete book with ID equal to 1
POST /v1/books/ - Add new book
PUT /v1/books/1 - Update existing book with ID equal to ID
In doing so:
1. What is returned for a single GET /v1/books/ element must be exactly the same as for GET /v1/books/1.
2. Don't let the hacker figure out the cause of the error, it's better to get an HTTP 404 right away. In client code, it is rarely necessary to know the real cause of the error
3. Indicate the API version.
4. Don't bother with PATCH, HEAD HTTP methods. They rarely need anyone.
You can look at: https://apigee.com/console/instagram there you will see what and how you can cheat

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question