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
## Document Description
Fields | Description |
apikey | API key accessible in the SearchBlox Admin Console. It is also present in the config.xml file. |
title | Title of the ad. |
url | URL for the ad. |
uid | Unique id for the ad. Note: Each ad should be given unique ID |
startDate | Start date to display the ad. |
expiryDate | Expiry date for the ad. |
expiryCount | Expiry count, i.e., number of times the ad has to be displayed. |
priority | Priority in which the ad has to be displayed. The value has to be given in numbers, example: 1, 2, 3 as per the priority. |
active | This 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. |
keywordType | For Keyword Match the value is **keyword** For Phrase Match the value is **phrase** For Exact Match the value is **exact** |
keywordsFieldType | Whether it is words or string or keywords URL. The value can be **STRING **for keywords and **URL** for keywords URL. |
keywords | The list of keywords for the ads. |
keywordsurl | The keywords URL for the ads. |
type | The type of ad, whether **TEXT** or **GRAPHIC**. |
description | Description of the ad. |
imageUrl | If the ad is a graphic, then the image URL has to be given in this field. |
useDates | Whether to use start and end dates for the ads. |
keywordsphrase | If keywords are to be taken as phrase then the value has to be entered as **true**. |
collections | The 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
## Document Description
Fields | Description |
apikey | API key accessible in the SearchBlox Admin Console. It is also present in the config.xml file. |
title | Title of the ad. |
url | URL for the ad. |
uid | Unique ID for the ad. Note: Each ad should be given unique ID |
startDate | Start date to display the ad. |
expiryDate | Expiry date for the ad. |
expiryCount | Expiry count, i.e., no of times the ad has to be displayed. |
priority | Priority 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). |
active | This 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. |
keywordType | For Keyword Match the value is **keyword** For Phrase Match the value is **phrase** For Exact Match the value is **exact** |
keywordsFieldType | Whether it is words or string or keywords URL. The value can be **STRING **for keywords and **URL** for keywords URL. |
keywords | The list of keywords for the ads. |
keywordsurl | The keywords URL for the ads. |
type | The type of ad, whether **TEXT** or **GRAPHIC**. |
description | Description of the ad. |
imageUrl | If the ad is a graphic ad then the image URL has to be given in this field. |
useDates | Whether to use start and end dates for the ads. |
keywordsphrase | If keywords are to be taken as phrase then the value has to be entered as **true**. |
collections | The 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
## Document Description
Field | Description |
apikey | API key accessible in the SearchBlox Admin Console. It is also present in the config.xml file. |
uid | Unique 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
## Document Description
Field | Description |
apikey | API key accessible in the SearchBlox Admin Console. It is also present in the config.xml file. |
uid | Unique ID for the ad. Note: Each Ad should be given a unique ID. |
active | This 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
## Document Description
Fields | Description |
apikey | API key accessible in the SearchBlox Admin Console. It is also present in the config.xml file. |
collection | Collection id for which UIDs of available ads are to be fetched. |
limit | The 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
## Document Description
Fields | Description |
apikey | API key accessible in the SearchBlox Admin Console. It is also present in the config.xml file. |