Using cURL for API

The SearchBlox REST-API enables you to index and search custom content using simple HTTP POST and GET actions. The REST-API can add and delete documents from Custom, WEB and File Collections only.

The SearchBlox HTTP-API enables you to index and search web content using simple HTTP POST and GET actions. The HTTP-API can add and delete HTTP collections, update paths and settings, schedule indexing and stop indexing the collection. SearchBlox HTTP-API provides methods for working with HTTP collections of REST requests with JSON payloads.

REST-API

Indexing Custom Collection

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache" -d '{
"apikey" : "E9047FDBA2F55DCC32A93475DA1FAB6D",
"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" : "07 May 2000 06:19:42 GMT",
"contenttype" : "HTML",
"meta":{
"location":"San Francisco",
"temp":"23",
"weather":"sunny"
}
}
}' "https://localhost:8443/rest/v1/api/add"


FieldDescriptionTypeExample Value
apikeyThe API key used for authenticationStringE9047FDBA2F55DCC32A93475DA1FAB6D
documentThe main object containing document detailsObject{ ... }
colnameThe name of the collectionStringcustom
urlThe document URLStringhttp://www.searchblox.com
uidUnique identifier for the documentStringhttp://www.searchblox.com
locationThe document's locationStringhttp://www.searchblox.com
alphaCustom string fieldStringstring
sizeThe document size in bytesString44244
titleTitle of the documentStringText
keywordsKeywords associated with the documentStringkeywords
descriptionShort description of the documentStringSearchBlox Content Search Software
contentThe main content of the documentStringcontent
lastmodifiedLast modified date and time in GMT formatString07 May 2000 06:19:42 GMT
contenttypeType of content (e.g., HTML, JSON, PDF)StringHTML
metaMetadata related to the documentObject{ "location": "San Francisco", "temp": "23", "weather": "sunny" }

Delete Files from Custom Collection

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache" -d '{ "apikey" : "E9047FDBA2F55DCC32A93475DA1FAB6D",
"document" : {
"colname" : "custom",
"location" : "http://www.searchblox.com"
}
}
' "https://localhost:8443/rest/v1/api/docdelete"

FieldDescriptionTypeExample Value
apikeyThe API key used for authenticationStringE9047FDBA2F55DCC32A93475DA1FAB6D
documentThe object containing document deletion detailsObject{ ... }
colnameThe name of the collection where the document is storedStringcustom
locationThe URL/location of the document to be deletedStringhttp://www.searchblox.com

Document Status

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
"apikey" : "E9047FDBA2F55DCC32A93475DA1FAB6D",
"document" :
{
"colname" : "custom",
"uid" : "http://www.searchblox.com"
}
}
' "https://localhost:8443/rest/v1/api/status"

FieldDescriptionTypeExample Value
apikeyThe API key used for authenticationStringE9047FDBA2F55DCC32A93475DA1FAB6D
documentThe object containing document status detailsObject{ ... }
colnameThe name of the collection where the document is storedStringcustom
uidUnique identifier of the document to check statusStringhttp://www.searchblox.com

Clear Collection

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
"apikey" : "267BACD0F31A74F557426DD2A552ECDD",
"document":
{
"colname": "custom"
}
}' "https://localhost:8443/rest/v1/api/clear"

FieldDescriptionTypeExample Value
apikeyThe API key used for authenticationString267BACD0F31A74F557426DD2A552ECDD
documentThe object containing collection clear detailsObject{ ... }
colnameThe name of the collection to be clearedStringcustom

Add Custom Collection

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache" -d '{
"apikey" : "E9047FDBA2F55DCC32A93475DA1FAB6D",
"public":true,
"encrypt":false,
"document" :
{
"colname":"Custom_Collection",
"coltype":"custom",
"language":"en"
}
}' "https://localhost:8443/rest/v1/api/coladd"


FieldDescriptionTypeExample Value
apikeyThe API key used for authenticationStringE9047FDBA2F55DCC32A93475DA1FAB6D
publicDetermines if the collection is publicBooleantrue
encryptDetermines if the collection is encryptedBooleanfalse
documentThe object containing collection detailsObject{ ... }
colnameThe name of the collectionStringCustom_Collection
coltypeThe type of the collectionStringcustom
languageThe language used for the collectionStringen

