Getting Started
Getting Started with Haven OnDemand

Getting Started with Haven OnDemand

This Getting Started page will get you flying with Haven OnDemand's powerful analysis services such as text analysis, search capabilities, and format conversion - in 5 to 10 minutes.


Getting Started

You can explore the Haven OnDemand APIs on the APIs page. Many APIs also have simple examples that you can run before you sign up.

To get full access to all the APIs, you must register a developer account to obtain an API key. You can then use your API key to submit data analysis requests.


Sign up for an API key

Setting up an account is easy. Simply visit www.havenondemand.com, click Sign up, and follow the instructions.

After approval of registration and confirming your email address by clicking the confirmation link in the Welcome email, you can create an API key and access all the developer tools.

The Account page allows you to manage your profile, API keys, usage, and indexes. To access the Account pages from the main menu, click the user icon, and then click Account.

You can retrieve your API key by using the Account API Keys page. When you are logged in, you can also find your API key in the Try page for each API.


The Developer Homepage

From the Developer Homepage, you can access the Showcase, API documentation, and the Haven OnDemand Community.

Browse the Showcase to see demonstrations of apps created using the Haven OnDemand APIs, including an Image Demo, Search Demo, and Expire Social, an app for social media reputation management.

Each API Reference page also has an online quick example Try tab where you can test example API requests, see the response formats, and generate request commands in cURL syntax.


API Format

A growing selection of APIs is available in Haven OnDemand, which can be accessed synchronously or asynchronously (see Synchronous and Asynchronous API). The APIs are categorized into main groups according to function (for a list of APIs and categories, see the API documentation).

Each API follows the following URI Resource syntax:

https://api.havenondemand.com/<PlatformVersion>/api/[Sync|Async]/<APIdentifier>/<APIVersion>

where:

  • <PlatformVersion> is the Haven OnDemand platform version. For the moment, this is always 1.
  • [sync|async] refers to whether you want to send a synchronous or asynchronous request. For more information, see Synchronous and Asynchronous API.
  • <APIdentifier> is the name of the API endpoint, such as querytextindex or extracttext. You can find these names in the API documentation.
  • <APIVersion> is the version of the API. The API version increases whenever an API change is made that would break an existing implementation (such as a change to a default parameter value or response format). Haven OnDemand recommends that you use the latest version where possible.

For example, to submit a Dog keyword search request to the Query Text Index API, use the following URL:

curl https://api.havenondemand.com/1/api/sync/querytextindex/v1?text=Dog&indexes=wiki_eng&apikey=<MyAPIKey>

Using the APIs

After you select an API from the API list, the API page opens. This page has several tabs:

  • The Overview tab provides you with a functional description of the API.

  • The Request tab details the request format including the URI Resource format and input parameters.

  • The Response tab details the Response format including the response data object details.

  • The Try tab provides a quick example. Each Try page has a UI with a quick example form that you can use to submit example requests and review the response data. The Try tab also generates a cURL command for the submitted request at the bottom of the page.


Code Example: Find Similar API

The following example code sends a multipart/form-data POST request to the Find Similar API, using cURL from a Windows cmd shell.

C:\Users\user1>curl -X POST -H Content-Type:multipart/form-data; ^
More?  -F file=@C:\Users\user1\Documents\bigbang.txt ^
More? -F apikey=<MyAPIKey> ^
More https://api.havenondemand.com/1/api/sync/findsimilar/v1

The file bigbang.txt contains the text from a newspaper article about the scientific confirmation of the big bang theory, in the New York Times from March 18, 2014. The first paragraph of the newspaper article reads:

Space Ripples Reveal Big Bang’s Smoking Gun CAMBRIDGE, Mass. — One night late in 1979, an itinerant young physicist named Alan Guth, with a new son and a year’s appointment at Stanford, stayed up late with his notebook and equations, venturing far beyond the world of known physics.

The full article text can be accessed here: http://nyti.ms/1fROdgc .

A successful response returns a 200 OK status code and the following JSON fragment of the response body:

{
"documents": [ {
"reference": "http://en.wikipedia.org/wiki/History of physics",
"weight": 58.6,
"links": [
"GUTH", "REPULS", "COSMOLOG", "ASTROPHYS", "COSMIC", "INFLAT", "EXERT", "PARTICL", "PARADOX", "TELESCOP", "HYPOTH"
],
"index": "wiki_eng",
"title": "History of physics"
}, {
..

Learn more at http://www.havenondemand.com.