Legacy Product

Fusion 5.4

Blob Store API

API Objective: Store binary large objects of any file type in a Solr database.

The Blob Store REST API allows storing binary objects in Solr. The primary use case for this is to store entity extraction models, lookup lists, or exclusion lists for use in index pipelines. This may include the entity extraction models and lookup lists included with Fusion in the https://FUSION_HOST:FUSION_PORT/data/nlp directory or files that you have created on your own.

You can also work with blobs in the Fusion UI using the blob manager.

Blobs uploaded to Solr with this REST API are stored in the system_blobs collection.

To upload a blob and associate it with a specific application, use https://FUSION_HOST:FUSION_PORT/api/apps/APP_NAME/blobs, and replace APP_NAME with your application name. Alternatively, upload your blob to https://FUSION_HOST:FUSION_PORT/api/blobs, which uploads the object to general blob storage and does not associate it with an application.

Blob Types

A resourceType query parameter can be used to specify the a blob type. For example, specify plugin:connector when uploading a connector:

curl -H 'content-type:application/zip' -X PUT 'https://FUSION_HOST:FUSION_PORT/api/apps/APP_NAME/blobs/myplugin?resourceType=plugin:connector' --data-binary @myplugin.zip

The following table contains a complete list of valid values for resourceType:

Type Description

banana

A Banana dashboard

catalog

driver:jdbc

file:js-index

A JavaScript file for use with a Managed Javascript index stage

file:js-query

A JavaScript file for use with a Managed Javascript query stage

file

Any uploaded file, such as from the Quickstart or the Index Workbench

model:open-nlp

unspecified

A blob of unknown type

If no resourceType is specified on upload, "other" is assigned by default.

plugin:connector

plugin:index-stage

plugin:query-stage

Examples

Upload a JavaScript file to the blob store

REQUEST

curl -u USERNAME:PASSWORD -X PUT -H 'Content-Type: text/javascript' --data-binary @query-pipeline-js-stage.js https://FUSION_HOST:FUSION_PORT/api/apps/APP_NAME/blobs/query-pipeline-js-stage.js?resourceType=file:js-query

The response is empty.

Verify that the JavaScript blob was uploaded

REQUEST

curl -u USERNAME:PASSWORD https://FUSION_HOST:FUSION_PORT/api/apps/APP_NAME/blobs?resourceType=file:js-query

RESPONSE

[{
  "id": "query-pipeline-js-stage.js",
  "path": "/query-pipeline-js-stage.js",
  "dir": "/",
  "filename": "query-pipeline-js-stage.js",
  "contentType": "text/javascript",
  "size": 0,
  "modifiedTime": "2018-09-11T16:23:17.743Z",
  "version": 1611328911094841344,
  "md5": "d41d8cd98f00b204e9800998ecf8427e",
  "metadata": {
    "resourceType": "file:js-query"
  }
}]

Upload an OpenNLP sentence model binary file to the blob store

REQUEST

curl -u USERNAME:PASSWORD -X PUT --data-binary @data/nlp/models/en-sent.bin -H 'Content-type: application/octet-stream' https://FUSION_HOST:FUSION_PORT/api/apps/APP_NAME/blobs/sentenceModel.bin

Fusion uses the name of the blob as specified in the API path. In this example, the blob is named sentenceModel.bin, rather than the original file name, en-sent.bin.

When using the blob in an index pipeline, use the name sentenceModel.bin.

Get the manifest for a sentence OpenNLP model we have previously saved in the blob store

REQUEST

curl -u USERNAME:PASSWORD -X HEAD https://FUSION_HOST:FUSION_PORT/api/apps/APP_NAME/blobs/sentenceModel.bin

RESPONSE

{
  "name": "sentenceModel.bin",
  "contentType": "application/octet-stream",
  "size": 98533,
  "modifiedTime": "2014-09-08T18:50:07.559Z",
  "version": 1478704189996531712,
  "md5": "3822c5f82cb4ba139284631d2f6b7fde"
}

Upload a JDBC driver, using slashes in the blob name

REQUEST

curl -u USERNAME:PASSWORD -X PUT --data-binary @postgresql-42.0.0.jar -H 'Content-length: 6' -H 'Content-type: application/octet-stream' https://FUSION_HOST:FUSION_PORT/api/apps/APP_NAME/blobs/good/to/go/jdbcDriverFile?resourceType=driver:jdbc

RESPONSE

{
  "name": "good/to/go/jdbcDriverFile",
  "contentType": "application/octet-stream",
  "size": 6,
  "modifiedTime": "2017-04-04T15:58:32.856Z",
  "version": 0,
  "md5": "b1946ac92492d2347c6235b4d2611184",
  "metadata": {
    "subtype": "driver:jdbc",
    "resourceType": "driver:jdbc"
  }
}

Get the JDBC driver that was uploaded

REQUEST

curl -u USERNAME:PASSWORD https://FUSION_HOST:FUSION_PORT/api/apps/APP_NAME/blobs?resourceType=driver:jdbc

RESPONSE

[{
  "name": "good/to/go/jdbcDriverFile",
  "contentType": "application/octet-stream",
  "size": 6,
  "modifiedTime": "2017-04-04T06:21:53.465Z",
  "version": 1563727666574524416,
  "md5": "b1946ac92492d2347c6235b4d2611184",
  "metadata": {
    "subtype": "driver:jdbc",
    "resourceType": "driver:jdbc"
  }
}]

Loading API specification...