Glossary · 2 · Developer SDKs and APIs
Client library
Also known as: API client library, API client, Client SDK
In software engineering, a client library is a software library for one programming language that implements calls to a remote API, so that applications can use the service through idiomatic functions and objects instead of building requests, handling authentication and parsing responses themselves.
- Developer SDK
- APIs
In one sentence
A client library implements calls to a remote API in one programming language, handling requests, authentication and responses for the caller.
Example
Instead of building HTTP requests by hand, an application calls a storage service's Python client library, which signs each request, retries failed calls and returns typed objects.
How it applies
- Developer SDKs: Client libraries are the core of most developer SDKs for APIs and cloud services. They wrap a REST API or an RPC interface, take care of authentication, serialization, errors, retries and paging, and expose the result in the conventions of their language. Google Cloud, for example, describes its client libraries as reducing the code needed to call its APIs by handling authentication and low-level server communication.
- Hand-written vs. generated: Libraries are written by hand, generated from a machine-readable interface definition such as an OpenAPI description or a Protocol Buffers file (automatic code generation), or generated and then refined. OpenAPI Generator, for example, generates API client libraries, server stubs and documentation from an OpenAPI description. Generated code tracks the interface exactly but can be less idiomatic; Google notes this for its older auto-generated API client libraries.
- Versioning: A client library has its own version next to the API version. Semantic versioning of the library and a clear statement of which API versions it supports keep the two from drifting apart.
- Platform and hardware SDKs: Extensions and devices that talk to cloud services embed client libraries too, which ties their update cycle to the service's.
- Documentation: Reference documentation is often generated alongside the library; guides, code samples and migration notes are written per language. Samples should run against the current library version in the build pipeline.
Client library vs. software library
Every client library is a software library, but not every library is a client library. A client library exists to reach a remote service; its behavior depends on that service's interface contract, availability and limits, which a self-contained library does not have.
External references
- Google Cloud: Client libraries and Cloud APIs explained
- OpenAPITools: OpenAPI Generator