Example #1
0
<?php

include __DIR__ . '/../vendor/autoload.php';
header("Content-Type:text/plain");
$api = new \Rekonekt\RekonektApi();
// If no API key is set, login user
if (!$api->getApiKey()) {
    $email = 'user@email';
    $password = '******';
    $employment = $api->getEmployment($email, $password);
    print_r($employment);
    // Get first employment from list
    $firstEmployment = reset($employment['employees']);
    // Log in (set Api key in the session)
    $userData = $api->loginEmployee($email, $password, $firstEmployment['employeeId']);
    print_r($userData);
}
echo "\n\nCurrent employees API key: " . $api->getApiKey();
// Log out (clear api key form session)
$api->logoutEmployee();
<?php

include __DIR__ . '/../vendor/autoload.php';
header("Content-Type:text/plain");
$api = new \Rekonekt\RekonektApi();
$api->setApiKey('...');
$testUploadFile = realpath(__DIR__ . '/../README.md');
$created = $api->createAttachment('readme.md', filesize($testUploadFile));
print_r($created);
$uploaded = $api->uploadAttachment($created['attachment']['attachmentId'], $testUploadFile, 'text/plain', 'readme.md');
print_r($uploaded);