SDKs overview
APIs.guru operates as a curated directory of OpenAPI specifications for public APIs. Unlike platforms that provide pre-built, proprietary SDKs for a single API, APIs.guru's value proposition is enabling developers to generate their own client libraries for any API listed in its extensive collection. This approach leverages the standardized nature of OpenAPI Specification files, which describe an API's operations, parameters, and responses in a machine-readable format.
The core mechanism for obtaining an SDK from an APIs.guru-listed API involves using an OpenAPI client generator tool. The most widely adopted tool for this purpose is OpenAPI Generator, an open-source project that can consume an OpenAPI specification and produce client SDKs, server stubs, and documentation in various programming languages. This means that for any API present in the APIs.guru directory, a developer can download its OpenAPI definition and then use OpenAPI Generator to create a custom SDK tailored to their specific language and project requirements.
This model offers flexibility, allowing developers to choose their preferred language and integrate only the necessary components of an API. It also ensures that the generated SDKs are always based on the latest available OpenAPI specification, providing a current representation of the API's capabilities.
Official SDKs by language
As APIs.guru is a directory of OpenAPI specifications rather than a provider of a single API, it does not offer traditional "official" SDKs in the sense of a vendor-maintained library for its own API. Instead, the "official" SDK experience is realized through client generation tools that process the OpenAPI definitions hosted by APIs.guru. The directory itself provides the raw materials (OpenAPI files) from which client libraries can be constructed.
The primary tool for generating SDKs from APIs.guru's OpenAPI definitions is OpenAPI Generator. This tool supports a wide range of programming languages and frameworks. Developers download the OpenAPI YAML or JSON file for their desired API from the APIs.guru directory and then use OpenAPI Generator to scaffold a client library.
OpenAPI Generator Supported Languages (for APIs.guru definitions)
| Language | Package Type/Framework | Typical Install Command | Maturity/Support |
|---|---|---|---|
| Java | Maven, Gradle | mvn install:install-file ... (generated artifact) |
Stable, widely used |
| Python | pip | pip install -e . (generated source) |
Stable, active community |
| Go | go modules | go mod tidy (after generation) |
Stable, growing adoption |
| TypeScript/JavaScript | npm, yarn | npm install (generated package) |
Stable, excellent for web/Node.js |
| Ruby | Bundler, gem | bundle install (generated gem) |
Stable |
| C# | NuGet | dotnet add package ... (generated package) |
Stable, .NET ecosystem |
| PHP | Composer | composer require ... (generated package) |
Stable |
| Kotlin | Gradle, Maven | implementation '...' (generated artifact) |
Stable, Android/JVM |
| Rust | Cargo | cargo add ... (generated crate) |
Evolving, active development |
| Swift | Swift Package Manager | .package(url: "...", from: "1.0.0") |
Stable, iOS/macOS |
Installation
Installing an SDK for an API listed on APIs.guru involves a two-step process: obtaining the OpenAPI specification and then using a client generator. The following outlines the general steps using OpenAPI Generator, which is the most common approach.
Step 1: Obtain the OpenAPI Specification
- Browse APIs.guru: Navigate to the APIs.guru OpenAPI directory to find the API you wish to integrate.
- Download the Specification: For each API, APIs.guru provides a link to its OpenAPI specification file (typically in YAML or JSON format). Download this file to your local development environment. For example, for the SparkPost API v1, you would download the
swagger.yamlfile.
Step 2: Install and Use OpenAPI Generator
OpenAPI Generator can be installed and run in several ways:
Option A: Using Homebrew (macOS/Linux)
brew install openapi-generator
Option B: Using Docker
This is a common and recommended method as it avoids local environment conflicts.
docker pull openapitools/openapi-generator-cli
docker run --rm -v "$(pwd)":/local openapitools/openapi-generator-cli generate -i /local/your-api-spec.yaml -g python -o /local/generated-sdk
Replace your-api-spec.yaml with the path to your downloaded OpenAPI file, python with your target language, and generated-sdk with your desired output directory.
Option C: Direct JAR execution
Download the latest openapi-generator-cli.jar from the Maven Central repository.
java -jar openapi-generator-cli.jar generate -i your-api-spec.yaml -g java -o generated-java-sdk
After generation, the output directory (e.g., generated-sdk, generated-java-sdk) will contain the client library source code, along with instructions (often in a README.md) on how to build and integrate it into your project using standard package managers for your chosen language (e.g., npm install for JavaScript, pip install -e . for Python, mvn install for Java).
Quickstart example
This quickstart demonstrates generating a Python client for a hypothetical API discovered on APIs.guru, using the OpenAPI Generator. Assume you have downloaded an OpenAPI specification file named example-api-spec.yaml from APIs.guru.
Prerequisites
- Docker installed (for the Docker-based OpenAPI Generator command).
- A downloaded OpenAPI spec file (e.g.,
example-api-spec.yaml).
Step 1: Generate the Python SDK
Navigate to the directory where example-api-spec.yaml is located in your terminal.
docker run --rm -v "$(pwd)":/local openapitools/openapi-generator-cli generate \
-i /local/example-api-spec.yaml \
-g python \
-o /local/generated-python-sdk
This command will create a new directory named generated-python-sdk containing the generated Python client library.
Step 2: Install the Generated SDK
Change into the newly created SDK directory and install it. The specific commands may vary slightly based on the generated project structure, but a common pattern for Python is:
cd generated-python-sdk
pip install .
Alternatively, if you are developing, you might install in editable mode:
pip install -e .
Step 3: Use the SDK in Python
Create a new Python file (e.g., main.py) in a separate directory (e.g., one level up from generated-python-sdk) and import the generated client. The exact module and class names will depend on the API's structure and the generator's output, but generally follow a pattern like your_api_name_client.
import generated_python_sdk
from generated_python_sdk.api import default_api
from generated_python_sdk.model.some_request_body import SomeRequestBody # Example model
# Configure API key authorization (if required by the API)
configuration = generated_python_sdk.Configuration(
host = "https://api.example.com/v1" # Base URL of the API
)
configuration.api_key['ApiKeyAuth'] = 'YOUR_API_KEY'
# Or configure OAuth2 if applicable
# configuration.access_token = 'YOUR_OAUTH_TOKEN'
with generated_python_sdk.ApiClient(configuration) as api_client:
api_instance = default_api.DefaultApi(api_client)
# Example API call (replace with actual API method and models)
try:
# Assuming an API call like `create_resource` that takes a request body
body = SomeRequestBody(name="New Item", value=123) # Instantiate a generated model
api_response = api_instance.create_resource(some_request_body=body)
print("API Response:", api_response)
except generated_python_sdk.ApiException as e:
print("Error calling API: %s\n" % e)
except Exception as e:
print("An unexpected error occurred: %s" % e)
This example demonstrates the general flow. You will need to consult the README.md generated within your SDK directory for specific details on authentication, API methods, and data models relevant to your chosen API.
Community libraries
Given APIs.guru's role as a directory of OpenAPI specifications, its "community libraries" primarily manifest as generated client SDKs for individual APIs listed in its collection, rather than libraries specifically interacting with APIs.guru itself. The community contributes to APIs.guru by submitting and maintaining OpenAPI specifications for various public APIs, ensuring the directory remains up-to-date and comprehensive.
The vast ecosystem of tools built around the OpenAPI Specification effectively serves as the "community libraries" for APIs.guru. These tools, developed and maintained by a global community of developers, enable the consumption of the API definitions curated by APIs.guru. Key examples include:
- OpenAPI Generator: As detailed previously, this is the flagship community-driven tool for generating client SDKs, server stubs, and documentation from OpenAPI specifications. Its extensive language support (over 50 generators) is a direct benefit to users of APIs.guru. The project is hosted on GitHub and maintained by a large community.
- Swagger Codegen: An older, but still active, open-source project that serves a similar purpose to OpenAPI Generator, also enabling the generation of client libraries from OpenAPI/Swagger definitions. While OpenAPI Generator is a fork of Swagger Codegen, both are widely used. You can find its project on GitHub.
- Other Language-Specific Generators: Beyond the general-purpose generators, many smaller, language-specific tools and libraries exist that can parse OpenAPI specifications and assist in client generation or API interaction within particular environments. Examples include libraries focused on specific HTTP clients, data serialization, or framework integrations.
- Editor Plugins and IDE Integrations: Community-developed plugins for IDEs (like VS Code, IntelliJ IDEA) and text editors often provide features for validating, viewing, and sometimes even generating code snippets directly from OpenAPI files downloaded from APIs.guru.
The strength of APIs.guru's "community libraries" model lies in its reliance on the mature and diverse OpenAPI toolchain. This distributed development model ensures that as new languages, frameworks, and best practices emerge, the means to consume APIs.guru's definitions evolves accordingly, driven by the broader developer community.