I
I
Ivan2015-06-05 11:12:26
Django
Ivan, 2015-06-05 11:12:26

Why do you need a RESTful API?

Good day.
I have been trying to find the answer to my question for the second day in a row. I'll repeat it again - why a REST application?
Will the application make queries to the database more efficiently, or will data transfer from front to back and vice versa be faster? In the case of Django, you can also include standard methods out of the box, such as import json, for example, and they will essentially do the same. In this case, we do not need to create several new modules, such as serializers.py and write more code there.
Maybe I don't understand something? Perhaps for someone my question will turn out to be stupid, but I just want to figure out in which cases it will be useful to use the REST architecture, and in which it will be superfluous.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
marazmiki, 2015-06-05
@ATNC

You write about REST here, but you probably mean django-rest-framework (the best, in my opinion, existing solution for organizing a RESTful API for Django).
To begin with, answer yourself the question: does your site need an API at all. If it is objectively needed (for example, a mobile application interacts with the site, and not only reads data, but also sends it; or the frontend is built in such a way that only data is required from the server, and HTML is rendered on the client; or you provide information to "inanimate" users - robots), then RESTful API is a good choice. And DRF, respectively, too.
If all this is not there and you are quite satisfied with the scheme when the backend generates all the HTML and gives it to the client, then DRF, REST, and indeed the API as a whole are not needed.

D
Deodatuss, 2015-06-05
@Deodatuss

for one-pagers, when it is necessary that the page does not reload, but simply json is transmitted via ajax, which needs to be rendered on the client + for third-party services, for example, you need to make an android application to use the resource functionality, and then you can safely do whatever you want and as it suits you because you know that for such and such a request you will receive such and such data

V
Viktor Vsk, 2015-06-05
@viktorvsk

And what, in your understanding, REST, RESTful?

A
Alexander Tartmin, 2015-06-05
@baskerville42

Well, you most likely do not understand the purpose of REST. This is such a way of interacting with the server (it is not a single one, there are also SOAP and others). What you wrote about Django is just a way to give out information, not a way to access it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question