Delete Custom Collection

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
"apikey" : "E9047FDBA2F55DCC32A93475DA1FAB6D",
"document" :
{
"colname" : "Custom_Collection"
}
}' "https://localhost:8443/rest/v1/api/coldelete"

FieldDescriptionTypeExample Value
apikeyThe API key used for authenticationStringE9047FDBA2F55DCC32A93475DA1FAB6D
documentThe object containing collection detailsObject{ ... }
colnameThe name of the collection to be deletedStringCustom_Collection

Add Document in WEB/File Collection

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache" -d '{ "apikey" : "267BACD0F31A74F557426DD2A552ECDD",
"document" : {
    "colname" : "test",
    "location" : "http://www.searchblox.com" } }
' "https://localhost:8443/rest/v1/api/docadd"

FieldDescriptionTypeExample Value
apikeyThe API key used for authenticationString267BACD0F31A74F557426DD2A552ECDD
documentThe object containing document detailsObject{ ... }
colnameThe name of the collectionStringtest
locationThe document URL/locationStringhttp://www.searchblox.com

Delete Document in WEB/File Collection

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{ "apikey" : "267BACD0F31A74F557426DD2A552ECDD",
"document" : {
    "colname" : "test",
    "location" : "http://www.searchblox.com" } }
' "https://localhost:8443/rest/v1/api/docdelete"

FieldDescriptionTypeExample Value
apikeyThe API key used for authenticationString267BACD0F31A74F557426DD2A552ECDD
documentThe object containing document detailsObject{ ... }
colnameThe name of the collectionStringtest
locationThe document URL/location to be deletedStringhttp://www.searchblox.com

SearchBlox HTTP API

Add Collection

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache" -d '{
        "apikey" : "267BACD0F31A74F557426DD2A552ECDD",
        "publiccol":true,
        "encrypted":false,
        "colname":"http",
        "coltype":"http",
        "language":"en"
}' "https://localhost:8443/rest/collection/add"

FieldDescriptionTypeExample Value
apikeyThe API key used for authenticationString267BACD0F31A74F557426DD2A552ECDD
publiccolDetermines if the collection is publicBooleantrue
encryptedDetermines if the collection is encryptedBooleanfalse
colnameThe name of the collectionStringhttp
coltypeThe type of the collectionStringhttp
languageThe language used in the collectionStringen

Delete Collection

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
"apikey" : "267BACD0F31A74F557426DD2A552ECDD",
"colname":"http"
}' "https://localhost:8443/rest/collection/delete"

FieldDescriptionTypeExample Value
apikeyThe API key used for authenticationString267BACD0F31A74F557426DD2A552ECDD
colnameThe name of the collection to be deletedStringhttp

Update the Collection Path

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
"apikey" : "267BACD0F31A74F557426DD2A552ECDD",
"colname":"http",
"rooturls": [
"http://edition.cnn.com"
],
"allowpaths": [
".*"
],
"allowformat": [
"HTML",
"text"
]
}' "https://localhost:8443/rest/collection/updatePath"

FieldDescriptionTypeExample Value
apikeyThe API key used for authenticationString267BACD0F31A74F557426DD2A552ECDD
colnameThe name of the collection to be updatedStringhttp
rooturlsList of root URLs to crawlArray["http://edition.cnn.com"]
allowpathsList of allowed paths (Regex patterns)Array[".*"]
allowformatAllowed content formatsArray["HTML", "text"]

Update the Collection Settings

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Accept: application/json" -H "Content-Type: application/json" -H "Cache-Control: no-cache -d '{
"apikey": "267BACD0F31A74F557426DD2A552ECDD",
"colname": "http",
"keyword-in-context": "false",
"remove-duplicates": "false",
"boost": "100",
"stemming": "false",
"spelling": "true",
"logging": "true",
"html-settings":
{
"description": "meta",
"max-doc-age": "-1",
"max-doc-size": "-1",
"spider-max-depth": "10",
"spider-max-delay": "0",
"user-agent": "SearchBlox",
"referer": "",
"ignore-robots": "false",
"follow-sitemap": "false",
"follow-redirect": "true"
},
"basic-auth-settings":
{
"username": "",
"password": ""
},
"form-auth-settings":
{
"form-url": "",
"form-action": "post",
"form":
[{
"name": "",
"value": ""
}]
},
"proxy-settings":
{
"server-url": "",
"username": "",
"password": ""
}
}
 
