Introduction to Drupal 8 API

Introduction to Drupal 8 API

What is API?

API stands for application program interface. It is a piece of code that allows another piece of code to interact with your Drupal site. in simple words, it allows a third-party application to interact with our Drupal site without human interaction.

 

Can we create our own API?

Yes, using "Services" module in Drupal you can create your own API. In basically handles the incoming request from the external client and sends the desired response.

 

Some examples of Drupal 8 APIs

  1. Authentication API
    It is used to authenticate user credentials and to limit the mode of authentication such as basic auth, cookie etc.

  2. Block API
    It is used to add blocks.

  3. Cache API
    The Cache is used to store data that takes a long time to compute. The cache data is stored for a perticular time limit. Cache API is used to retrieve, delete etc. the cache data.
     
  4. CKEditor API
    CKEditor is a rich text editor, It is default text editor in Drupal 8. CKEditor API is used to install CKEditor skin, load CSS in CKEditor iframe and to manage buttons in editor's toolbar.
     
  5. Configuration API
    Sometimes modules need to store some data. Configuration API allows them to store the data such as the module's configuration setting chosen by the site administrator.
     
  6. Database API
    It allows us to run queries on Drupal's database.
     
  7. Entity API
    All the data in our Drupal site such as field, node etc. all are Entity. Entity API is used to manage entities.
     
  8. Form API
    It is used to build and validate Form in Drupal
     
  9. Layout API
    The layout is an arrangement of content in a page. Layout API is used to register and render a layout.
     
  10. Menu API
    It is used to manage module specific menu links and tabs inside that menu link.
     
  11. Middleware API
    Middleware is a set of statement or condition that run just after a request from the client and just before processing of the request. Middleware API helps us to add middleware.
     
  12. Migrate API
    The Migrate API provides services for migrating data from different sources to Drupal 8.
     
  13. Response API
    If you found that response is the same for multiple or repetitive requests, then using Response API you can cache it to speed up the response.
     
  14. Routing API
    Routes are the link between a URL pattern and the set of statements (generally function). Routing API allows us to edit an existing route and to add new routes.

Know more about Drupal 8 API at https://www.drupal.org/docs/8/api