api_tester
The API Tester module transforms your Drupal 10/11 site into a powerful development environment by embedding a full-featured REST client directly into the admin interface. It eliminates the need for external tools like Postman or Insomnia when testing internal Drupal routes or external third-party services. By leveraging Drupal's native authentication and session handling, it allows developers to test API responses with real user permissions and CSRF tokens in just a few clicks.
Features
- Comprehensive Request Builder: Support for all major HTTP methods (GET, POST, PUT, PATCH, DELETE) with a clean, Postman-inspired UI.
- Native Drupal Integration: Test endpoints as specific site users to verify complex Permission/Access Control logic without manual logout/login.
- Multi-Auth Support: Easily configure Bearer Tokens, Basic Auth, API Keys, or use the active Drupal Session with automatic CSRF token injection.
- Code Snippet Generation: Instantly convert your configured requests into production-ready code for 13+ languages including PHP (Guzzle), Python (Requests), and JavaScript (Fetch/Axios).
- Request Presets: Save frequently used API calls to a sidebar library for quick access and team debugging.
- Zero Dependencies: Built entirely with Drupal core libraries and Guzzle, ensuring a lightweight footprint and maximum compatibility.
Installation
Install the module using Composer (recommended) or download it manually to your custom modules directory.
composer require drupal/api_testerEnable the module using Drush:
drush en api_testerPost-Installation
After enabling the module, you must grant the necessary permissions to access the testing interface:
- Go to People » Permissions.
- Locate the API Tester section.
- Grant the "Use API Tester" permission to developer or administrator roles.
- Navigate to Configuration » Development » API Tester to begin testing.
Usage Workflow
The API Tester is designed to be intuitive for anyone familiar with modern API clients:
- Define: Enter your endpoint URL and select the method.
- Configure: Add headers or a JSON/Form-Data body in the dedicated tabs.
- Authenticate: Use the "Auth" tab to pick your strategy—select "Drupal Session" to test internal routes seamlessly.
- Execute: Click Send to view syntax-highlighted JSON, response headers, and performance timing info.
Additional Requirements
This module requires Drupal 10 or 11 and the Guzzle HTTP library (included with Drupal Core). It is compatible with modern evergreen browsers (Chrome, Firefox, Edge, Safari).
Similar projects
- OpenAPI (For API documentation and exploration)
- REST UI (For managing Drupal's native REST resources)
- JSON:API Explorer (Specific for JSON:API navigation)
Supporting this Module
If you encounter bugs or have ideas for new features—such as GraphQL support or OAuth2 integration—please contribute to the issue queue. Your feedback helps keep this tool robust for the Drupal developer community!