Administer > Smart Analytics administration > Smart Analytics APIs > Smart Analytics RESTful APIs > Smart classification (by specifying IDOL adapters)

Smart classification (by specifying IDOL adapters)

This section introduces another way to perform auto-classification by using two two RESTful APIs.

Use the first API to query all the categorization configurations, and then use your desired configuration (adapter id) to call the second API, which will return the category values.

Normally, you only need to use the first API once to get the configuration while you can use the second API to do categorization jobs as many times as you need.

API-1: Get all the configurations/adapters definitions

Request:

GET http://<SM Server Address>:13930/SM/9/rest/idoladapters?view=expand

Response example:

{
  "@count": 2,
  "@start": 1,
  "@totalcount": 2,
  "Messages": [],
  "ResourceName": "idoladapter",
  "ReturnCode": 0,
  "content": [
    {"idoladapter": {
      "adapter.id": 5,
      "level1.field": "affected.item",
      "source": [
        "title",
        "description"
      ]
    }},
    {"idoladapter": {
      "adapter.id": 7,
      "level1.field": "category",
      "level2.field": "subcategory",
      "level3.field": "product.type",
      "source": [
        "title",
        "description"
      ]
    }}
  ]
}

 

API-2: Get the categorization result based on adapter id. (For example: id=137, company=Micro Focus, text="my laptop is broken", return top 2 suggestions)

Request:

POST http://<SM Server Address>:13080/sm/9/rest/idoladapters/{adapter.id}

An example of the request body:

{
  "idoladapter":{ 
  "source":["Critical CPU temp. BIOS error message", Maybe I work too hard, but the temperature of my computers CPU is critical according to the error message it displays in the message"],
  "company" :"microfocus", 
  "top":2 
  } 
} 
 

Response example:

{ 
  "Messages": [], 
  "ReturnCode": 0, 
  "idoladapter": { 
    "level1.field": "category", 
    "level2.field": "subcategory", 
    "level3.field": "product.type", 
    "suggest.candidates": [ 
      { 
         "level1.value": "request for service", 
         "level2.value": "app. infrastructure", 
         "level3.value": "shared web hosting" 
      }, 
      { 
         "level1.value": "request for service", 
         "level2.value": "infrastructure", 
         "level3.value": "server" 
      } 
     ] 
     } 
}