Note: Haven OnDemand recommends that you use the asynchronous version of the API for most indexing purposes, particularly for large documents or requests including more than a small number of test documents. See Get the Results of an Asynchronous Request. Synchronous requests block until index processing is complete, which might result in time outs for large requests.

When you submit a document to the API, it stores the content and metadata, and processes the contents of any special fields. The type of processing depends on the index field type. For more information, see Index Field Types.

You must provide the name of the index that you want to add the content to. For example:

/1/api/[async|sync]/addtotextindex/v1?index=myindex

You can then use this index in the Query Text Index API, and other index-based APIs to search, retrieve, and analyze your documents.

You can use the json parameter to add documents to your index. For example:

In this case, it adds two documents to the already created index myindex.

The API creates one index document for each document definition in the JSON.

The reference field, if present, is used as the document reference in the index. If you do not include a reference field, Haven OnDemand automatically creates one during indexing.

The content field contains the main document content. This field is processed as an Index type field.

The title field contains the document title. This field is processed as an Index type field.

You can include additional fields, such as myfield in the example. The field type for these fields depends on the flavor of your index. For more information about flavors, see Create Text Index. For information about the special fields configured for the standard index flavor, see Standard Flavor Index Configuration.

For most fields, you can specify multiple values by adding an array. However, if you use the following field values in your documents, they must contain a string or number, and cannot contain an array (even if the array contains only one value):

reference

title

content

doc_iod_reference

parent_iod_reference

Note: Field names in Haven OnDemand are not case sensitive. For example, the TITLE field name is equivalent to Title or title.

Rather than submitting documents in JSON format, you can alternatively submit a file, object store reference, or URL to the API. For example:

/1/api/[async|sync]/addtotextindex/v1?index=myindex&file= or url= or reference=

In this case, the API uses the Text Extraction API to extract the text content from the file, and creates the JSON documents automatically. In this case, the document reference field is the file name or URL that you submit.

You can also use Connectors to automatically extract content from your existing repositories, such as Microsoft SharePoint, and Intranet sites.

Get the Results of an Asynchronous Request

The asynchronous mode returns a job-id, which you can then use to extract your results. There are two methods for this:

Use /1/job/status/to get the status of the job, including results if the job is finished.

Use /1/job/result/, which waits until the job has finished and then returns the result.

Note: Because /result has to wait for the job to finish before it can return a response, using it for longer operations such as processing a large video file can result in an HTTP request timeout response. The /result method returns a response either when the result is available, or after 120 seconds, whichever is sooner. If the job is not complete after 120 seconds, the /result method returns a code 7010 (job result request timeout) response. This means that your asynchronous job is still in progress. To avoid the timeout, use /status instead.

URL

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

file

array<binary>

A file to index. The API passes the file to the Text Extraction API to extract the contents for indexing. Multipart POST only.

json

json

The JSON document to index.

reference

string

A Haven OnDemand reference obtained from either the Expand Container or Store Object API. The corresponding document is passed to the API.

url

string

A publicly accessible HTTP URL from which the document can be retrieved.

index

resource

The text index to add the file to.

Optional

Name

Type

Description

additional_metadata

array<json>

A JSON object containing additional metadata to add to the indexed documents. This option does not apply to JSON input. To add metadata for multiple files, specify objects in order, separated by an empty object.

Haven OnDemand uses cookies to enhance and improve the experience it provides. By continuing to use this site or pressing Continue,
we will assume that you accept receiving all cookies. If you would like to change which cookies are set, you can change your settings.