Developers

SDK HTML Example

This is an example of a full HTML integration of the Knowledge Manager SDK:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Inbenta km sdk</title>
    <script src="https://sdk.inbenta.io/km/1/inbenta-km-sdk.js"></script>
</head>
<body>
  <div>
      <div id="search-box"></div>     
      <div id="results"></div>   
      <div id="autocompleter"></div>
      <div id="popular"></div>   
      <div id="categories-breadcrumb"></div>
      <div id="categories"></div> 
  </div>
  <script type="text/javascript">
    var sdk = InbentaKmSDK.createFromAccessToken("<accessToken>","<key>");
    
    var searchBox = sdk.component('searchBox', '#search-box');
    var results = sdk.component('results', '#results');
    var autocompleter = sdk.component('autocompleter', '#autocompleter');
    autocompleter.linkToSearchBox(searchBox);
    results.linkToAutocompleter(autocompleter);
    results.linkToSearchBox(searchBox);
    var popular = sdk.component('popular', '#popular');
    var categories = sdk.component('categories', '#categories');
    var categoriesBreadcrumb = sdk.component('categoriesBreadcrumb', '#categories-breadcrumb');
    categories.linkToCategoriesBreadCrumb(categoriesBreadcrumb);
  </script>
</body>