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

Python / FastAPI

Installation

JavaScript / TypeScript

Install using a package manager:

npm install @drupal-api-client/json-api-client

Or 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-client

Reading 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:

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

Get Involved

If you're using the API Client in any capacity, please let us know.

Supporting organizations:
Project Funding via Pitch-burgh
Sponsored contribution

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.

Releases