• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

HTTP & REST API Fundamentals

Lomanu4 Оффлайн

Lomanu4

Команда форума
Администратор
Регистрация
1 Мар 2015
Сообщения
1,481
Баллы
155
HTTP


HTTP (Hypertext Transfer Protocol) is a protocol used for exchanging data over the web.
HTTP Request is sent by a client (e.g., a web browser or mobile app) to a server, asking it to perform an operation (such as fetching or modifying data).
The client then waits for the server's HTTP Response.

Real-World Examples:

  • Loading product lists
  • Fetching user profiles
  • Checking order status
RESTful APIs


RESTful(Representational State Transfer) is an architectural style for designing web services (APIs).
It efficiently utilizes HTTP methods (GET, POST, PUT, DELETE, etc.) to standardize how clients interact with server resources.

Key Features:


✔ Resource-based URLs (/users, /products)

✔ Stateless (no client data stored between requests)

✔ JSON/XML responses

✔ Standard HTTP methods

REST API Best Practices


Client-Server Architecture : Backend (API) and frontend (UI) should be completely separate.

Stateless : Each request must contain all necessary authentication/authorization data.

Cacheable : Responses (especially GET requests) should be cacheable.

Uniform Interface : Resource access must follow consistent and clear rules.

Layered System : The client should never directly access the database.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



HTTP Methods

MethodPurpose
GETRetrieve data
POSTCreate data
PUTFull update
PATCHPartial update
DELETERemove data
HTTP Status Codes

Code RangeTypeCommon Codes
1xxInformational100 Continue
2xxSuccess200 OK, 201 Created
3xxRedirection301 Moved Permanently
4xxClient Error400 Bad Request, 404 Not Found
5xxServer Error500 Internal Server Error
Request Headers:

  • Authorization: Passes credentials for authentication.
  • Content-Type: Specifies the media type (MIME type) of the request body.
  • Accept: Specifies the media type (MIME type) of the request body.
  • User-Agent: Identifies the client (browser, OS, or app).
Response Headers:

  • Content-Type: application/json
  • Access-Control-Allow-Origin(CORS) : Specifies which origins are allowed to access the resource.
  • Instructs the client to store cookies.
  • Set-Cookie: Session management
  • Rate limiting headers:
    • X-RateLimit-Limit
    • X-RateLimit-Remaining
    • Retry-After (on 429)


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу