NAV Navigation
Shell HTTP JavaScript Java

Kezia Connect API v1.3.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Introduction

The REST API allows connection to JDC Kezia II software using JSON format.

Requests/Responses

The default response format is JSON. Requests with a message-body use plain JSON to set or update resource attributes. Successful requests will return a 200 OK HTTP status.

Base URLs:

Email: Tangkoko Web: Tangkoko

Authentication

Customers

Create or update a customer in Kezia

Code samples

# You can also use wget
curl -X POST https://kezia-api-scribe.s3.tangkoko.net/kezia-connect-api/v1/customers/ \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

POST https://kezia-api-scribe.s3.tangkoko.net/kezia-connect-api/v1/customers/ HTTP/1.1
Host: kezia-api-scribe.s3.tangkoko.net
Content-Type: application/json
Accept: application/json

var headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'

};

$.ajax({
  url: 'https://kezia-api-scribe.s3.tangkoko.net/kezia-connect-api/v1/customers/',
  method: 'post',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})

URL obj = new URL("https://kezia-api-scribe.s3.tangkoko.net/kezia-connect-api/v1/customers/");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /customers/

Body parameter

{
  "code": "1456",
  "address": {
    "name": "Pierre Dupond",
    "address1": "CITE DES BOSQUETS",
    "address2": "10 RUE DE LA LIBERTE",
    "postcode": "99123",
    "city": "VILLENOUVELLE",
    "country": "France"
  },
  "phone": "0153535353",
  "cell_phone": "0612121212",
  "email": "pierre.dupont@example.com",
  "username": "p.dupont",
  "password": "0123456789AB",
  "category_id": 0,
  "price_list_id": 0,
  "created_at": "20170131"
}

Parameters

Name In Type Required Description
body body Customer true Customer to create or update

Example responses

200 Response

{
  "code": "1456",
  "address": {
    "name": "Pierre Dupond",
    "address1": "CITE DES BOSQUETS",
    "address2": "10 RUE DE LA LIBERTE",
    "postcode": "99123",
    "city": "VILLENOUVELLE",
    "country": "France"
  },
  "phone": "0153535353",
  "cell_phone": "0612121212",
  "email": "pierre.dupont@example.com",
  "username": "p.dupont",
  "password": "0123456789AB",
  "category_id": 0,
  "price_list_id": 0,
  "created_at": "20170131"
}

Responses

Status Meaning Description Schema
200 OK Customer information Customer
401 Unauthorized Access token is missing or invalid Error
default Default Unexpected error Error

Orders

Create an order in Kezia

Code samples

# You can also use wget
curl -X POST https://kezia-api-scribe.s3.tangkoko.net/kezia-connect-api/v1/orders/ \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

POST https://kezia-api-scribe.s3.tangkoko.net/kezia-connect-api/v1/orders/ HTTP/1.1
Host: kezia-api-scribe.s3.tangkoko.net
Content-Type: application/json
Accept: application/json

var headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'

};

$.ajax({
  url: 'https://kezia-api-scribe.s3.tangkoko.net/kezia-connect-api/v1/orders/',
  method: 'post',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})

URL obj = new URL("https://kezia-api-scribe.s3.tangkoko.net/kezia-connect-api/v1/orders/");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /orders/

Body parameter

{
  "id": "2534",
  "customer_code": "1456",
  "shipping_address": {
    "name": "Pierre Dupond",
    "address1": "CITE DES BOSQUETS",
    "address2": "10 RUE DE LA LIBERTE",
    "postcode": "99123",
    "city": "VILLENOUVELLE",
    "country": "France"
  },
  "order_date": "20181231",
  "shipping_fee": 2.1,
  "total_paid": 89.16,
  "payment_method": "0",
  "order_items": [
    {
      "kezia_id": 5360,
      "product_description": "T-shirt Beatles",
      "qty": 2,
      "price": 17.04,
      "regular_price": 18.93,
      "tax_rate": 20,
      "comment": "IDART=2630. Taille XS."
    }
  ]
}

Parameters

Name In Type Required Description
body body Order true Order to create

Example responses

200 Response

