liveBook · Manning

Api call

As explained in The Design of Web APIs, Second Edition

An API call is a request made by a client to invoke an API operation or retrieve API data.

An API call is a client request that invokes an operation or retrieves data. In an HTTP API, the request describes the action and required data; the server returns a response with a processing result and any resulting data. section 1.1.2

Designing an API call means mapping an operation to a path, HTTP method, input locations, response status, and output location. These choices make calls easier to use and more interoperable. section 4.1.2

Searching a product catalog

A mobile application sends GET /products?type=BD. GET represents searching, /products identifies the product catalog, and type=BD supplies a query filter. A 200 OK response returns matching products in the response body. section 4.1.1

When shaping an API call, decide:

  • Which resource path represents the operation. section 4.1.2
  • Which HTTP method represents the action, including verb-based operations that do not fit simple create, read, update, or delete categories. section 4.0
  • Where inputs and outputs belong, and which status codes describe success or failure. section 4.1.2
  • Whether repeated read or search calls retrieve data already available, so unnecessary calls can be removed from a flow. section 10.3.3
Figure 1.2 When calling a web API, the consumer sends an HTTP request indicating what to do and the needed data. Once the request is processed, the server returns an HTTP response indicating how the processing went and the resulting data.
figure

Use the request-response diagram to trace how a client supplies an action and data, then receives processing status and resulting data. section 1.1.2

How The Design of Web APIs, Second Edition covers it

How deep it goes
Explains paths, methods, parameters, statuses, and data locations, but defers detailed input and output modeling.
Examples
Demonstrates product searching with GET /products?type=BD and eliminates duplicate account-list calls from a money-transfer flow.
What it assumes
Assumes an identified operation, resource, inputs, and outputs, while introducing HTTP request-response mechanics through examples.
What you can do after
Apply it via HTTP by mapping an operation to a path, method, inputs, response status, and output data.
How it connects
Connects API calls with HTTP, REST APIs, HTTP methods, query parameters, status codes, and request-response design.

Also explained in

Compare how 3 books explain api call →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Design of Web APIs, Second Edition. The section links point to the parts of the book it draws on.