Skip to content

Latest commit

 

History

History
66 lines (43 loc) · 1.45 KB

README_API2.md

File metadata and controls

66 lines (43 loc) · 1.45 KB

ChurchTools API2

Access the new (2019) Rest API for ChurchTools via classes and methods

Free software (both as in free beer and free speech) by [Vineyard Köln][2], licensed under Apache 2.0

Installation

composer require vineyardkoeln/churchtools-api

Usage

Prerequisite: Autoloading

If you haven't already configured autoloading in your project, start by including the Composer autoloader:

require __DIR__ . '/vendor/autoload.php';

Using the Api2

require_once __DIR__.'/vendor/autoload.php';

$apiClient = \ChurchTools\Api2\RestApi2::createClientWithUsernamePassword("https://mysite.church.tools", "username", "mypassword");
$apiInfo = $apiClient->getApiInfo();
var_dump($apiInfo);

You can also use tokens to access the Api2. In that case use this create method:

$apiClient = \ChurchTools\Api2\RestApi2::createClientWithLoginToken("https://mysite.church.tools", "my_auth_token");

Example usage of the Api2

$currentUser= $apiClient->getCurrentUser();
var_dump($currentUser);
$user= $apiClient->getPersonById("<numeric id of the user>");
var_dump($user);
$users= $apiClient->getAllPersons();
var_dump($users);
$dbfields= $apiClient->getAllFields();
var_dump($dbfields);

API definition fixes

/fields -> length nullable /groups/{id}/members/ ->memberEndDate string($date) -> nullable