Reference¶
NtokloApi class¶
-
class
NtokloApi
¶ -
property
$api_base
¶
-
__construct
($key, $secret)¶
-
postEvent
($data)¶ This function will allow to post a decoded json object into the nToklo api @uses array | decode json object Example: $data = array(“version” => “1.2”,
“user” => array(“user_id” => “112”), “product” => array(“id” => “10201”,
“name” => “Gabardine A-line skirt”, “category” => “Womens > Skirts”, “currency” => “GBP”, “unit_sale_price” => 98),“events” => array((object)[“category” => “conversion_funnel”, “action” => “browse” ]) );
@return bool
-
postProduct
($data)¶ This function will allow to post a decode json object into the nToklo api @uses array | decode json object Example: $data = array(“version” => “1.2”,
- “product” => array(“id” => “10201”,
- “name” => “Gabardine A-line skirt”, “category” => “Womens > Skirts”, “currency” => “GBP”, “unit_sale_price” => 98 )
);
@return bool
-
getProduct
($id)¶ This function will allow to post a decode json object into the nToklo api @param int product id. @return bool
-
recommendations
($userId = null, $productId = null, $scope = null, $value = null)¶ This function will fetch the recommendations from nToklo api @param string $userId optional. Uniquely identifies the user for which the recommendations are intended.
The userId can be any value of string type. Examples: dan@gmail.com, 11245901, user_123@param string $productId optional. The product for which to base recommendations from. The productId can be any string value. Example: 10201,prod8513 @param string $scope optional. A product attribute for which to scope recommendations.
For example scope=category will consider the product category when returning recommendations. Supports: category, manufacturer, vendor, action.- @param string $value optional. The value for the recommendation scope.
- For example scope=category&value=shoes will consider the shoe category when returning recommendations. The value parameter can be any string value. Example: shoes, category12, nike, shoes.com
@return Json
-
chart
($timestamp = null, $scope = null, $value = null, $action = null, $tw = null, $maxItems = null)¶ This function will fetch the charts from nToklo api @param string $timestamp Optional. The date for which to retrieve a chart. The date should be an epoch timestamp in milliseconds, truncated to midnight Example: 1364169600000 @param string $scope Optional. A product attribute for which to scope recommendations.
For example scope=category will consider the product category when returning recommendations. Supports: category, manufacturer, vendor, action.- @param string $value Optional. The value for the recommendation scope.
- For example scope=category&value=shoes will consider the shoe category when returning recommendations. The value parameter can be any string value. Example: shoes, category12, nike, shoes.com
@param string $action Optional Filters the requested chart by conversion_funnel actions. If it’s not specified then the chart returned is all actions, equivalent to action=all. @param string $tw Optional. The time window for which the charts are requested. If not specified then the chart returns daily chart, equivalent to tw=DAILY. Supports: DAILY, WEEKLY. @param srting $maxItems Optional. The max number of items in the charts. Default is 10. Valid range is 1-100.
@return Json object
-
addBlacklist
($productId = null)¶ This function will post an product id to nToklo api to blacklist @param string $productId The unique identifier for the product which will added/removed from the blacklist.
The productId can be any string value. In order to add/remove products in batches the productId can be specified multiple times.@return bool
-
removeBlacklist
($productId = null)¶ This function will post an product id to nToklo api remove prodct from blacklist @param string $productId The unique identifier for the product which will added/removed from the blacklist.
The productId can be any string value. In order to add/remove products in batches the productId can be specified multiple times.@return bool
-
fetchBlacklist
()¶ This function will fetch all the blacklisted products @return json object
-
property
NtokloApiBase¶
-
class
NtokloApiBase
¶ -
property
$key
¶
-
property
$secret
¶
-
property
$endpoint
¶
-
__construct
($key, $secret)¶
-
api_request
($method, $uri, $data = null)¶ This class will take care of authentication and exceptions of the API, retuning the required codes to the functions that use it.
@param string $method http method POST GET DELETE @param string $uri @param array $data post the json object to the nToklo api
@return int status code
-
getResponse
()¶
-
property
Curl¶
-
class
Curl
¶ -
property
$curl
¶
-
property
$error
¶
-
property
$error_code
¶
-
property
$error_message
¶
-
property
$curl_error
¶
-
property
$curl_error_code
¶
-
property
$curl_error_message
¶
-
property
$http_error
¶
-
property
$http_status_code
¶
-
property
$http_error_message
¶
-
property
$request_headers
¶
-
property
$response_headers
¶
-
property
$response
¶
-
__construct
()¶
-
__destruct
()¶
-
property