Display the list from the REST API
The response from the REST API is a JSON object that contains the list of recommendations, formatted as described in this section. Use the examples and descriptions in this section when you construct the code that will display the results.
Example
{
"io": {
"clientid": "00000003",
"offer_id": 25,
"offer_type": "A",
"offer_name": "Page_Content",
"target_id": "DESK LAMPS",
"offer_version": "2016061311",
"attributes": [
{"name": "Page Rating", "format": "string", "prefix": ""},
{"name": "Avg Read Time ", "format": "string", "prefix": ""},
{"name": "Image Representation", "format": "string", "prefix": ""}],
"rec_count": 3,
"recs": [
{"id": "PRODUCT: MAHOGANY DESK CHAIR (CLEOF-0101)", "score": 7.15,
"category": "CLEARANCE", "rank": 1, "page URL":
"http://retail-demo.coremetrics.com/LiveDemo/product?catalog_id=1
&category_id=20&prod_id=103", "page name":
"PRODUCT: MAHOGANY DESK CHAIR (CLEOF-0101)", "Page Rating": "6",
"Avg Read Time ": "6", "Image Representation":
"http://iocdn.coremetrics.com/prodqa/images/img6.jpg"},
{"id": "PRODUCT: BANKER DESK LAMP (FUDEL-0101)", "score": 7.15,
"category": "DESK LAMPS", "rank": 2, "page URL":
"http://retail-demo.coremetrics.com/LiveDemo/product?catalog_id=1
&category_id=6&prod_id=15", "page name": "PRODUCT: BANKER DESK LAMP (FUDEL-0101)",
"Page Rating": "2", "Avg Read Time ": "1", "Image Representation":
"http://iocdn.coremetrics.com/prodqa/images/img2.jpg"},
{"id": "SEARCH SUCCESSFUL", "score": 7.04, "category": "SEARCH", "rank": 3,
"page URL": "http://retail-demo.coremetrics.com/LiveDemo/search?searchTerm=
Desk Chair", "page name": "SEARCH SUCCESSFUL", "Page Rating": "5",
"Avg Read Time ": "1", "Image Representation":
"http://iocdn.coremetrics.com/prodqa/images/img5.jpg"}]
},
"message": {"code": 200, "text": "OK", "version": "V9"}
}
Response parameters
The following table defines the parameters in the response from the REST API.
| Field | Type | Definition |
|---|---|---|
| io | Node | Contains all the recommendation data. |
| clientid | Node | Your client ID. |
| offer_type | Node | The type of offer, indicated by one of the following
codes:
|
| offer_name | Node | The name of the offer. |
| offer_version | Node | The offer version, as indicated by a timestamp
with the following format: YYYYMMDDHHMISS |
| target_id | Node | The ID of the target. |
| attributes | List | The list of available attributes. |
| attributes.name | Node | Name of attribute. |
| attributes.format | Node | Format of attribute. |
| attributes.prefix | Node | If the attribute has a prefix that is configured, its value. For example, for a price attribute, a currency symbol ($). |
| rec_count | Node | The number of recommendations that is included in the list. |
| recs | List | List of recommendations. |
| recs.id | Node | The ID of the recommended item. |
| recs.category | Node | The category of the recommended item. |
| recs.score | Node | The affinity score that is calculated for the item in the context of the target. |
| recs.rank | Node | The rank of the recommended item as a 1-based number. |
| recs.attribute | Node | An unbounded list of attribute name-value pairs that are based on number of available attributes. |
Response codes
The REST API also returns one of the following HTTP response codes.
| Response code | Message | Description |
|---|---|---|
| 200 | OK | The request was successful. |
| 404 | Error | The URL was incorrect or not found. |
| 500 | Error | There was an error on the server and the request did not succeed. |