-
Notifications
You must be signed in to change notification settings - Fork 26
4.1) Clients: php
Marco Cesarato edited this page Apr 9, 2019
·
1 revision
Filename: apiclient.class.php
Class name: APIClient
Method | Params | Return | Description |
---|---|---|---|
getInstance | - | Void | Returns static reference to the class instance |
get | $table, $format = 'json', $params = array() | Object | Fetch data |
insert | $format = 'json', $params = array() | Object | Insert data |
update | $format = 'json', $params = array() | Object | Update data |
delete | $table, $format = 'json', $params = array() | Object | Delete data |
searchElement | $key, $value, $array | Object | Search object in array |
filterBy | $key, $value, $array, $limit = null | Array | Filter results array by single key |
filter | $value, $array, $limit = null | Array | Filter results array by multiple values |
$api_client = APIClient::getInstance();
APIClient::$DEBUG = true;
APIClient::$URL = 'http://localhost';
APIClient::$ACCESS_TOKEN = '4gw7j8erfgerf6werf8fwerf8erfwfer';
APIClient::$DATASET = 'dataset';
$params = array(
'where' => array(
'type' => array('C', 'O', 'L'),
'accounts_addresses.address' => array(
'!' => '', // NOT NULL
),
),
'join' => array(
'accounts_addresses' => array(
'on' => 'parent_id',
'value' => 'id',
'method' => 'LEFT'
),
'accounts_agents' => array(
'on' => 'parent_id',
'value' => 'id'
),
),
'order_by' => array(
'address' => array(
'table' => 'accounts_addresses',
'direction' => 'DESC'
),
'type' => array(
'table' => 'accounts_addresses',
'direction' => 'ASC'
)
),
);
$records = $api_client->fetch('accounts', 'json', $params);