{
  "id": "2534",
  "customer_code": "1456",
  "shipping_address": {
    "name": "Pierre Dupond",
    "address1": "CITE DES BOSQUETS",
    "address2": "10 RUE DE LA LIBERTE",
    "postcode": "99123",
    "city": "VILLENOUVELLE",
    "country": "France"
  },
  "order_date": "20181231",
  "shipping_fee": 2.1,
  "total_paid": 89.16,
  "payment_method": "0",
  "order_items": [
    {
      "kezia_id": 5360,
      "product_description": "T-shirt Beatles",
      "qty": 2,
      "price": 17.04,
      "regular_price": 18.93,
      "tax_rate": 20,
      "comment": "IDART=2630. Taille XS."
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK Order information Order
401 Unauthorized Access token is missing or invalid Error
default Default Unexpected error Error

Products

List products from Kezia

Code samples

# You can also use wget
curl -X GET https://kezia-api-scribe.s3.tangkoko.net/kezia-connect-api/v1/products/ \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer {access-token}'

GET https://kezia-api-scribe.s3.tangkoko.net/kezia-connect-api/v1/products/ HTTP/1.1
Host: kezia-api-scribe.s3.tangkoko.net
Accept: application/json

var headers = {
  'Accept':'application/json',
  'Authorization':'Bearer {access-token}'

};

$.ajax({
  url: 'https://kezia-api-scribe.s3.tangkoko.net/kezia-connect-api/v1/products/',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})

URL obj = new URL("https://kezia-api-scribe.s3.tangkoko.net/kezia-connect-api/v1/products/");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /products/

Only products flagged 'Export to web' in Kezia are listed

Parameters

Name In Type Required Description
page_limit query integer(int32) false How many items to return at one time in a page. Default value is 100.
page query integer(int32) false Page number to retrieve. Page number is 1-based. Default value is 1.

Example responses

200 Response

[
  {
    "kezia_id": 5360,
    "qty": 20,
    "enabled": true,
    "salable": true
  }
]

Responses

Status Meaning Description Schema
200 OK A paged array of products Products
401 Unauthorized Access token is missing or invalid Error
default Default Unexpected error Error

Response Headers

Status Header Type Format Description
200 X-KC-Total integer int32 Total number of products.
200 X-KC-TotalPages integer int32 Total number of pages.

Schemas

Address

{
  "name": "Pierre Dupond",
  "address1": "CITE DES BOSQUETS",
  "address2": "10 RUE DE LA LIBERTE",
  "postcode": "99123",
  "city": "VILLENOUVELLE",
  "country": "France"
}

Properties

Name Type Required Restrictions Description
name string true none Fisrt name and last name
address1 string true none Fisrt line of addresse
address2 string false none Second line of addresse
postcode string true none Postcode
city string true none City
country string true none Country code (an ISO 3166-1 alpha-2 country code). See https://fr.wikipedia.org/wiki/ISO_3166-1.

Customer

{
  "code": "1456",
  "address": {
    "name": "Pierre Dupond",
    "address1": "CITE DES BOSQUETS",
    "address2": "10 RUE DE LA LIBERTE",
    "postcode": "99123",
    "city": "VILLENOUVELLE",
    "country": "France"
  },
  "phone": "0153535353",
  "cell_phone": "0612121212",
  "email": "pierre.dupont@example.com",
  "username": "p.dupont",
  "password": "0123456789AB",
  "category_id": 0,
  "price_list_id": 0,
  "created_at": "20170131"
}

Properties

Name Type Required Restrictions Description
code string true none Customer id or code in website
address Address false none none
phone string false none Home or desk phone number
cell_phone string false none Cell phone number
email string false none Email address
username string false none Username of customer account in website
password string false none Password of customer account in website
category_id integer false none Kezia customer category id
price_list_id integer false none Kezia customer price list id
created_at string(full-date) false none Date of user's creation

Order

{
  "id": "2534",
  "customer_code": "1456",
  "shipping_address": {
    "name": "Pierre Dupond",
    "address1": "CITE DES BOSQUETS",
    "address2": "10 RUE DE LA LIBERTE",
    "postcode": "99123",
    "city": "VILLENOUVELLE",
    "country": "France"
  },
  "order_date": "20181231",
  "shipping_fee": 2.1,
  "total_paid": 89.16,
  "payment_method": "0",
  "order_items": [
    {
      "kezia_id": 5360,
      "product_description": "T-shirt Beatles",
      "qty": 2,
      "price": 17.04,
      "regular_price": 18.93,
      "tax_rate": 20,
      "comment": "IDART=2630. Taille XS."
    }
  ]
}

Properties

Name Type Required Restrictions Description
id integer(int64) true none Order id in the website
customer_code string true none Customer id or code in the website
shipping_address Address false none none
order_date string(full-date) false none Date of order creation
shipping_fee number(float) true none Amount of shipping fees including taxes
total_paid number,(float) true none Total order paid including taxes and shipping fee
payment_method integer true none Internal id of payment method in Kezia
order_items [Order_Item] false none Order lines detail

Order_Item

{
  "kezia_id": 5360,
  "product_description": "T-shirt Beatles",
  "qty": 2,
  "price": 17.04,
  "regular_price": 18.93,
  "tax_rate": 20,
  "comment": "IDART=2630. Taille XS."
}

Properties

Name Type Required Restrictions Description
kezia_id integer true none Product identifier in Kezia (=IDART)
product_description string false none Product description
qty integer true none Quantity ordered
price number(float) true none Price for all items in the line
regular_price number(float) false none Regular price (= price before discount) for all items in the line
tax_rate number(float) false none Tax rate (as a pourcentage)
comment string false none Order line comment exported to Kezia as line description

Product

{
  "kezia_id": 5360,
  "qty": 20,
  "enabled": true,
  "salable": true
}

Properties

Name Type Required Restrictions Description
kezia_id integer true none Product identifier in Kezia (=IDART)
qty number(float) false none Quantity in stock
enabled boolean false none Is product enabled? Negation of Kezia field Abandon
salable boolean false none Is product salable? Negation of Kezia field Sommeil

Products

[
  {
    "kezia_id": 5360,
    "qty": 20,
    "enabled": true,
    "salable": true
  }
]

Properties

Name Type Required Restrictions Description
anonymous [Product] false none none

Error

{
  "code": 0,
  "message": "string"
}

Properties

Name Type Required Restrictions Description
code integer(int32) true none none
message string true none none