1. Go to this page and download the library: Download sqmmm/kodix-api-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sqmmm / kodix-api-sdk example snippets
use Kodix\Api\Client;
$apiClient = new Client();
// set login and pass for authorization (if token has expired)
$apiClient->setAccessLogin($params['login']);
$apiClient->setAccessPassword($params['password']);
//this callback function is used if token has expired
$apiClient->setOnTokenExpiredFunction(function(Client $client) {
$token = $client->auth();
if($token){
//you can save new token
return true;
}
return false;
});
if(isset($params['token'])) {
$apiClient->setAccessToken($params['token']);
}else{
$token = $apiClient->auth();
if($token){
// save new token
}
}
// Getting the list of dealerships with brand filtering by ids.
$dealerships = new Dealership($apiClient);
$response = $dealerships->getList(['filter' => ['id' => $ids], 'with' => ['brand']]);
$statusCode = $response->getCode();
$errors = $response->getErrors();
if(is_array($errors) && count($errors) > 0 ){
$items = [];
}else {
$data = $response->getData();
$items = $data['items'];
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.