PHP wrapper for the Digitaleo API
PHP
Latest commit ec14cf1 Jan 12, 2016 @flericheux flericheux update Readme.md
Remove get token to set credential
Permalink
Failed to load latest commit information.
v1
v2
.gitignore
README.md

README.md

Digitaleo-api-php

PHP wrapper to call Digitaleo APIs, two wrappers are available

  • v1/Digitaleo.php => DEPRECATED
  • v2/Digitaleo.php

Sample code to use v2/Digitaleo.php

Init Digitaleo as password credential

$httpClient = new \Digitaleo();
$httpClient->setBaseUrl('<api_base_url>')
$httpClient->setOauthPasswordCredentials(
    'https://oauth.messengeo.net/token',
    '<client_id>',
    '<client_secret>',
    '<login>',
    '<password>');

Read one or several resource

$params = [
    'properties' => '<properties>',
    'limit' => '<limit>',
    'offset' => '<limit>',
    'sort' => '<sort>',
    'total' => '<total>',
    '<property_name1' => 'property_value1',
    '<property_name2' => 'property_value2'
];
$httpClient->callGet('my_resource_name', $params);

Create one resource

$body = [
    '<property_name1' => 'property_value1',
    '<property_name2' => 'property_value2'
];
$httpClient->callPost('my_resource_name', $body);

Update one resource

$params = [
    'id' => '<id_value>',
];
$dataToUpdate = [
    '<property_name1' => 'property_value1',
    '<property_name2' => 'property_value2'
];
$body = [
    'metaData' => json_encode($dataToUpdate),
];
$httpClient->callPut('my_resource_name', $body, $params);

Delete one resource

$params = [
    'id' => '<id_value>'
];
$httpClient->callDelete('my_resource_name', $params);