SearchBlox

SearchBlox Developer Hub

Welcome to the SearchBlox developer hub. Here you will find comprehensive guides and documentation to help you start working with SearchBlox as quickly as possible, as well as support if you get stuck. Let's jump right in!

Documentation

The SearchBlox REST-API enables the indexing and searching of custom content using simple HTTP POST and GET actions. The REST-API can add and delete documents from Custom, HTTP and File Collections only.

Note: This feature is available in SearchBlox Free and Enterprise Editions only.

Searchblox REST-API provides methods for working with standard and custom collections by means of REST requests with XML and JSON payloads. Index, delete, clear and check the status of custom collections, or create new custom collections using REST-API. Individual documents can also be added or deleted in HTTP and file collections.

SearchBlox Development Environment

The SearchBlox Development Environment is a simple browser-based tool designed to help developers use the SearchBlox REST-API with minimal effort. This tool is part of the SearchBlox deployment and can be accessed here: http://localhost:8080/searchblox/sde/index.jsp.

SearchBlox's SDE tool supports REST-XML API. POSTMAN is another external third party tool that can be used with Searchblox XML and JSON API. The settings for POSTMAN API can be found at the end of this documentation. For more details on the POSTMAN API tool, refer to https://www.getpostman.com.

Index

Index URL

REST-XML API
http://localhost:8080/searchblox/api/rest/add
REST-JSON API
http://localhost:8080/searchblox/rest/v2/api/add

Method

POST

Media Type

REST-XML API
text or text/xml or application/xml
REST-JSON API
application/json

Document Syntax

REST-XML API

?xml version="1.0" encoding="utf-8"?>
<searchblox apikey="5BD07C1F3E8555C66E1E5B10FCAB315F">
<document colname="Custom_Collection" location="http://www.searchblox.com/">
<title boost="1">SearchBlox Product Features</title>
<keywords boost="1">SearchBlox, Faceted Search, Features</keywords>
<content boost="1"> This content overrides the content from the document.</content>
<description boost="1">SearchBlox Content Search Features</description>
<lastmodified>30 May 2012 06:19:42 GMT</lastmodified>
<size>1111</size>
<alpha>Features</alpha>
<contenttype>HTML</contenttype>
<category>SearchBlox/Features</category>
<category>SearchBlox/Product</category>
<meta name="company">Searchblox Software Inc</meta>
<meta name="location">Richmond</meta>
</document>
</searchblox>

REST-JSON API

{
         "apikey" : "5BD07C1F3E8555C66E1E5B10FCAB315F",
         "document" : {
         "colname" : "Custom",
         "url" : "http://www.searchblox.com",
         "uid" : "http://www.searchblox.com",
         "location":"http://www.searchblox.com",
         "alpha" : "string",
         "size" : "44244",
         "title" : "Text",
         "keywords" : "keywords",
         "description" : "SearchBlox Content Search Software",
         "content" : "content",
         "lastmodified" : "14 January 2015 06:19:42 GMT",
         "contenttype" : "HTML",
         "meta":{
           "location":"San Francisco",
           "temp":"23",
           "weather":"sunny"
         }
     }
 }

Document Description

XML Tag/JSON key
Attribute
Value

searchblox

Licenseid

License value from license.xml file.

document

colname

Name of the custom collection.

document

Location

