.NET client for retailCRM API
Go to file
2020-02-19 23:52:36 +03:00
Retailcrm update tests 2020-02-19 23:27:44 +03:00
RetailcrmUnitTest update tests 2020-02-19 23:27:44 +03:00
.gitattributes Multiversion client (#6) 2017-10-30 13:51:45 +03:00
.gitignore Modify test for autobuild (#9) 2018-03-21 15:56:36 +03:00
appveyour.yml Update appveyour.yml 2020-02-19 23:52:36 +03:00
LICENSE Modify test for autobuild (#9) 2018-03-21 15:56:36 +03:00
README.md Typos fix. 2019-07-27 22:18:09 +03:00
Retailcrm.sln Multiversion client (#6) 2017-10-30 13:51:45 +03:00

NuGet

retailCRM API C# client

This is C# retailCRM API client. This library allows to use all available API versions.

Install

PM> Install-Package Retailcrm.SDK

Usage

Get order

using System.Diagnostics;
using Retailcrm;
using Retailcrm.Versions.V5;
...

Client api = new Client("https://demo.retailcrm.ru", "T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH");
Response response = api.OrdersGet("12345", "externalId");

if (response.IsSuccessful()) {
    Debug.WriteLine(response.GetRawResponse());
} else {
    Debug.WriteLine($"Ошибка: [Статус HTTP-ответа {response.GetStatusCode().ToString()}]");
}

Create order

using System.Diagnostics;
using Retailcrm;
using Retailcrm.Versions.V4;
...

Client api = new Client("https://demo.retailcrm.ru", "T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH");
Response response = api.OrdersCreate(new Dictionary<string, object>
{
    {"externalId", "12345"},
    {"createdAt", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")},
    {"lastName", "Doe"},
    {"firstName", "John"},
    {"email", "john@example.com"},
    {"phone", "+79999999999"},
    {"items", new List<object> {
        new Dictionary<string, object> {
            {"initialPrice", 100},
            {"quantity", 1},
            {"productId", 55},
            {"productName", "example"}
        },
        new Dictionary<string, object> {
            {"initialPrice", 200},
            {"quantity", 2},
            {"productId", 14},
            {"productName", "example too"}
        }
    }}
});

if (response.IsSuccessful()) {
    Debug.WriteLine(response.GetResponse()["externalId"].ToString());
} else {
    Debug.WriteLine($"Ошибка: [Статус HTTP-ответа {response.GetStatusCode().ToString()}]");
}

Documentation