Update README.md

This commit is contained in:
Alex Lushpai 2016-03-14 23:17:48 +03:00
parent 36fb113030
commit 61ef0fbd4a

View File

@ -1,28 +1,28 @@
.NET-клиент для retailCRM API .NET-клиент для retailCRM API
============================= =============================
.NET-клиент для работы с [RetailCRM API](http://www.retailcrm.ru/docs/rest-api/index.html). .NET-клиент для работы с [RetailCRM API](http://www.retailcrm.pro/docs/Developers/ApiVersion3).
version: 3.0.4 version: 3.0.4
Обязательные требования Requirements
----------------------- -----------------------
* [Newtonsoft.Json](http://james.newtonking.com/json) * [Newtonsoft.Json](http://james.newtonking.com/json)
Установка через NuGet Install with NuGet
--------------------- ---------------------
Для начала требуется скачать и установить сам [NuGet](http://docs.nuget.org/consume/installing-nuget). Install [NuGet](http://docs.nuget.org/consume/installing-nuget).
После этого для установки клиента требуется запустить комманду в [Package Manager Console](http://docs.nuget.org/docs/start-here/using-the-package-manager-console) Run this command into [Package Manager Console](http://docs.nuget.org/docs/start-here/using-the-package-manager-console)
``` bash ``` bash
PM> Install-Package RetailCRM.ApiClient PM> Install-Package RetailCRM.ApiClient
``` ```
Примеры использования Usage
--------------------- ---------------------
### Получение информации о заказе ### Get order
``` csharp ``` csharp
using RetailCrm; using RetailCrm;
@ -32,7 +32,7 @@ ApiClient api;
try try
{ {
api = new ApiClient( api = new ApiClient(
"https://demo.retailcrm.ru", "https://demo.retailcrm.pro",
"T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH" "T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH"
); );
} }
@ -55,14 +55,14 @@ if (response.isSuccessful()) {
System.Console.WriteLine(response["totalSumm"]); System.Console.WriteLine(response["totalSumm"]);
} else { } else {
System.Console.WriteLine( System.Console.WriteLine(
"Ошибка получения информации о заказа: [Статус HTTP-ответа " + "Error: [HTTP-code " +
response["statusCosde"] + "] " + response["statusCosde"] + "] " +
response["errorMsg"] response["errorMsg"]
); );
} }
``` ```
### Создание заказа ### Create order
``` csharp ``` csharp
using RetailCrm; using RetailCrm;
@ -112,7 +112,7 @@ Dictionary<string, object> tmpOrder = new Dictionary<string, object>(){
{"code", "courier"}, {"code", "courier"},
{"date", DateTime.Now.ToString("Y-m-d")}, {"date", DateTime.Now.ToString("Y-m-d")},
{"address", new Dictionary<string, object>(){ {"address", new Dictionary<string, object>(){
{"text", "exampleing"} {"text", "example"}
} }
} }
} }
@ -131,12 +131,12 @@ catch (WebException e)
if (response.isSuccessful() && 201 == response["statusCosde"]) { if (response.isSuccessful() && 201 == response["statusCosde"]) {
System.Console.WriteLine( System.Console.WriteLine(
"Заказ успешно создан. ID заказа в retailCRM = " + response["id"] "Order created. Order ID is " + response["id"]
); );
} else { } else {
System.Console.WriteLine( System.Console.WriteLine(
"Ошибка создания заказа: [Статус HTTP-ответа " + "Error: [HTTP-code " +
response["statusCosde"] + "] " + response["statusCode"] + "] " +
response["errorMsg"] response["errorMsg"]
); );
} }