⊗inhpAdvRA 29 of 29 menu

REST API in HTTP protocol

Typically, when creating websites, only GET and POST methods are used to obtain, create, modify, and delete data, as they are well supported by browsers and servers. The same applies to APIs provided by websites. However, there are special approaches that standardize APIs for the general convenience of both API developers and users.

One approach is the REST API (often called RESTful, using this word as an adjective). This API is based on the extensive use of HTTP protocol methods. In this approach, the GET method is used to obtain data, the POST method is used to create data, the PUT method is used to change data, and the DELETE method is used to delete data.

For example, let's consider some API that manipulates users. Let's see what the URLs for different actions would look like.

We get all users:

GET http://api.loc/users/

We get one user by his id:

GET http://api.loc/user/1/

Create a user:

POST http://api.loc/user/

We change the user by his id:

PUT http://api.loc/user/1/

We delete a user by his id:

DELETE http://api.loc/user/1/

Let's say you have an API of online store products. Write the store URLs so that the API becomes RESTful.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline