PHP code example of oaoa / naturhouse-api-v2
1. Go to this page and download the library: Download oaoa/naturhouse-api-v2 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/ */
oaoa / naturhouse-api-v2 example snippets
$configuration = [
'hostname' => 'https://kalendar.naturhouse-cz.cz/api/v2/',
'auth_token' => 'seecret token; you can get one from Naturhouse',
];
$client = new \Naturhouse\Client($configuration);
// fetch list of all active branches
$branches = $client->getBranches();
// prepare contact data
$contact = new \Naturhouse\Entities\Contact();
$contact->setFname('krestni');
$contact->setLname('prijmeni');
$contact->setBranch($branches[0]->getId());
$contact->setNote('testovaci kontakt');
// create contact
try{
$response = $client->createContact($contact);
$contactId = $response->getId();
//fetch contact state
$fetchedContact = $client->getContact($contactId);
// print contact state
var_dump($fetchedContact->getStatus());
} catch(\Naturhouse\Exceptions\ClientException $e) {
echo $e->getMessage();
}