# Tutorial

# User registration

To create a Customer account, several fields are mandatory:

Name Details
firstname String - User firstname to create the account
lastname String - User lastname to create the account
email String - Email to identify the account (unique value)
password String - Password to login User (automaticaly hashed)
id_country Integer - Country used for invoicing

# Retrieve countries

First of all, we have to retrieve the Country ID using the following resource:
GET https://api.kinow.com/api/countries (opens new window)

Once we have retrieved countries list, we can pick the correct ID following user address invoicing.

# Create user account

Now we can create a new Customer account by using following resource:
POST https://api.kinow.com/api/customers (opens new window)

# User login

You can check Customer credentials using the following resource:
POST https://api.kinow.com/api/customers/validate-credentials (opens new window)

Theses parameters are mandatory:

Name Details
email String - User email to validate
password String - User password to check

API will return you a CredentialsValidation object, which contains following properties:

Name Details
valid Boolean - Status of credentials validation
customer_id Integer - Customer ID linked to email address

# Retreive products

You can retrieve Product list using following resource:
GET https://api.kinow.com/api/products (opens new window)

Note you can use pagination properties.

API will return you an array of Product objects with various properties, such as:

Name Details
id Integer - Product ID
active Integer - Determines if Product is enabled
name Array[I18Field] - Product names for each languages
date_add String - Date of creation

And many more...

# Cart management

To create a Cart object, several fields are mandatory:

Name Details
id_customer Integer - Customer account to attach to this Cart
id_currency Integer - Curency object to use in Cart
id_lang Integer - Language object to use in Cart

# Retrieve currencies

First of all, we have to retrieve the Currency ID using the following resource:
GET https://api.kinow.com/api/currencies (opens new window)

Once we have retrieved currencies list, we can pick the correct ID following user settings.

# Retrieve languages

Then, we have to retrieve the Language ID using the following resource:
GET https://api.kinow.com/api/languages (opens new window)

Now we can select the appropriate ID following user preferences.

# Create a new cart

Now we can create a new Cart object by using following resource:
POST https://api.kinow.com/api/carts (opens new window)

# Add some products

Finaly we can add some products to our cart using this resource:
POST https://api.kinow.com/api/carts/{cart_id}/products (opens new window)

# Payment process

Our user has filled his cart and would like to order his products. We have to display a list of payment gateways and let him choose the right one.

# Retrieve payment gateways

Use following resource to retrieve a list of PaymentGateway:
GET https://api.kinow.com/api/payment-modules (opens new window)

# Load payment gateway URL

Use this resource to get the payment URL:
GET https://api.kinow.com/api/carts/{cart_id}/payments/{payment_name} (opens new window)

Once user has choose his payment gateway, you can redirect him to the payment URL page (external).

# Video player

# Check user access to product

When a user reach a product page (eg. a movie page), we'd like to display him a button to watch the video content linked to the product.

First of all, we have to check if user as access to this product, this means he has bought the product (TVOD) or subscribed to an offer (SVOD) granting him access to the product.

You can check user access to product using this resource:
GET https://api.kinow.com/api/customers/{customer_id}/products/{product_id}/has-access (opens new window)

# Retrieve videos

Once we know that user has access to the current product, we can display him the list of videos inside this product, in order to let him pick the right one to watch.

Use this resource to retrieve the videos list inside a product:
GET https://api.kinow.com/api/products/{product_id}/videos (opens new window)

# Check user access to video

As TVOD and SVOD accesses can have specific restrictions, we have to check if user also has access to the selected video.

You can check user access to video using this resource:
GET https://api.kinow.com/api/customers/{customer_id}/videos/{video_id}/has-access (opens new window)

# Retrieve video player URL

Use this resource to get the player URL:
GET https://api.kinow.com/api/videos/{video_id}/player (opens new window)

This URL has to be loaded inside an iframe:

<iframe src="http://url-to-player-page.com" frameborder="0"
  allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true">
</iframe>
1
2
3