PHP wrapper for the Digitaleo API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
v1 reorganize project Nov 12, 2015
v2 remove granttype password May 2, 2017
.gitignore Add new wrapper Oct 20, 2015
README.md fix doc Sep 14, 2017

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 client credentials

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

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);