Main navigation

Create custom RESTful API endpoint with JSON output in Drupal 7

23 Aug 2018

RESTful API endpoints in Drupal can allow you to expose the content of Drupal 7 website to other external resources. These endpoints can be used for fetching data with an AJAX call or simply a web service.

For making complex RESTful web services in Drupal 7, Services module is the best option to go for but if you looking for a simple endpoint in Drupal 7, which outputs JSON response, then going with a custom solution will be the best bet.

Create API endpoint with JSON response in Drupal 7

To create a simple API endpoint in Drupal to serve a JSON put you need to create a custom callback