' "https://localhost:8443/rest/collection/updateSettings"

Update the Scheduler Settings

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
"apikey" : "267BACD0F31A74F557426DD2A552ECDD",
"colname":"http",
"index":{
"frequency":"ONCE",
"timestamp":"21-10-2021 19:05:00"
},
"clear":{
"frequency":"MINUTELY",
"timestamp":"21-10-2021 18:05:00"
}
}
' "https://localhost:8443/rest/collection/updateScheduler"

Index or Stop Indexing the Collection

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache" -d '{
"apikey" : "267BACD0F31A74F557426DD2A552ECDD",
"colname":"http",
"action":"index"
}' "https://localhost:8443/rest/collection/actions"
curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
"apikey" : "267BACD0F31A74F557426DD2A552ECDD",
"colname":"http",
"action":"stop"
}' "https://localhost:8443/rest/collection/actions"

SearchBlox Featured Result API

Creating a Featured Result

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
 "apikey": "C6D418861BAD66A46A7CC96B70CEADF9",
 "title": "featured ad",
 "url": "http://www.bbc.com",
 "uid": "1",
 "startDate": "12-03-2021",
 "expiryDate": "18-12-2021",
 "expiryCount": "-1",
 "priority": "1",
 "active": "true",
 "keywordType": "exact",
 "keywords": "test is good",
 "keywordsurl": "",
 "keywordsFieldType": "STRING",
 "type": "TEXT",
 "description": "asd",
 "imageUrl": "",
 "useDates": "false",
 "keywordsphrase": "false",
 "collections": "1,2,3,4,5"
}' "https://localhost:8443/rest/v2/api/ads/create"

Update an Existing Featured Result

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
 "apikey": "C6D418861BAD66A46A7CC96B70CEADF9",
 "title": "featured ad",
 "url": "http://www.bbc.com",
 "uid": "1",
 "startDate": "12-03-2021",
 "expiryDate": "18-11-2021",
 "expiryCount": "-1",
 "priority": "1",
 "active": "true",
 "keywordType": "exact",
 "keywords": "test is good",
 "keywordsurl": "",
 "keywordsFieldType": "STRING",
 "type": "TEXT",
 "description": "asd",
 "imageUrl": "",
 "useDates": "false",
 "keywordsphrase": "false",
 "collections": "1,2,3,4,5"
}' "https://localhost:8443/rest/v2/api/ads/update"

Delete a Featured Result

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
 "apikey": "5615BEF054EB6CE7E3ECCF1DBBEC2524", 
 "uid": "13"
}' "https://localhost:8443/rest/v2/api/ads/delete"

Activate a Featured Result

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
"apikey": "5615BEF054EB6CE7E3ECCF1DBBEC2524", 
"uid": "13",
"active":"true"
}' "https://localhost:8443/rest/v2/api/ads/activate"

List UIDs of All Featured Results

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
"apikey":"C6D418861BAD66A46A7CC96B70CEADF9",
"collection":"1"
}' "https://localhost:8443/rest/v2/api/ads/list"

Delete All Featured Results

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
"apikey":"AD22EDE4515784C4C9433C72745183BA"
}' "https://localhost:8443/rest/v2/api/ads/clear"

Listing Collections

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
"apikey":"AD22EDE4515784C4C9433C72745183BA"
}' "https://localhost:8443/rest/collection/list"

Collection API

Get Collection ID

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
"apikey":"C6D418861BAD66A46A7CC96B70CEADF9",
"name": "site"
}' "https://localhost:8443/rest/collection/list"

Search Query API

Related Queries API

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
"apikey":"ADB9E38C363A5AB7B17E34956D21543B",
"field":"content",
"col":"1,2,3",
"type":"phrase",
"operator":"or",
"limit":20,
"terms":5,
"query":"test"
}' "https://localhost:8443/rest/v2/api/related/query"

Top Queries API

curl -X POST -H "SB-PKEY: LmfxTTDSeYxHTntJMHuhwRrGVICMaVN/wl/zPuQ3LtQDNRMnng5GpKIkgt0q1rCC/h6wDA==" -H "Content-Type: application/json" -H "Accept: application/json" -H "Cache-Control: no-cache"  -d '{
"apikey":"ADB9E38C363A5AB7B17E34956D21543B",
"col":1,
"limit":12
}' "https://localhost:8443/rest/v2/api/query/top"