Featured Results API

The SearchBlox Featured Results API enables you to add featured ads into SearchBlox using simple HTTP POST and GET actions. The Featured Results API can create, activate, update and delete featured ads. Searchblox Featured Results API provides methods for working with featured ads using REST requests with JSON payloads.

Creating a New Featured Result

Index URL

http://localhost:8080/searchblox/rest/v2/api/ads/create

Method

POST

Media Type

application/json

Headers

content-type : application/json
accept: application/json

Document Syntax

{
 "apikey": "C6D418861BAD66A46A7CC96B70CEADF9",
 "title": "featured ad",
 "url": "http://www.bbc.com",
 "uid": "1",
 "startDate": "12-03-2018",
 "expiryDate": "18-04-2018",
 "expiryCount": "-1",
 "priority": "1",
 "active": "true",
 "keywordType": "keyword",
 "keywords": "test is good",
 "keywordsurl": "",
 "keywordsFieldType": "STRING",
 "type": "TEXT",
 "description": "asd",
 "imageUrl": "",
 "useDates": "false",
 "keywordsphrase": "false",
 "collections": "1,2,3,4,5"
}

Document Description

FieldsDescription
apikeyAPI key accessible in the SearchBlox Admin Console. It is also present in the config.xml file.
titleTitle of the ad.
urlURL for the ad.
uidUnique id for the ad.
Note: Each ad should be given unique ID
startDateStart date to display the ad.
expiryDateExpiry date for the ad.
expiryCountExpiry count, i.e., number of times the ad has to be displayed.
priorityPriority in which the ad has to be displayed. The value has to be given in numbers, example: 1, 2, 3 as per the priority.
activeThis is to activate the ad while creating.
When value is true the ad will be activated while creating.
When value is false the ad will be deactivated while creating.
keywordTypeFor Keyword Match the value is keyword
For Phrase Match the value is phrase
For Exact Match the value is exact
keywordsFieldTypeWhether it is words or string or keywords URL.
The value can be STRING for keywords and URL for keywords URL.
keywordsThe list of keywords for the ads.
keywordsurlThe keywords URL for the ads.
typeThe type of ad, whether TEXT or GRAPHIC.
descriptionDescription of the ad.
imageUrlIf the ad is a graphic, then the image URL has to be given in this field.
useDatesWhether to use start and end dates for the ads.
keywordsphraseIf keywords are to be taken as phrase then the value has to be entered as true.
collectionsThe list of collections separated by comma for which the ads are to be displayed.

Update an Existing Featured Result

Index URL

http://localhost:8080/searchblox/rest/v2/api/ads/update

Method

POST

Media Type

application/json

Headers

content-type : application/json
accept: application/json

Document Syntax

{
 "apikey": "C6D418861BAD66A46A7CC96B70CEADF9",
 "title": "featured ad",
 "url": "http://www.bbc.com",
 "uid": "1",
 "startDate": "12-03-2018",
 "expiryDate": "18-04-2018",
 "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"
}

Document Description

FieldsDescription
apikeyAPI key accessible in the SearchBlox Admin Console. It is also present in the config.xml file.
titleTitle of the ad.
urlURL for the ad.
uidUnique ID for the ad.
Note: Each ad should be given unique ID
startDateStart date to display the ad.
expiryDateExpiry date for the ad.
expiryCountExpiry count, i.e., no of times the ad has to be displayed.
priorityPriority in which the ad has to be displayed.
(Values are currently being given as alphabets, but will be changed to numbers in next build for ease of use).
activeThis is to activate the ad while creating.
When value is true the ad will be activated while creating.
When value is false the ad will be deactivated while creating.
keywordTypeFor Keyword Match the value is keyword
For Phrase Match the value is phrase
For Exact Match the value is exact
keywordsFieldTypeWhether it is words or string or keywords URL.
The value can be STRING for keywords and URL for keywords URL.
keywordsThe list of keywords for the ads.
keywordsurlThe keywords URL for the ads.
typeThe type of ad, whether TEXT or GRAPHIC.
descriptionDescription of the ad.
imageUrlIf the ad is a graphic ad then the image URL has to be given in this field.
useDatesWhether to use start and end dates for the ads.
keywordsphraseIf keywords are to be taken as phrase then the value has to be entered as true.
collectionsThe list of collections separated by comma for which the ads are to be displayed.

Delete a Featured Result

Index URL

http://localhost:8080/searchblox/rest/v2/api/ads/delete

Method

POST

Media Type

application/json

Headers

content-type : application/json
accept: application/json

Document Syntax

{
 "apikey": "5615BEF054EB6CE7E3ECCF1DBBEC2524", 
 "uid": "13"
}

Document Description

FieldDescription
apikeyAPI key accessible in the SearchBlox Admin Console. It is also present in the config.xml file.
uidUnique ID for the ad.
Note: Each Ad should be given a unique ID.

Activate a Featured Result

Index URL

http://localhost:8080/searchblox/rest/v2/api/ads/activate

Method

POST

Media Type

application/json

Headers

content-type : application/json
accept: application/json

Document Syntax

{
"apikey": "5615BEF054EB6CE7E3ECCF1DBBEC2524", 
"uid": "13",
"active":"true"
}

Document Description

FieldDescription
apikeyAPI key accessible in the SearchBlox Admin Console. It is also present in the config.xml file.
uidUnique ID for the ad.
Note: Each Ad should be given a unique ID.
activeThis is to activate the ad while creating.
When value is true the ad will be activated while creating.
When value is false the ad will be deactivated while creating.

List UIDs of All Featured Results

This API is to list the UID of featured ads based on the collection.
##Index URL
http://localhost:8080/searchblox/rest/v2/api/ads/list

Method

POST

Media Type

application/json

Headers

content-type : application/json
accept: application/json

Document Syntax

{
"apikey":"C6D418861BAD66A46A7CC96B70CEADF9",
"collection":"1",
"limit":"1"
}

Document Description

FieldsDescription
apikeyAPI key accessible in the SearchBlox Admin Console. It is also present in the config.xml file.
collectionCollection id for which UIDs of available ads are to be fetched.
limitThe number of featured results that can be fetched. This is a mandatory field.

Delete All Featured Results

Kindly note that all ads would be deleted on using this API. Back up of ads would be available at ../webapps/searchblox on using this delete all ads API.
##Index URL
http://localhost:8080/searchblox/rest/v2/api/ads/clear

Method

POST

Media Type

application/json

Headers

content-type : application/json
accept: application/json

Document Syntax

{
"apikey":"AD22EDE4515784C4C9433C72745183BA"
}

Document Description

FieldsDescription
apikeyAPI key accessible in the SearchBlox Admin Console. It is also present in the config.xml file.