forked from maidmaid/zoho
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 Dany Maillard | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,143 @@ | ||
Zoho | ||
==== | ||
|
||
[Zoho](https://www.zoho.com) client library. | ||
|
||
[](https://travis-ci.org/maidmaid/zoho) | ||
[](https://packagist.org/packages/maidmaid/zoho) | ||
[](https://packagist.org/packages/maidmaid/zoho) | ||
|
||
## Installation | ||
|
||
``` | ||
composer require maidmaid/zoho | ||
``` | ||
|
||
## Usage | ||
|
||
### Constructor | ||
|
||
```php | ||
use Maidmaid\Zoho\Client; | ||
|
||
$client = new Client('your_authtoken'); | ||
``` | ||
|
||
See [Using Authentication Token in official doc](https://www.zoho.com/crm/help/api/using-authentication-token.html) for more infos. | ||
|
||
### Insert records | ||
|
||
> To insert records into the required Zoho CRM module. | ||
```php | ||
$records = $client->insertRecords($module = 'Contacts', $data = [ | ||
10 => [ | ||
'Last Name' => 'Holmes', | ||
'First Name' => 'Sherlock', | ||
] | ||
); | ||
``` | ||
|
||
See [insertRecords Method in official doc](https://www.zoho.com/crm/help/api/insertrecords.html) for more infos. | ||
|
||
### Update records | ||
|
||
> To update or modify the records in Zoho CRM | ||
```php | ||
$records = $client->updateRecords($module, $data = [ | ||
10 => [ | ||
'Id' => 'the_ID', | ||
'First Name' => 'Sherlock', | ||
] | ||
]); | ||
``` | ||
|
||
See [updateRecords Method in official doc](https://www.zoho.com/crm/help/api/updaterecords.html) for more infos. | ||
|
||
### Delete records | ||
|
||
> To delete the selected records. | ||
```php | ||
$client->deleteRecords($module = 'Contacts', 'the_ID'); | ||
``` | ||
|
||
See [deleteMethod Method in official doc](https://www.zoho.com/crm/help/api/deleterecords.html) for more infos. | ||
|
||
### Get record by ID | ||
|
||
> To retrieve individual records by record ID | ||
```php | ||
$client->getRecordById($module= 'Contacts', ['the_ID_1', 'the_ID_2']) | ||
``` | ||
|
||
See [getRecordById Method in official doc](https://www.zoho.com/crm/help/api/getrecordbyid.html) for more infos. | ||
|
||
### Get records | ||
|
||
> To retrieve all users data specified in the API request. | ||
Fetch data from first page: | ||
|
||
```php | ||
$client->getRecords($module= 'Contacts') | ||
``` | ||
|
||
Fetch data with pagination: | ||
|
||
```php | ||
$page = 0; | ||
while ($modules = $client->getRecords($module = 'Contacts', ++$page)) { | ||
|
||
} | ||
``` | ||
|
||
See [getRecords Method in official doc](https://www.zoho.com/crm/help/api/getrecords.html) for more infos. | ||
|
||
### Search records | ||
|
||
> To retrieve the records that match your search criteria. | ||
```php | ||
$records = $client = searchRecords($module = 'Contacts', $criteria = ['Last Name' => 'Holmes']); | ||
``` | ||
|
||
See [searchRecords Method in official doc](https://www.zoho.com/crm/help/api/searchrecords.html) for more infos. | ||
|
||
### Get fields | ||
|
||
> To retrieve details of fields available in a module. | ||
```php | ||
$client->getFields($module = 'Contacts'); | ||
``` | ||
|
||
See [getFields Method in official doc](https://www.zoho.com/crm/help/api/getfields.html) for more infos. | ||
|
||
### Generic call | ||
|
||
```php | ||
$result = $client->call($module, $method, $params = array(), $data = array()) | ||
``` | ||
|
||
### Check errors | ||
|
||
You can get last errors on failed process records: | ||
|
||
```php | ||
$client->getLastErrors(); | ||
``` | ||
|
||
All calls thrown an exception if global response fails (e.g. if API key is wrong): | ||
|
||
```php | ||
try { | ||
$results = $client->updateRecords('Contacts', $updates = []); | ||
} catch (ZohoCRMException $e) {} | ||
``` | ||
|
||
## Licence | ||
|
||
Zoho client library is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |