Guide
Features

Account Management

11min

The PHP-SDK provides means of retrieving information about your Klevu account for use within your app. Via the account services , you can

  • Generate an Account object containing account information and URL endpoints
  • Query features enabled on your account
  • Update the URL used by our indexer to download an XML feed of your catalog [Shopify and Bigcommerce customers only]

Retrieving Klevu Account Information

The AccountLookupService will query the api.ksearchnet.com/user-account/public/platform/account/details endpoint using your JS API Key and REST AUTH Key (available via Store Settings in KMC) and return an Account object. The Account object will provide the following information

Property

Description

jsApiKey

Your unique public key

Example: "klevu-1234567890"

restAuthKey

Your private key, used to authenticate your account

Example: "ABCDE1234567890"

platform

The platform or framework your account is regstered to integrate with

Example: "magento"

active

Whether this account is currently active

Example: true

companyName

The company name entered when signing up to KMC

Example: "Klevu"

email

The primary email address registered for this account

indexingUrl

Domain used to send data for indexing

Example: "indexing.ksearchnet.com"

searchUrl

Domain used to perform searches on indexed data

Example: "eucs27v2.ksearchnet.com"

smartCategoryMerchandisingUrl

Domain used to perform Smart Category Merchandising queries on indexed data

Example: "cn27v2.ksearchnet.com"

analyticsUrl

Domain used to send analytics events

Example: "stats.ksearchnet.com"

jsUrl

Domain used to embed Klevu-hosted JavaScript asssets

Example: "js.klevu.com"

tiersUrl

Domain used to retrieve features information for a Klevu account

Example: "tiers.klevu.com"

Validation and Exception Handling

  • Prior to transmitting data, the provided account credentials are validated as not empty and correctly formatted, throwing a ValidationException on failure
  • Requests returning a 401 status code from Klevu throw an AccountNotFoundException
  • Request exceptions, or responses identifying an invalid request throw aBadRequestException
  • Client or Network exceptions, responses with unexpected status codes, or responses with a missing or invalid body content throw a BadResponseException

Logging

  • Request headers and body are logged prior to send at DEBUG level
  • Response headers, body, and execution time are logged on successful request send at DEBUG level

More information and code samples can be found under Examples / How To > Account Management > Retrieve Klevu Account Details

Querying Enabled Features for Account

The AccountFeaturesService will query the Tiers endpoint and return an AccountFeatures object containing flags for features enabled on your Klevu account. An AccountFeatures object can also be attached to Account objects, and access via the Account::getAccountFeatures() method.

The following feature flags are available:

Flag

Description

smartCategoryMerchandising

Whether the Smart Category Merchandising solution is available on this account

smartRecommendations

Whether the Product Recommendations solution is available on this account

preserveLayout

Whether Preserve Layout should be available as a frontend layout option for integrations using this account

Validation and Exception Handling

  • Prior to transmitting data, the provided account credentials are validated as not empty and correctly formatted, throwing a ValidationException on failure
  • Request exceptions, or responses identifying an invalid request throw aBadRequestException
  • Client or Network exceptions, responses with unexpected status codes, or responses with a missing or invalid body content throw a BadResponseException

Logging

  • Request headers and body are logged prior to send at DEBUG level
  • Response headers, body, and execution time are logged on successful request send at DEBUG level
  • Requested flags missing from, or unknown flags encountered within, the response are logged at WARNING level

More information and code samples can be found under Examples / How To > Account Management > Retrieve Klevu Account Details

Updating the Store Feed Endpoint

Note: only available for accounts registered to integrate with Shopify or Bigcommerce stores

The URL used by Klevu's indexing service to download and process catalog feeds in XML format can be modified using the UpdateStoreFeedUrlService. URL updates will take effect the next time Klevu's Feed Monitor service performs a scheduled sync.

To update the feed URL value for your account, you will need

  • Your JS API and REST AUTH keys
  • The platorm for which your account was registered (eg "shopify")
  • The base URL associated with your Klevu account
  • The full URL from which XML feeds can be downloaded

Validation and Exception Handling

  • Prior to transmitting data, the provided account credentials are validated as not empty and correctly formatted, throwing a ValidationException on failure
  • Request exceptions, or responses identifying an invalid request throw aBadRequestException
  • Client or Network exceptions, responses with unexpected status codes, or responses with a missing or invalid body content throw a BadResponseException

Logging

  • Request headers and body are logged prior to send at DEBUG level
  • Response headers, body, and execution time are logged on successful request send at DEBUG level
  • Requested flags missing from, or unknown flags encountered within, the response are logged at WARNING level

More information and code samples can be found under Examples / How To > Account Management > Update Store Feed Endpoint

Updated 25 Sep 2024
Doc contributor
Doc contributor
Did this page help you?