ipwsystems/metazo-sdk-php

PHP api for working with IPW Metazo.

v1.0.7 2024-11-28 13:21 UTC

This package is auto-updated.

Last update: 2025-04-28 14:05:57 UTC


README

PHP client for the IPW Metazo api.

https://metazoapi.support.ipw.dk/

Installation

composer require ipwsystems/metazo-sdk-php

Usage

Setup

use IpwSystems\MetazoApi\Client;
use IpwSystems\MetazoApi\Configuration;

$config = new Configuration([
    'endpoint' => 'https://.../metazo/v1/',
    'user' => 'api user',
    'password' => 'api user password',
    'key' => 'api key',
    'site' => 1
]);

$client = new Client($config);

Authentication

if ($client->authenticate()) {
    // authenticated...
}

Here a list and a model request.

List

$client->list('user', [
    'search' => 'Peter',
    'searchfield' => 'name',
    'search' => 'LIKEEND',
]);

Model

$client->model('create', [
    'datatype' => 'form1234',
    'f001' => 'test',
    'f002' => 'test 1',
    'f003' => 'test 2',
]);

Here the full list of methods. See the api documentation for details.

$client->ping(): string;
$client->authenticate(): bool;
$client->validateToken(): bool
$client->revokeToken(): bool
$client->datatypes(): array
$client->explain(string $dataType): array
$client->model(string $model, array $options): array

$options = [
    'datatype' => '',
    'model' => '',
    'objectId' => null,
];
$client->list(string $datatype, array $options): array;

$options = [
    'datatype' => '',
    'search' => '',
    'searchfield' => '',
    'searchcomp' => '',
    'searchandor' => 'AND',
    'fields' => '',
    'limit' => 20,
    'offset' => 0,
];
$client->read(int $objectId): array
$client->uploadFiles(int $parentId, array $files): array

// Here `$files` is an array of full paths to files to upload and attach to an object.

$client->downloadFile(int $objectId, string $destination): <data stream>
$client->filter(int $filterId): array
$client->filterCount(int $filterId): int