Application Programming Interface

The Application Programming Interface (API) is a contract between two programs that allows them to exchange information.

Analysts design the API and define:

  • communication protocol (HTTP, HTTPS?)
  • request and response format (JSON, XML, Protobuf)
  • authentication and authorization methods
Client and server signing an API contract

Real-life API example

When we need to navigate, we use a «Maps» application (Google Maps, Yandex Maps).

«Maps» provide geographic information not only to users but also to other applications via an API.

The «Navigator» application acts as the client, while the «Maps» application is the server.

  1. The «Navigator» sends a request over the HTTPS protocol with parameters for the starting and ending points of the route in JSON
  2. Receives a response in JSON format from the «Maps» application
  3. Displays the route, nearby gas stations, and warns about traffic congestion
plain-map
«Maps»
navigator-map
«Navigator»
Task

Act as a client. Send the server the coordinates to save the starting point.

Fill out the form «HTTP request form» and send an HTTP request to the server.


HTTP request form

Request format agreement:

  • URL address of the requested resource: /startpoint
    (in this case, we only use the address ending, i.e., the endpoint)
  • HTTP methodcorresponding to sending new data to the server
  • Header with content type application/json
    (indicates that the data will be sent in JSON format)
  • Request body must contain the parameters latitude and longitude in JSON format
Key Description Type Required * Constraints
latitude latitude number + from -90.0 to 90.0
longitude longitude number + from -180.0 to 180.0

* Required indicates whether the field must be specified:

+, Y, Yes, Да, 1required
-, N, No, Нет, 0..1optional

Sidebar arrow