API - Introduction

Hint

This section is intended for developers. It describes how to use TasteHit's API. The API is HTTP-based, so it is accessible from your browser, or using using a tool such as curl. All major programming languages have libraries for accessing HTTP-based APIs.

Introduction

There are two ways of using TasteHit:

  1. By using the dashboard (login required) for configuration purposes (widgets, product catalog, etc...) and inserting TasteHit widgets in your pages. To place a widget on a page of your online shop you just need to insert an HTML <div> element. TasteHit takes care of the graphical rendering of the widgets.
  2. By calling TasteHit's HTTP-based API.

The first method is usually the easiest way to use TasteHit, and is indeed the way most shops use TasteHit. However, TasteHit's API might provide more flexibility in some cases.

TasteHit's API lets you do a number of things:

  1. Request recommendations. TasteHit will return a list of recommendations in JSON format, and you will have to take care of the graphical rendering yourself. This is useful for example if you want to use TasteHit's recommendatoins in a mobile app. Or if you want to offer a graphical design which is currently not supported by TasteHit's widgets. This functionality is described in the next section.
  2. Send interaction data to TasteHit. This goes hand-in-hand with the recommendations. In order to receive data-driven recommendations, you need to send interaction data to TasteHit. This is also described in the next section.
  3. To send personally identifiable information to TasteHit. This is useful if you want to send personalized emails to your customers. TasteHit needs to be able to identify the users you are sending emails to.

Security

We will white-list your servers' IP addresses, so that only requests coming from your servers will be accepted and processed by TasteHit.

You will be limited to 10 requests per second. If more than 10 requests per second are sent, TasteHit will return an error with code 429. If this limit is too low, please contact us and we will increase it.

JSON Web Tokens (JWTs)

Some routes are protected via JSON web tokens. To call these routes, you will first need to request a JWT from TasteHit.

1
GET http://www.tastehit.com/api/{customer}/v1/jwt?password={password}

where {customer} has to be replaced with your customer ID and {password} has to be replaced with your API password. You can check your customer ID and configure your password in the dashboard. A string of characters (a JWT) will be returned to you, which will need to be used when calling certain routes. If you are using curl, this can be done like this:

1
curl -H "Authorization: Bearer {your JWT}"

where {your JWT} will have to be replaced with the JWT returned to you by TasteHit.

Currently, TasteHit's JWTs expire after one hour.

Comments