Get Content

Displays the content of one or more specified documents or document sections.

The Get Content API returns the content of documents in the text index, based on a list of references that you provide. You can find document references in the result from the Query Text Index API. For example, you might use the Query Text Index API to quickly return a list of references for documents that match a query, and then you can send subsequent Get Content requests to retrieve the content for the documents.

Quick Start

You can retrieve documents from the text indexes in the Public Text Indexes provided by Haven OnDemand, or from a text index you have created through the Create Text Index. You use the index_reference parameter to provide the reference for a document in the Haven OnDemand index, and the API returns the contents of the documents.

The following simple example requests the content of the API page from Wikipedia by providing the index (wikipedia), and the reference, which in this case is the URL of the page.

/1/api/[async|sync]/getcontent/v1?index_reference=http://en.wikipedia.org/wiki/Application programming interface&indexes=wiki_eng

The API returns all the documents that match the reference in the specified index, along with the default fields.

{
  "documents": [
    {
      "reference": "http://en.wikipedia.org/wiki/Application programming interface",
      "section": 0,
      "index": "wiki_eng",
      "title": "Application programming interface",
      "wikipedia_category": [
        "Technical communication",
        "Application programming interfaces"
      ]
    }
  ]
}

You can use the print and print_fields parameters to specify the content that you want to return. These options are the same as in the Query Text Index API. For example, you can print all fields by using print=all in the request.

You can pass multiple references to the API to return multiple documents. For example:

/1/api/[async|sync]/getcontent/v1?index_reference=myref1&index_reference=myref2&indexes=myindex

You can use the highlight_expression and start_tag parameters to mark up the document text with HTML tags that highlight the terms you specify. This option is the same as in the Highlight Text API.

Synchronous
https://api.havenondemand.com/1/api/sync/getcontent/v1
Asynchronous
https://api.havenondemand.com/1/api/async/getcontent/v1
Authentication

This API requires an authentication token to be supplied in the following parameter:

Parameter Description
apikey The API key to use to authenticate the API request.
Parameters

This API accepts the following parameters:

Required
Name Type Description
index_reference
array<string> The references of one or more documents whose content you want to display.
Optional
Name Type Description
end_tag
string The closing HTML tag to use to highlight a link term. If omitted, this is generated automatically from the start_tag.
highlight_expression
string The terms to highlight in the specified text. Separate the terms with spaces, pluses (+), or commas (,).
indexes
resource The text index to get content from. Default value: wiki_eng.
print
enum The types of fields and content to display in the results. Default value: fields.
print_fields
string The names of fields to print in the results.
start_tag
string The opening HTML tag to use to highlight a link term. Default value: <span style="background-color: yellow">.
summary
enum Return a summary of each document. Default value: off.
Enumeration Types

This API's parameters use the enumerations described below:

print
The types of fields and content to display in the results.
all All fields
all_sections All fields and all sections
date Date fields
fields Print the fields listed in the print_fields parameter
none Do not print content fields
no_results Do not print results
parametric Parametric fields
reference Reference fields
summary
Return a summary of each document.
concept Concept
Returns a conceptual summary of each result document. A concept summary contains sentences that are typical of the result content (these sentences can be from different parts of the result document).
quick Quick
Returns a brief summary of each result document. A quick summary contains the first few sentences of the document.
paragraphconcept Paragraph Concept
Returns a conceptual summary of each result document which contains the paragraphs that are most typical of the result content (these paragraphs can be from different parts of the result document).
off Off
No summary returns.

This API returns a JSON response that is described by the model below. This single model is presented both as an easy to read abstract definition and as the formal JSON schema.

Asynchronous Use

Additional requests are required to get the result if this API is invoked asynchronously.

You can use /1/job/status/<job-id> to get the status of the job, including results if the job is finished.

You can also use /1/job/result/<job-id>, which waits until the job has finished and then returns the result.

Model
This is an abstract definition of the response that describes each of the properties that might be returned.
Get Content Response {
documents ( array[Documents] ) The details of the returned documents.
}
Get Content Response:Documents {
index ( string , optional) The database that the result returned from.
reference ( string , optional) The reference string that identifies the result document.
section ( number , optional) The section number of the result document.
title ( string , optional) The title of the result document.
summary ( string , optional) A summary of the document.
}
Model Schema
This is a JSON schema that describes the syntax of the response. See json-schema.org for a complete reference.
{
    "properties": {
        "documents": {
            "items": {
                "properties": {
                    "index": {
                        "type": "string"
                    },
                    "reference": {
                        "type": "string"
                    },
                    "section": {
                        "type": "number"
                    },
                    "title": {
                        "type": "string"
                    },
                    "summary": {
                        "type": "string"
                    }
                },
                "type": "object"
            },
            "type": "array"
        }
    },
    "required": [
        "documents"
    ],
    "type": "object"
}
https://api.havenondemand.com/1/api/sync/getcontent/v1
/api/api-example/1/api/sync/getcontent/v1
Examples
See this API for yourself - select one of our examples below.
Alan Turing
Retrieve Wikipedia index content for 'Alan Turing' and highlight 'Alan Turing'
Parameters
Required
Name Type Value
index_reference
array
Add another value
Optional
Name Type Value
end_tag
string
highlight_expression
string
indexes
resource
print
enum
print_fields
string
start_tag
string
summary
enum


ASync – Response An error occurred making the API request
Response Code:
Response Body

	
Making API Request…
Checking result of job

To try this API with your own data and use it in your own applications, you need an API Key. You can create an API Key from your account page - API Keys.

Output Refresh An error occurred making the API request View Input
Rendered RawHtml Response
Result Display
Response Code:
Response Body:

			
Make this call with curl


If you would like to provide us with more information then please use the box below:

We will use your submission to help improve our product.