Value of file location (http://... or c:\documents...).

url

URL value to be returned with search results.

uid

Assigned unique identifier for a document (the URL is used as uid when unassigned).

title

Title value of search results.

title

boost

Boost value range from 1-10.

keywords

Keyword value of document.

keywords

boost

Boost value range from 1-10.

content

Content of document.

content

boost

Boost value range from 1-10.

description

Description of search result.

description

Boost

Boost value ranage from 1-10.

lastmodified

Date in format 07 May 2015 06:19:42 GMT.

size

Size value.

alpha

Text value for sorting.

contenttype

Type of content value (HTML, PDF, etc..,).

category

Value of category.

Response Codes

XML

100

Document Indexed

101

Error Indexing Document

500

Invalid Collection Name

502

Invalid Document Location

503

Specified collection is not a CUSTOM collection

JSON

100

Document Indexed

101

Error Indexing Document

501

Invalid Collection Name

502

Invalid Document Location

Delete

Delete URL

REST-XML API
http://localhost:8080/searchblox/api/rest/delete
REST-JSON API
http://localhost:8080/searchblox/rest/v2/api/delete

Method

POST

Media Type

REST-XML API
text or text/xml or application/xml
REST-JSON API
application/json

Document Syntax

REST-XML API

<?xml version="1.0" encoding="utf-8"?>
<searchblox apikey="302D02144F115712204DD54596EDDCCEDD2848A130215008BF2501E385617"> <document colname="Custom_Collection" uid="http://www.searchblox.com">
</document>
</searchblox>

REST-JSON API

{ 
  "apikey" :  "302D02144F115712204DD54596EDDCCEDD284878D3BBFA130215008BF2501E38561A439C9260D7", 
  "document" : 
 { 
  "colname" : "Custom_Collection", "location" : "http://www.searchblox.com" 
 } 
}

Document Description

XML Tag/JSON key
Attribute
Value

searchblox

licenseid

License value from license.xml file.

document

colname

Name of the custom collection.

document

uid

Value of unique identifier (file location http://...,
file://c:/documents/... or assigned UID).

Response Codes

XML

200

Document Deleted Successfully

201

Document requested for deletion does not exist

500

Invalid Collection Name

503

Specified collection is not a CUSTOM collection

JSON

2001

Document Deleted Successfully

2002

Document requested for deletion does not exist

501

Invalid Collection Name

Document Status

Status URL

REST-XML API
http://localhost:8080/searchblox/api/rest/status
REST-JSON API
http://localhost:8080/searchblox/rest/v2/api/status

Method

POST

Media Type

REST-XML API
text or text/xml or application/xml
REST-JSON API
application/json

Document Syntax

REST-XML API

<?xml version="1.0" encoding="utf-8"?> 
<searchblox apikey="302D02144F115712204DD54596EDDCCEDD28487A130215008BF2501E38561A439C9260D509DBF12952619177"> 
  <document colname="Custom_Collection" uid="http://www.searchblox.com"> 
  </document>
</searchblox>

REST-JSON API

{ 
  "apikey" : "302D02144F115712204DD508BF2501E38561A439C9260D509DBF12952619177", "document" : 
  { 
    "colname" : "Custom_Collection", "uid" : "http://www.searchblox.com" 
  } 
}

Document Description

XML Tag
Attribute
Value

searchblox

licenseid

License value from license.xml file.

document

colname

Name of the custom collection.

document

uid

Value of unique identifier (file location http://...,
file://c:/documents/... or assigned UID).

Response Codes

XML

301

Document Not Found

500

Invalid Collection Name

503

Specified collection is not a CUSTOM collection

JSON

501

Invalid Collection Name

Clear Collection

Clear URL

REST-XML API
http://localhost:8080/searchblox/api/rest/clear
REST-JSON API
http://localhost:8080/searchblox/rest/v2/api/clear

Method

POST

Media Type

REST-XML API
text or text/xml or application/xml
REST-JSON API
application/json

Document Syntax

REST-XML API

<?xml version="1.0" encoding="utf-8"?> 
<searchblox apikey="302D02144F115712204D30215008BF2501E38561A439C9260D509DBF12952619177"> 
  <document colname="Custom_Collection"> 
  </document> 
</searchblox>

REST-JSON API

{ 
"apikey" : "302D02144F115712204DD54596EDDCCEDD284878D3BBFA130215008BF2501E38561A439C9260D509DBF12952619177", 
"document" : 
{ 
"colname" : "Custom_Collection" 
} 
}

Document Description

XML Tag
Attribute
Value

searchblox

licenseid/apikey

License value from license.xml file.

document

colname

Name of the custom collection.

Response

XML

400

Collection Cleared

500

Invalid Collection Name

503

Specified collection is not a CUSTOM collection.

JSON

400

Collection Cleared

501

Invalid Collection Name

Add collection

You can add a new custom collection through REST-API using XML or JSON payload using the details provided below.

Add Collection URL

REST-XML API
http://localhost:8080/searchblox/api/rest/coladd
REST-JSON API
http://localhost:8080/searchblox/rest/v2/api/coladd

Method

POST

Media Type

REST-XML API
text or text/xml or application/xml
REST-JSON API
application/json

Document Syntax

REST-XML API

<?xml version="1.0" encoding="utf-8"?> <searchblox apikey="5BD07C1F3E8555C66E1E5B10FCAB315F"> <document colname="Custom_Collection"> </document> </searchblox>

REST-JSON API

{ 
  "apikey" : "5BD07C1F3E8555C66E1E5B10FCAB315F", 
  "document" : 
  { "colname" : "Custom_Collection" 
  } 
}

Document Description

XML Tag
Attribute
Value

document

colname

Name of the custom collection.

Response Codes

XML

900

Custom Collection Added

901

Failed Adding Collection

JSON

900

Custom Collection Added

901

Failed Adding Collection

Delete Collection

Users can delete existing custom collections through REST-API using XML orJSON payload using the details given below.

Delete Collection URL

REST-XML API
http://localhost:8080/searchblox/api/rest/coldelete
REST-JSON API
http://localhost:8080/searchblox/rest/v2/api/coldelete

Method

POST

Media Type

REST-XML API
text or text/xml or application/xml
REST-JSON API
application/json

Document Syntax

REST-XML API

<?xml version="1.0" encoding="utf-8"?> <searchblox apikey="5BD07C1F3E8555C66E1E5B10FCAB315F"> 
<document colname="Custom_Collection"> 
</document> 
</searchblox>

REST-JSON API

{ 
  "apikey" : "5BD07C1F3E8555C66E1E5B10FCAB315F", 
  "document" : 
  { 
    "colname" : "Custom_Collection"
  }
}

Document Description

XML Tag
Attribute
Value

document

colname

Name of the custom collection.

Response

XML

800

Custom Collection Deleted

500

Invalid Collection Name

503

Specified collection is not a CUSTOM collection

JSON

800

Collection Deleted

501

Invalid Collection Name

Add/Update Document

Users can add documents to an HTTP collection or File collection through REST-API using XML (SDE in SearchBlox can also be used) or JSON payload using the details given below.

Add/update Document URL

REST-XML API
http://localhost:8080/searchblox/api/rest/docadd
REST-JSON API
http://localhost:8080/searchblox/rest/v2/api/docadd

Method

POST

Media Type

REST-XML API
text or text/xml or application/xml
REST-JSON API
application/json
z

Document Syntax

REST-XML API

<?xml version="1.0" encoding="utf-8"?> <searchblox apikey="5BD07C1F3E8555C66E1E5B10FCAB315F"> <document colname="CollectionName" location="http://www.searchblox.com"> </document> </searchblox>

REST-JSON API

{ 
  "apikey" : "5BD07C1F3E8555C66E1E5B10FCAB315F", "document" : 
  { 
    "colname" : "CollectionName", "location" : "http://www.searchblox.com" 
  } 
}

Document Description

XML Tag
Attribute
Value

document

colname

Name of the Http or file collection.

document

location

Value of file location (http://... or c:\documents...).

Response

XML

1001

Custom Added Successfully

1002

Document couldn't be reached

JSON

1001

Custom Added Successfully

1002

Document couldn't be reached

501

Invalid Collection Name

Delete Document

Users can delete documents from an HTTP collection or File collection through REST-API from the Delete Document tab in SDE, using the XML code given in the Document Syntax section below.

Delete Document URL

REST-XML API
http://localhost:8080/searchblox/api/rest/docdelete
REST-JSON API
http://localhost:8080/searchblox/rest/v2/api/docdelete

Method

POST

Media Type

REST-XML API
text or text/xml or application/xml
REST-JSON API
application/json

Document Syntax

REST-XML API

<?xml version="1.0" encoding="utf-8"?> 
<searchblox apikey="5BD07C1F3E8555C66E1E5B10FCAB315F"> 
<document colname="CollectionName" uid="http://www.searchblox.com"> </document> </searchblox>

REST-JSON API

{ 
  "apikey" : "5BD07C1F3E8555C66E1E5B10FCAB315F", "document" : 
 { 
   "colname" : "CollectionName", "location" : "http://www.searchblox.com" 
 }
}

Document Description

XML Tag
Attribute
Value

document

colname

Name of the HTTP or file collection.

document

uid

Value of unique identifier (file location http://..., file://c:/documents/... or assigned UID).

Response

XML

2001

Document deleted successfully

506

Invalid Document UID

JSON

2001

Document Deleted Successfully

506

Invalid Document UID

501

Invalid Collection Name

Response Codes

Document Syntax

<?xml version="1.0" encoding="utf-8"?> 
<searchblox> 
  <statuscode>100</statuscode> 
  <statusdesc>Document Indexed</statusdesc> 
</searchblox>

Status Code Description

100

Document Indexed

101

Error Indexing Document

200

Document Deleted

201

Document requested for deletion does not exist

301

Document Not Found

400

Collection Cleared

401

Error Clearing Collection

404

URL Not found

405

Method not allowed or incorrect method selected

415

Unsupported Media Type

500

Invalid Collection Name

501

Invalid Request

502

Invalid Document Location

503

Specified collection is not a CUSTOM collection

504

Licensed Document Limit Exceeded

506

Invalid Document UID

601

Invalid License ID

602

Custom documents not supported by this edition of SearchBlox

800

Custom Collection Deleted

900

Custom Collection Added

1001

Document Added Successfully

1002

Document Couldn't Be Reached

2001

Document Deleted Successfully

2002

Specified collection is not a custom collection

Settings in POSTMAN API

Postman API is a third-party tool that can be using with SearchBlox API. The prerequisite settings that are required to work with SearchBlox API are as follows:

  1. URL to be given for each API function as mentioned under each function in the above documentation.
  2. Method to be selected is POST for all functions.
  3. Header to be added is Content-Type, which has to be given as header. The value for the header for XML API is application/xml, and for JSON API it is application/json. This could be also done by selecting the dropdown XML or JSON as required.

The screenshots for XML and JSON API on settings and result are given below. Select raw to view the status code for JSON API.

XML API POSTMAN settings

JSON API POSTMAN settings

REST API