What is API (application programming interface)?

The set of rules (names of functions or operations, arguments, return values, data formats and so on) by which other programs call and use a piece of software's functions. Examples include operating-system APIs, library APIs and web APIs that exchange data over HTTP, such as REST APIs. Callers do not need to know the implementation, and the implementation can be replaced as long as the API stays the same. The equivalent agreement at the machine-code level is called the ABI.

Japanese name: API

API (application programming interface) appears in 9 practice questions across 4 topics, including Web Technology Basics, Cloud and Container Basics, Cyber Attacks and Defense in Practice.

Field: Software Development and Project Management

Try it: questions about API (application programming interface)

Cloud storage is used for three purposes: (1) attaching it to a virtual machine as a disk, creating a file system and storing database data files; (2) mounting it from several servers at the same time and using it as a shared directory; (3) reading and writing a large number of images by key (name) through an HTTP API and growing the capacity without deciding it in advance. Which of the following is the appropriate combination of storage types for (1) to (3)?

  1. A(1) object storage, (2) block storage, (3) file storage
  2. B(1) file storage, (2) object storage, (3) block storage
  3. C(1) block storage, (2) file storage, (3) object storage
Show answer and explanation

Answer: C. (1) block storage, (2) file storage, (3) object storage

Block storage attaches an area of fixed size to a virtual machine as a virtual disk; a file system is created on it, and it suits uses such as databases that perform many small reads and writes quickly. File storage provides a shared file system that several servers can mount at the same time through NFS, SMB or the like. Object storage reads and writes data as whole objects identified by keys through an HTTP API; its capacity can be grown almost without limit, and it suits images, backups and logs. It is not suited to rewriting part of an object, so database data files are not placed in it.

A web API returns data in JSON format as the body of its response. Which of the following headers is generally added to the response to indicate the format of the body?

  1. AAccept: application/json
  2. BContent-Type: text/html
  3. CContent-Type: application/json
Show answer and explanation

Answer: C. Content-Type: application/json

The kind of data in the body is indicated by the Content-Type header, whose value is a media type (MIME type) in the form "type/subtype", such as text/html or image/png. The media type of JSON is application/json. JSON is a text format that represents data with name-value pairs and arrays, as in {"id": 42, "tags": ["a", "b"]}; it is more concise than XML and easy to handle from JavaScript, so it is widely used in web APIs. The Accept header is used in a request to tell the server which formats the client wants to receive.

API (application programming interface) in the explanations

Questions that mention API (application programming interface) (9)

  1. Cloud storage is used for three purposes: (1) attaching it to a virtual machine as a disk, creating a file system and storing database data files; (2) mounting it from several servers at the same time and using it as a shared directory; (3) reading and writing a large number of images by key (name) through an HTTP API and growing the capacity without deciding it in advance. Which of the following is the appropriate combination of storage types for (1) to (3)?
  2. A web API returns data in JSON format as the body of its response. Which of the following headers is generally added to the response to indicate the format of the body?
  3. Which of the following is an appropriate web API design that follows the principles of REST?
  4. A developer accidentally committed a configuration file containing an API key for a cloud service to a public Git repository. On noticing, the developer immediately committed a change deleting the file. Which of the following is the most appropriate response after this?
  5. Which correctly describes an ABI (application binary interface)?
  6. A database password is stored in a Kubernetes Secret. Which of the following correctly describes a Secret?
  7. Which of the following correctly describes a typical signed JWT (JSON Web Token)?
  8. A photo-printing app, with the user's permission, reads the user's photos stored on another company's photo storage service. In OAuth 2.0, which of the following roles shows the user a screen asking for permission and, when the user agrees, issues an access token to the app?
  9. An access key with administrator privileges allowing all operations (a long-lived credential) was written in a configuration file and given to a batch job running in the cloud. Which of the following is the most appropriate revision to reduce the damage if this key leaks?

Books on Software Development and Project Management Ad

As an Amazon Associate I earn from qualifying purchases.

Related terms

HTTP (Hypertext Transfer Protocol) Object storage JSON (JavaScript Object Notation) REST API URL (Uniform Resource Locator) HTTP method Git Application binary interface (ABI) Calling convention Pointer

Back to the glossary