This project is not covered by Drupal’s security advisory policy.
The Drupal API Client is a set of JavaScript or Python packages that simplify the process of interacting with common Drupal APIs. Most commonly, developers will use our JSON:API client to interface with Drupal's JSON:API endpoints, but we also publish a base API Client package that can be extended, a client for Decoupled Router, and may support other Drupal APIs in the future.
The JavaScript implementation of the Drupal API Client takes great care to be framework-agnostic and universal. It can be used:
- with your JavaScript framework of choice, vanilla JavaScript, or even in Drupal itself.
- with or without TypeScript.
- on the server, or on the client.
- with a bundler, or as a script import from a CDN.
The client was also recently added as a dependency to Drupal Canvas to support data fetching within Canvas code components.
Available Implementations
JavaScript / TypeScript
- GitLab repository:
https://git.drupalcode.org/project/api_client - npm packages:
https://www.npmjs.com/org/drupal-api-client
Python / FastAPI
- GitHub repository:
https://github.com/VincenzoGambino/drupal-api-client-python - PyPI package:
https://pypi.org/project/drupal-api-client/
Installation
JavaScript / TypeScript
Install using a package manager:
npm install @drupal-api-client/json-api-clientOr import from a CDN:
<script type="module">
import { JsonApiClient } from "https://esm.run/@drupal-api-client/json-api-client";
</script>You can then create an instance of the client and retrieve data from Drupal
import { JsonApiClient } from "@drupal-api-client/json-api-client";
const client = new JsonApiClient(
"https://drupal-api-demo.party",
);
const articles = await client.getCollection("node--article");Python
pip install drupal-api-clientReading a collection:
from drupal_api_client import JsonApiClient
with JsonApiClient("https://example.com") as client:
articles = client.get_collection("node--article")
for article in articles["data"]:
print(article["attributes"]["title"])Documentation
JavaScript / TypeScript
Learn much more in our documentation. Begin with either our Quick Start or our full JSON:API Client Tutorial.
Python
https://github.com/VincenzoGambino/drupal-api-client-python/blob/main/README.md
Issue Tracking
For implementation-specific bugs and feature requests, please use the corresponding locations:
- JavaScript / TypeScript issues → Drupal.org
- Python issues → GitHub
Drupal.org issues may still be used for:
- Issues related to the TS/JS packages.
- Drupal contribution credit attribution for either implementation.
- Cross-project discussions
- Umbrella project coordination
Pitch-burgh
- This project was initially funded by the communty as part of the Pitch-burgh Innovation Contest
- We completed our Pitch-burgh commitment by releasing JSON:API Client 1.0. Thanks to all who contributed along the way!
Get Involved
- #api-client on Drupal Slack
- Guide to contributing
If you're using the API Client in any capacity, please let us know.
Project information
- Ecosystem: Decoupled
- Created by brianperry on , updated
- shield alertThis project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.