api-client-python/README.md

82 lines
1.9 KiB
Markdown
Raw Normal View History

[![Build Status](https://img.shields.io/travis/retailcrm/api-client-python/master.svg?style=flat-square)](https://travis-ci.org/retailcrm/api-client-python)
2020-02-19 15:42:36 +03:00
[![Coverage](https://img.shields.io/codecov/c/gh/retailcrm/api-client-python/master.svg?style=flat-square)](https://codecov.io/gh/retailcrm/api-client-python)
[![PyPI](https://img.shields.io/pypi/v/retailcrm.svg?style=flat-square)](https://pypi.python.org/pypi/retailcrm)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/retailcrm.svg?style=flat-square)](https://pypi.python.org/pypi/retailcrm)
retailCRM python API client
2016-03-17 00:54:42 +03:00
===========================
2014-09-11 11:16:44 +04:00
This is python retailCRM API client. This library allows to use all available API versions.
## Install
2015-03-12 16:08:55 +03:00
```
2016-03-17 00:54:42 +03:00
pip install retailcrm
2015-03-12 16:08:55 +03:00
```
## Usage
#### API version 3 order create
2015-03-12 16:08:55 +03:00
```python
# coding utf-8
2016-03-17 00:54:42 +03:00
import retailcrm
2015-03-12 16:08:55 +03:00
2018-03-20 20:50:22 +03:00
client = retailcrm.v3('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
2015-03-12 16:08:55 +03:00
order = {
'firstName': 'John',
'lastName': 'Doe',
2015-03-12 16:08:55 +03:00
'phone': '+79000000000',
'email': 'john@example.com',
2015-03-12 16:08:55 +03:00
'orderMethod': 'call-request',
}
result = client.order_create(order)
```
#### API version 4 customers history
```python
# coding utf-8
import retailcrm
2018-03-20 20:50:22 +03:00
client = retailcrm.v4('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
result = client.customers_history(filter={'sinceId': '1500', 'startDate': '2018-03-01'})
print(result['pagination']['totalCount'])
```
#### API version 5 task create
```python
# coding utf-8
import retailcrm
2018-03-20 20:50:22 +03:00
client = retailcrm.v5('https://demo.retailcrm.ru', 'uLxXKBwjQteE9NkO3cJAqTXNwvKktaTc')
site = 'example-com'
task = {
'text': 'Product availability problem',
'commentary': 'Take a look ASAP',
'order': {
'externalId': '100500'
},
'performerId': 1
}
result = client.task_create(task, site)
2015-03-12 16:08:55 +03:00
```
2016-03-17 00:54:42 +03:00
## Documentation
2016-03-17 00:54:42 +03:00
* [English](http://www.retailcrm.pro/docs/Developers/Index)
* [Russian](http://www.retailcrm.ru/docs/Developers/Index)