Documentation
Integrations

SDK



The Software Development Kit (SDK) provides a collection of services for seamless integration of our configurators via API into your own projects and applications. Below are the basic steps for setting it up.

Use our application example for a quick start. You can download it here.


Fundamentals

Start by defining the basic variables. You can find your Client ID in the settings under API in the Integrations section. For User and Password, simply enter your regular login credentials.

Example: index.php

header('Content-Type: text/html; charset=utf-8');
session_start();$_COOKIE['PHPSESSID']=session_id();$session=$_COOKIE['PHPSESSID'];

$client='00000';
$user='user@email.com';
$password='password';
$language='EN';
$language_extension='_english';
$protocol='https';
$host='server.fenzon.de';

Next, you can create the function for calling the API.

Example: index.php

function CallAPI($method,$url,$data=false){
global $client,$user,$password,$session,$language;
$authorization=base64_encode(sprintf('%s:%s',$user,$password));
$curl=curl_init();
switch($method){case "POST":curl_setopt($curl,CURLOPT_POST,1);if($data)curl_setopt($curl,CURLOPT_POSTFIELDS,$data);break;case"PUT":curl_setopt($curl,CURLOPT_PUT, 1);break;default:if($data)$url=sprintf("%s&%s",$url,http_build_query($data));}
curl_setopt($curl,CURLOPT_URL,$url);curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
$headers=array('User-Agent: Fenzon','Authorization: Basic '.$authorization,'Client: '.$client,'Session: '.$session,'Language: '.$language);
curl_setopt($curl,CURLOPT_HTTPHEADER,$headers);
$result=curl_exec($curl);
curl_close($curl);
return $result;
}

Product Configurator

The product configurator can be called with the following command.

Example: index.php

$data['type']='door';
echo json_decode(CallAPI('GET',$host.'/api.php?v=1&ep=svcConfigurator',$data));

The following code is called whenever a change is made and updates the product configurator.

Beispiel: index.php

if(isset($_POST['configurator']) AND !isset($_POST['action'])){
$settings=json_decode(CallAPI('GET',$host.'/api.php?v=1&ep=svcConfiguratorSettings',$_POST),true);
echo json_encode($settings);exit();
}

This section returns a product representation, pricing information, a product description, and the configuration data that can be transferred directly to a shopping cart or a database. If a configuration is not feasible, a restriction message is returned instead.

Beispiel: index.php

if(isset($_POST['action']) AND $_POST['action']=='configSave'){
$save=json_decode(CallAPI('GET',$host.'/api.php?v=1&ep=svcConfiguratorSave',$_POST),true);
echo json_encode($save);exit();
}

CTree

With the Configuration Tree (CTree), you receive all input and selection fields to transfer them into your own UI.
Use our CTree example file for a quick start. You can download it here.

$data['type']='window';
echo json_decode(CallAPI('GET',$host.'/api.php?v=1&ep=svcCTree',$data));

If the required configuration properties are not fully selected, all currently available fields will be returned. Otherwise, the endpoint will also provide the position name, a description, prices, and a graphical representation.

The returned index values can be directly transmitted to the endpoint as configuration selections, following the schema below. Index values of nested attributes are structured according to the following schema and separated by a hyphen or a dot: [Attribute-Subattribute.Field]. This structure is reflected in the product configuration: $data['product_configuration'][Field][Attribute][Subattribute].
If there is no subattribute in the index, it will be omitted during data transmission. If there is no field in the index, the value is 0.

$data['type']='window';
$data['product_configuration'][0]['system']='EXAMPLE';
$data['product_configuration'][0]['unit_type']='1S';
$data['product_configuration'][0]['width']='1230';
$data['product_configuration'][0]['height']='1480';
$data['product_configuration'][1]['width']='730';
$data['product_configuration'][1]['height']='1480';
$data['product_configuration'][1]['opening_type']='TTL';
$data['product_configuration'][2]['width']='500';
$data['product_configuration'][2]['height']='1480';
$data['product_configuration'][2]['opening_type']='FG';
echo json_decode(CallAPI('GET',$host.'/api.php?v=1&ep=svcCTree',$data));

If a source is returned for the system, it must also be included in further queries for the respective system, in the following format:

$data['product_configuration'][0]['source']='fenzon_00000';

Using the following endpoint, you can check if the assembled configuration is technically feasible.

echo json_decode(CallAPI('GET',$host.'/api.php?v=1&ep=svcCTreeRestriction',$data));
We use cookies to optimize the use of our website for you. Not only are cookies helpful in providing you with a personalized user experience and relevant ads, they also prove very useful in our web analytics. For more information about the different cookies we use, see our Privacy Policy.


Decline
Accept Cookies