Skip to content

Getting started

Here, you will find main graphQL queries to implement simple VOD application using the Kinow API.

How to start

To use graphql, you'll probably need to find a graphQL client for your favorite language.

We recommended you to use Apollo Client which is available for several platforms.

Get catalog

To create a VOD application, you probably need to get the created categories with their associated products.

You can fetch all of them with a single call to the API, or to split it to make the call faster

Get Categories with their products

query GetCatalog { categories { data { id name { value lang } products { id name { lang value } description { lang value } images { source } attributes { id price name active } } } } }

Get Products

query GetProducts { products { pagination { perPage page } data { id name { lang value } description { lang value } } } }

Get Categories

query GetCategories { categories { data { id name { lang value } } } }

Customer management

Create User

To create a new customer, you'll need the id of its country. You can get them with the country request.

Get countries query

query GetCountries { countries { data { id isoCode name { lang value } } } }

Create customer mutation

mutation CreateAccount ( $email: Email!, $password: String! $firstname: String! $lastname: String! $idCountry: Int! ) { createCustomer (input: { email: $email password: $password firstname: $firstname lastname: $lastname active: true id_country: $idCountry }) { id token firstname lastname } }

Authenticate user

Once the user is created, you can now use the email and password to get a token to authenticate the customer. The given token must be send in the "Authentication" header of the http request.

mutation Authenticate ($email: String!, $password: String!) { authenticate (input: { email: $email password: $password }) }

To see how to pass the token to apollo client, you can check this link.

Cart management

Retrieve customer cart

If the customer already have a cart, you can get it using the query below.

query GetCurrentCart { currentCart { id total products { idProduct idProductAttribute } } }

If no cart is returned, you need to create a new one.

mutation CreateCart ( $idCurrency: Int! $idLang: Int! ) { createCart (input: { idCurrency: $idCurrency idLang: $idLang }) { products { idProduct idProductAttribute } } }

As you can see, this request require the id of the language and the id of the currency of the customer

query GetLanguages { languages { data { id isoCode name } } } query GetCurrencies { currencies { data { sign id } } }

Add product to cart

Once the cart is created, you can start to add products in it :

mutation AddProductToCart ($idProduct: Int!, $idProductAttribute: Int!) { addProductToCart (input: { idProduct: $idProduct idProductAttribute: $idProductAttribute }) { total products { idProduct idProductAttribute } } }

Remove product from cart

mutation RemoveProductFromCart ($idProduct: Int!, $idProductAttribute: Int!) { removeProductFromCart (input: { idProduct: $idProduct idProductAttribute: $idProductAttribute }) { products { idProduct idProductAttribute } } }

Get payment form

Use this query to get the link on the payment form. its type tells you if the link is to use in an iframe or do a redirection.

query ($paymentMethod: String!) { paymentUrl ( paymentMethod: $paymentMethod ) { url type } }

Display video player

The easiest method to display the video player, is to get the URL to put in an iframe

query GetVideoPlayerUrl ($id: Int!) { video (id: $id) { playerUrl } }

If you want to use your own player (for a mobile app for example), you can get the configuration of the player

query GetVideoPlayerConfiguration ($id: Int!) { video (id: $id) { playerConfiguration { url html conf } } }