SearchBlox

SearchBlox Developer Documentation

Welcome to the SearchBlox developer documentation. Here you will find comprehensive technical 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!

Guides

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.

SearchBlox REST-API provide 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 otherwise known as API Explorer 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 API Explorer supports REST-XML and REST-JSON 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>SearchBlox Product Features</title>
<keywords>SearchBlox, Faceted Search, Features</keywords>
<content> This content overrides the content from the document.</content>
<description>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",
         "urllen": "300",  
         "meta":{
           "location":"San Francisco",
           "temp":"23",
           "weather":"sunny"
         }
     }
 }

Document Description

XML Tag/JSON keyAttributeValue
searchbloxLicenseidLicense value from license.xml file.
apikeyAPI key from http://localhost:8080/searchblox/admin/main.jsp?menu1=adm.
documentcolnameName of the custom collection.
documentLocationValue of file location (http://... or c:\documents...).
urlURL value to be returned with search results.
uidAssigned unique identifier for a document (the URL is used as uid when unassigned).
titleTitle value of search results.
titleboostBoost value range from 1-10.
keywordsKeyword value of document.
keywordsboostBoost value range from 1-10.
contentContent of document.
contentboostBoost value range from 1-10.
descriptionDescription of search result.
descriptionBoostBoost value ranage from 1-10.
lastmodifiedDate in format 07 May 2015 06:19:42 GMT.
sizeSize value.
alphaText value for sorting.
contenttypeType of content value (HTML, PDF, etc.,).
urllenlength
metameta fields to be updated

Response Codes

XML

CodeDescription
100Document Indexed
101Error Indexing Document
500Invalid Collection Name
502Invalid Document Location
503Specified collection is not a CUSTOM collection

JSON

codeDescription
100Document Indexed
101Error Indexing Document
501Invalid Collection Name
502Invalid Document Location

Update Meta Data

updatemetadata URL

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

Method

POST

Media Type

REST-JSON API
application/json

Document Syntax

REST-JSON API

{
         "apikey" : "31372006F71D0A874BBE0F02894C7E0A",
         "document" : {
         "colname" : "custom",
         "url" : "http://www.searchblox.com",
         "meta":{
           "location":"San Francisco",
           "temp":"23",
           "weather":"sunny
         }
     }
 }

Document Description

JSON AttributeDescription
apikeyAPI key from http://localhost:8080/searchblox/admin/main.jsp?menu1=adm.
colnameName of the collection
urlURL value to be returned with search results.
meta fieldscustom fields

Response Codes

CodeDescription
7000Meta Data updated successfully
601Invalid API Key
7003Document not found

Delete

This is to delete documents only in custom collection

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", "uid" : "http://www.searchblox.com" 
 } 
}

Document Description

XML Tag/JSON keyAttributeValue
searchbloxlicenseidLicense value from license.xml file.
apikeyAPI key from http://localhost:8080/searchblox/admin/main.jsp?menu1=adm.
documentcolnameName of the custom collection.
documentuidValue of unique identifier (file location http://...,
file://c:/documents/... or assigned UID).

Response Codes

XML

200Document Deleted Successfully
201Document requested for deletion does not exist.
500Invalid Collection Name
503Specified collection is not a CUSTOM collection.

JSON

2001Document Deleted Successfully
2002Document requested for deletion does not exist.
501Invalid 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 TagAttributeValue
searchbloxlicenseidLicense value from license.xml file.
apikeyAPI key from http://localhost:8080/searchblox/admin/main.jsp?menu1=adm.
documentcolnameName of the custom collection.
documentuidValue of unique identifier (file location http://...,
file://c:/documents/... or assigned UID).

Response Codes

XML

301Document Not Found
500Invalid Collection Name
503Specified collection is not a CUSTOM collection.

JSON

501Invalid 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 TagAttributeValue
searchbloxlicenseid/apikeyLicense value from license.xml file.
apikeyAPI key from http://localhost:8080/searchblox/admin/main.jsp?menu1=adm.
documentcolnameName of the custom collection.

Response

XML

400Collection Cleared
500Invalid Collection Name
503Specified collection is not a CUSTOM collection.

JSON

400Collection Cleared
501Invalid Collection Name

Add collection

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

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"  language="en"> </document> </searchblox>

REST-JSON API

{ 
 "apikey" : "DAB42B6BDDFDD1F079C12B2FFEDCB92E5", 
 "document" : 
 { 
  "colname" : "custom",
   "coltype":"custom",
   "language" : "en"
 } 
}

Document Description

XML Tag/JSON KeyAttributeValue
searchbloxapikeyAPI key from http://localhost:8080/searchblox/admin/main.jsp?menu1=adm.
documentcolnameName of the custom collection.
languageLanguage of the collection specified in standard two letter code.
https://developer.searchblox.com/v8.6.5/docs/supported-languages#section-language-codes
coltypeType of collection.

Response Codes

XML

900Custom Collection Added
901Failed Adding Collection

JSON

900Custom Collection Added
901Failed Adding Collection

Delete Collection

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

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 TagAttributeValue
searchbloxapikeyAPI key from http://localhost:8080/searchblox/admin/main.jsp?menu1=adm.
documentcolnameName of the custom collection.

Response

XML

800Custom Collection Deleted
500Invalid Collection Name
503Specified collection is not a CUSTOM collection.

JSON

800Collection Deleted
501Invalid Collection Name

Add/Update Document

You 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 here.

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 TagAttributeValue
searchbloxapikeyAPI key from http://localhost:8080/searchblox/admin/main.jsp?menu1=adm.
documentcolnameName of the Http or file collection.
documentlocationValue of file location (http://... or c:\documents...).

Response

XML

1001Custom Added Successfully
1002Document couldn't be reached.

JSON

1001Custom Added Successfully
1002Document couldn't be reached.
501Invalid Collection Name

Delete Document

You 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 following Document Syntax section.

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 TagAttributeValue
searchbloxapikeyAPI key from http://localhost:8080/searchblox/admin/main.jsp?menu1=adm.
documentcolnameName of the HTTP or file collection.
documentuidValue of unique identifier (file location http://..., file://c:/documents/... or assigned UID).

Response

XML

2001Document Deleted Successfully
506Invalid Document UID

JSON

2001Document Deleted Successfully
506Invalid Document UID
501Invalid 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

100Document Indexed
101Error Indexing Document
200Document Deleted
201Document requested for deletion does not exist.
301Document Not Found
400Collection Cleared
401Error Clearing Collection
404URL Not Found
405Method not allowed or incorrect method selected.
415Unsupported Media Type
500Invalid Collection Name
501Invalid Request
502Invalid Document Location
503Specified collection is not a CUSTOM collection.
504Licensed Document Limit Exceeded
506Invalid Document UID
601Invalid License ID
602Custom documents not supported by this edition of SearchBlox.
800Custom Collection Deleted
900Custom Collection Added
1001Document Added Successfully
1002Document Couldn't Be Reached
2001Document Deleted Successfully
2002Specified 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 preceding 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 here. Select raw to view the status code for JSON API.
##XML API POSTMAN settings

JSON API POSTMAN settings

Updated 7 days ago


REST API


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.