Skip to content

Commit

Permalink
correction URL in example
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrbonit committed Jul 13, 2016
1 parent 9cedfac commit fa29500
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions sources/29-web2py-english/10.markmin
Original file line number Diff line number Diff line change
Expand Up @@ -936,23 +936,23 @@ Loosely speaking REST says that a service can be thought of as a collection of r
So for example a POST request to

``
http://127.0.0.1/myapp/default/api/person
http://127.0.0.1:8000/myapp/default/api/person
``

means that you want to create a new ``person``. In this case a ``person`` may correspond to a record in table ``person`` but may also be some other type of resource (for example a file).

Similarly a GET request to

``
http://127.0.0.1/myapp/default/api/persons.json
http://127.0.0.1:8000/myapp/default/api/persons.json
``

indicates a request for a list of persons (records from the data ``person``) in json format.

A GET request to

``
http://127.0.0.1/myapp/default/api/person/1.json
http://127.0.0.1:8000/myapp/default/api/person/1.json
``

indicates a request for the information associated to ``person/1`` (the record with ``id==1``) and in json format.
Expand All @@ -961,21 +961,21 @@ In the case of web2py each request can be split into three parts:

- A first part that identify the location of the service, i.e. the action that exposes the service:
``
http://127.0.0.1/myapp/default/api/
http://127.0.0.1:8000/myapp/default/api/
``
- The name of the resource (``person``, ``persons``, ``person/1``, etc.)
- The communication protocol specified by the extension.

Notice that we can always use the router to eliminate any unwanted prefix in the URL and for example simplify this:

``
http://127.0.0.1/myapp/default/api/person/1.json
http://127.0.0.1:8000/myapp/default/api/person/1.json
``

into this:

``
http://127.0.0.1/api/person/1.json
http://127.0.0.1:8000/api/person/1.json
``

yet this is a matter of taste and we have already discussed it at length in chapter 4.
Expand Down
12 changes: 6 additions & 6 deletions sources/43-web2py-russian-translation-in-progress/10.markmin
Original file line number Diff line number Diff line change
Expand Up @@ -935,23 +935,23 @@ REST расшифровывается как "REpresentational State Transfer",
Так, например, POST-запрос на

``
http://127.0.0.1/myapp/default/api/person
http://127.0.0.1:8000/myapp/default/api/person
``

означает, что вы хотите создать новый ``person``. В этом случае ``person`` может соответствовать записи в таблице ``person``, но также может быть некоторым ресурсом другого типа (например, файлом).

Аналогичным образом GET-запрос на

``
http://127.0.0.1/myapp/default/api/persons.json
http://127.0.0.1:8000/myapp/default/api/persons.json
``

указывает на запрос списка лиц (записей из данных ``person``) в формате JSON.

GET-запрос на

``
http://127.0.0.1/myapp/default/api/person/1.json
http://127.0.0.1:8000/myapp/default/api/person/1.json
``

указывает на запрос информации, связанной с ``person/1`` (запись с ``id==1``) и в формате JSON.
Expand All @@ -960,21 +960,21 @@ http://127.0.0.1/myapp/default/api/person/1.json

- Первая часть, которая идентифицируют местоположение сервиса, то есть действие, которое предоставляет службу:
``
http://127.0.0.1/myapp/default/api/
http://127.0.0.1:8000/myapp/default/api/
``
- Имя ресурса(``person``, ``persons``, ``person/1`` и т.д.)
- Протокол связи, задаваемый расширением.

Обратите внимание на то, что мы всегда можем использовать маршрутизатор для устранения любого нежелательного префикса в URL и, например, упростить это:

``
http://127.0.0.1/myapp/default/api/person/1.json
http://127.0.0.1:8000/myapp/default/api/person/1.json
``

в этот:

``
http://127.0.0.1/api/person/1.json
http://127.0.0.1:8000/api/person/1.json
``

все же это дело вкуса, и мы уже обсуждали это в главе 4.
Expand Down

0 comments on commit fa29500

Please sign in to comment.