PHP code example of idoit / zenkit-api-client

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

    

idoit / zenkit-api-client example snippets


$apiKey = 'your-api-key';

try {
    // Get the response from Guzzle.
    $response = (new API($apiKey))->request('auth/currentuser');

    // Get the body contents of the response.
    $rawResponseBody = $response->getBody()->getContents();

    // Output data as array.
    var_dump(json_decode($rawResponseBody, true));
} catch (idoit\zenkit\BadResponseException $e) {
    echo 'Exception! The status was ' . $e->getCode() . ', response: ' . $e->getResponse()->getBody()->getContents();
} catch (Exception $e) {
    echo 'Exception! Somewthing else went wrong: ' . $e->getMessage();
}

$listShortId = 'your-list-short-id';

$elements = $api->getElementService()
    ->getElementsInList($listShortId);

$entries = $api->getEntryService()
    ->setElementConfiguration($elements)
    ->getEntriesForListView($listShortId);