PHP code example of glsv / elma-api

1. Go to this page and download the library: Download glsv/elma-api 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/ */

    

glsv / elma-api example snippets




use Glsv\ElmaApi\ElmaClientApi;

$baseUrl = 'https://elma365.domain.com/pub/v1/';
$token = '2ab8026f-ce23-4759-9530-xxxxxxxxxx'; 

$api = new ElmaClientApi($baseUrl, $token);

$relativeUrl = 'app/test/mylist/list';

# Опциональные параметры. Формат смотреть в документации на API для каждого применения.  
$requestData = [
    "active" => true,
    "filter" => [
        "tf" => [
            "my_custom_date" => [
                "min" => "2022-01-01",
                "max" => "2022-06-01",
            ]
        ]
    ],
];

# $results содержит оригинальный response (array) 
$results = $api->makePost($relativeUrl, $requestData);



use Glsv\ElmaApi\ElmaClientApi;
use Glsv\ElmaApi\services\ListService;

$baseUrl = 'https://elma365.domain.com/pub/v1/';
$token = '2ab8026f-ce23-4759-9530-xxxxxxxxxx'; 

$api = new ElmaClientApi($baseUrl, $token);

$service = new ListService($this->api);
$relativeUrl = 'app/test/mylist/list';

# Опциональная фильтрация элементов списка по его атрибутам. 
$requestData = [
    "filter" => [
        "tf" => [
            "my_custom_date" => [
                "min" => "2022-01-01",
                "max" => "2022-06-01",
            ]
        ]
    ],
];

# $items содержит список всех элементов списка Elma
$items = $service->getAllItems($relativeUrl, $requestData);