1
0
mirror of synced 2024-11-24 22:36:06 +03:00
api-client-php/README.md

61 lines
1.1 KiB
Markdown
Raw Normal View History

2013-07-02 12:39:29 +04:00
IntaroCRM REST API client
2013-07-04 10:18:28 +04:00
=================
2013-07-02 12:37:54 +04:00
2013-07-02 12:39:29 +04:00
PHP Client for [IntaroCRM REST API](http://docs.intarocrm.ru/rest-api/).
2013-07-03 18:13:25 +04:00
2013-07-04 12:44:41 +04:00
Requirements
------------
2013-07-03 18:13:25 +04:00
2013-10-08 11:19:50 +04:00
* PHP version 5.3 and above
2013-07-03 18:13:25 +04:00
* PHP-extension CURL
2013-07-04 12:44:41 +04:00
Installation
------------
2014-04-21 14:56:52 +04:00
1) Install [composer](https://getcomposer.org/download/) into the project directory.
2013-07-04 12:44:41 +04:00
2014-04-21 14:56:52 +04:00
2) Add IntaroCRM REST API client in your composer.json:
2013-07-04 12:44:41 +04:00
```js
{
"require": {
2013-10-15 14:13:31 +04:00
"intarocrm/rest-api-client": "1.2.*"
2013-07-04 12:44:41 +04:00
}
}
```
2014-04-21 14:56:52 +04:00
3) Use command `php composer.phar update intarocrm/rest-api-client` to install new vendor into `vendor/` folder.
2013-07-04 12:44:41 +04:00
Usage
------------
### Create API clent class
``` php
2013-07-04 17:03:35 +04:00
$crmApiClient = new \IntaroCrm\RestApi(
2013-10-08 11:19:38 +04:00
'https://demo.intarocrm.ru',
2013-07-04 17:03:35 +04:00
'T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH'
);
2013-07-04 12:44:41 +04:00
```
Constructor arguments are:
1. Your IntaroCRM acount URL-address
2. Your site API Token
2013-07-04 12:44:41 +04:00
### Example: get order types list
``` php
2013-10-15 14:11:57 +04:00
try {
$orderTypes = $crmApiClient->orderTypesList();
}
catch (\IntaroCrm\Exception\CurlException $e) {
//$logger->addError('orderTypesList: connection error');
}
catch (\IntaroCrm\Exception\ApiException $e) {
//$logger->addError('orderTypesList: ' . $e->getMessage());
}
2013-07-04 15:51:49 +04:00
2013-10-08 11:19:38 +04:00
```