Skip to content

Latest commit

 

History

History
83 lines (50 loc) · 3.02 KB

File metadata and controls

83 lines (50 loc) · 3.02 KB

Web API

Table of contents

What is a web API

A web API is an API that a web server exposes over a protocol. It accepts requests from web clients and returns structured responses.

Docs:

Endpoint

An endpoint is a specific entry point of a web API, identified by a path (/status, /items, ...).

In a REST API, the HTTP method is also part of the identity — GET /status and POST /status are different endpoints.

Resource

A resource is an entity or piece of data that a web API exposes to clients.

Each resource is identified by a path in an endpoint — for example, /items refers to a collection of items and /items/{id} refers to a single item.

Base URL

The base URL is the common prefix shared by all endpoints of a web API. It identifies the server and, optionally, a path prefix such as a version segment.

To form a complete request URL, append an endpoint path to the base URL:

Part Example
Base URL https://api.example.com/v1
Endpoint /items
Full URL https://api.example.com/v1/items

API key

An API key is a secret value used to authenticate a client making requests to a web API.

<api-key> placeholder

API key (without < and >).

API key format

Note

The goal is to make the key easy to remember.

The API key string should include only these characters:

  • lowercase latin letters (a to z)
  • minus (-)

Examples:

  • my-secret-api-key

API types

A web API is built on top of a protocol.

Common API types:

HTTP API

An HTTP API is a web API that uses the HTTP protocol to accept requests and return responses.

It has no rules about URL structure or how HTTP methods are used — any path and method combination is valid.