HP IDOL OnDemand on Salesforce (Apex)

What is IDOL OnDemand?

IDOL OnDemand delivers a growing set of RESTful APIs to help developers build apps that tackle the explosive growth of unstructured data. We’re exposing the capabilities of HP IDOL (Intelligent Data Operating Layer), the world’s leading on-premise human information processing engine, to deliver a wide selection of web services, including sentiment analysis, face detection, entity extraction, text indexing, and more – for quick and lightweight integration into your apps.

This article assumes that you already have an existing Salesforce developer edition account. If you still don't have a developer account, you may signup here:

Here are the steps on how to sign-up to IDOL OnDemand API Key

  1. Signup for an API key via the following link: https://www.idolondemand.com/signup.html
  2. Once finished, you will receive an API Key that looks like the following: xxxxxxxx-xxxx-xxxx-xxxx-10def765b016
  3. Take note of this key as we will use this to modify the Apex Class named IDOLClient.cls to allow you o try out the application using your own key.

Install the IDOL Demo Package

  1. Click on the installation link and then log into your Salesforce instance to install the application
  2. Make sure to grant third party access to "api.idolondemand.com"
  3. Click next on the Step 1. Approve Package API Access
  4. Select "Grant access to all users" on Step 2. Choose security level then hit next
  5. Click "Install" to install the package
  6. After installation, click the following link to get to the page. https://login.salesforce.com/apex/IDOLDemo
  7. If you see any errors on the previous step, make sure to log-out of any other salesforce instance and login to your developer edition account

Start playing with the HP IDOL OnDemand Application

  1. Select the API to test using the dropdown selection provided
  2. The text to search for Wikipedia and URL to search is provided for the convenience of the user upon selection
  3. Click "Execute API" to call the IDOL API and the results will be provided to the user in the text area provided
  4. The package is an Unmanaged Package so you may view all of the contents of the code

Using your own API Key

If you would like to use your own API Key, you may go to YOUR_NAME > Setup > App Setup > Develop > Apex Classes and edit the class named IDOLClient. Replace the value of the API_KEY with your own Key.

 

Salesforce codes included in the application

Apex Classes:

  • IDOLClient.cls - Main wrapper class for the HP IDOL OnDemandAPI
  • IDOLDemoController.cls - Controller for the IDOL Demo allowing the user to test out the API via a VisualForce page
  • IDOLAnalyzeSentimentResponse.cls - Converts the Analyze Sentiment JSON response into an Apex Class
  • IDOLFindSimilarResponse.cls - Converts the Find Similar JSON response into an Apex Class
  • IDOLOcrDocumentResponse.cls - Converts the OCR Document JSON response into an Apex Class
  • IDOLAnalyzeSentimentResponseTest.cls - Unit Test classes for IDOLAnalyzeSentimentResponse.cls
  • IDOLClientTest.cls - Unit Test classes for IDOLClient.cls
  • IDOLDemoControllerTest.cls - Unit Test classes for IDOLDemoController.cls
  • IDOLFindSimilarResponseTest.cls - Unit Test classes for IDOLFindSimilarResponse.cls
  • IDOLOcrDocumentResponseTest.cls - Unit Test classes for IDOLOcrDocumentResponse.cls

VisualForce pages:

  • IDOLDemo.page

 

Tips:

  • If you would like to try out the other API provided, you may use the following link to easily generate Apex Code from JSON response. http://json2apex.herokuapp.com/