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, HTTP 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"

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"

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"

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"

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"

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"

Add Document in HTTP/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"

Delete Document in HTTP/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"

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"

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"

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"

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"

Did this page help you?