Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

Restconsumer

84 sites No security coverage
View on drupal.org

The Restconsumer module provides a JavaScript API to simplify AJAX requests using Drupal's built-in AJAX functionality. It offers a consistent interface for these requests, with built-in support for multilingual sites and helpful utilities for forms and file uploads.

Restconsumer

This module provides a simple abstracted javascript API for jQuery.ajax and Drupal.ajax.
It offers a consistent interface, multilingual support and some helpers for forms and uploads.
The API must be used by other modules to do anything benefecial.

Installation

1. Install using composer require drupal/restconsumer or via drupal.org/project/restconsumer.
2. Either depend on restconsumer/restconsumer or restconsumer/simple in your modules library.
3. Use the API in your javascript code.

Usage

restconsumer/simple
The simple dependency loads the Restconsumer_Wrapper class in the global javascript namespace.
You can then use this class to create objects tailored to your needs.

Example

var consumer = new Restconsumer_Wrapper(); // Create new consumer
consumer.setLang('fr'); // Set a language to prefix your endpoints (optional).
consumer.authorized = true; // Set authorized to true if you want to skip token authorization (optional).
consumer.get('/this/is/my/endpoint').done(function(data) {
  // Do something
});

restconsumer/restconsumer
The restconsumer/restconsumer will initialize with multilingual support and integrate itself with the Drupal javascript object under the key Drupal.restconsumer.
This is the usual way and provides you with a fully loaded and authorized object to start accessing Drupal's rest resources.
Example

Drupal.restconsumer.get('/this/is/my/endpoint').done(function(data) {
  // Do something
});

Activity

Total releases
1
First release
Oct 2025
Latest release
8 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Slowing

Releases

Version Type Release date
3.1.0 Stable Oct 22, 2025