Access Keys:
Skip to content (Access Key - 0)

Knowledge Base API Proof of Concept Drupal Module

The MIT KB API Drupal module allows content from the MIT Knowledge Base to be seamlessly embedded in a Drupal site.
The result respects your site's CSS, so content from the MIT KB will have the same look and feel as the rest of your site.

Where can I see the Knowledge Base API Proof of Concept?

You can see the module on a sample Drupal site at:

Author and License

Written by Jessica Reed, MIT Information Systems & Technology
Copyright (c) 2014 Massachusetts Institute of Technology

The module is licensed under the GNU General Public License, Version 2 (GPL2).

What it does

  • The module installs an input filter which dynamically replaces the shortcode [mit-kb articleID]
    with the contents of an MIT Knowledge Base article in a public space. The contents are
    formatted with standard tags (<h1>, <strong>, <table>, etc.), and will respect your Drupal
    theme's CSS.
  • It will also replace the shortcode [mit-kb-excerpt articleID] with an excerpt from the
    article, as bounded by the tag in the article's markup.
  • This module leverages the MIT KB API. Documentation is available at: The Knowledge Base API
    • Note that as of this writing (August 2014) access to the KB API is still in testing, and API keys are not yet being issued to the general MIT community.
    • For beta testers, KB API will be limited to servers with MIT IP addresses.

How to install

The source code may be found on Github, located in the contrib directory.

  1. Install this module through Administration > Modules
    (see also: https://www.drupal.org/documentation/install/modules-themes)
  2. Enable the module Administration > Modules
  3. Enable the filter "MIT-KB" in each text format you want to use, via Configuration > Text Formats

Text formatting limitations

  • This will work out-of-the-box on pages with the text formats "Full HTML" and "PHP Code"
  • If you want to use it in a page with the "Filtered HTML" text format, you must add the
    following tags to the allowed HTML tags for that format:
      <img><h1><h2><h3><h4><h5><h6><table><tr><td>
    
  • (To add tags, go to Configuration > Text Formats > Filtered HTML > configure >
    Filter Settings > Limit Allowed HTML Tags, then add the desired tags to the
    "Allowed HTML Tags" field. Then save your configuration.)
  • You can omit any tags you don't want rendered on your site, but they will be treated
    as body text. (ex: the table-related tags are needed for tables and warning boxes)

How to use

  • To display the full contents of an article on your page, enter shortcode:
    [mit-kb articleID]
  • To display an excerpt from an article on your page, enter shortcode:
    [mit-kb-excerpt articleID]

Where "articleID" is the numerical ID of the KB article you want to display.

Possible future enhancements

  1. Enable access to articles in private spaces by adding an API token to the CURL request
    (See API documentation for details: http://kb.mit.edu/confluence/x/cVAYCQ)
  2. Add a filter tip and hook help, to give the user contextual help with the filter and module
    from within Drupal
  3. Add a prepare callback, to make sure that other filters don't strip the shortcode
    before it can be implemented. (This proof of concept only runs at the process stage)
  4. Allow the user to submit the short URL of the article, rather than the articleID
  5. Check for missing excerpts in valid KB articles. Right now, the API returns a 404 error
    if either the articleID is bad, or if you request an excerpt, but there is no excerpt defined
    in the article.

IS&T Contributions

Documentation and information provided by IS&T staff members


Last Modified:

July 16, 2015

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
Labels:
c-kb-api c-kb-api Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Feedback
This product/service is:
Easy to use
Average
Difficult to use

This article is:
Helpful
Inaccurate
Obsolete
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki