Update README.md

This commit is contained in:
Dmitry Mamontov 2015-02-02 14:39:46 +03:00
parent 98114cf816
commit 52b4c32772

View File

@ -15,11 +15,17 @@ Usage
``` csharp ``` csharp
using RetailCrm; using RetailCrm;
using RetailCrm.Response;
... ...
RestApi api = new RestApi( ApiClient api;
"https://demo.intarocrm.ru", try
"T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH" {
); api = new ApiClient("https://demo.retailcrm.ru", "T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH");
}
catch (WebException e)
{
System.Console.WriteLine(e.ToString());
}
``` ```
Constructor arguments are: Constructor arguments are:
@ -29,7 +35,9 @@ Constructor arguments are:
### Example: get order types list ### Example: get order types list
``` csharp ``` csharp
using RetailCrm;
using RetailCrm.Response;
...
ApiClient api; ApiClient api;
string url, key; string url, key;
try try
@ -47,7 +55,7 @@ Dictionary<string, object> tmpOrder = new Dictionary<string, object>(){
{"createdAt", DateTime.Now.ToString("Y-m-d H:i:s")}, {"createdAt", DateTime.Now.ToString("Y-m-d H:i:s")},
{"discount", 50}, {"discount", 50},
{"phone", "89263832233"}, {"phone", "89263832233"},
{"email", "vshirokov@gmail.com"}, {"email", "example@gmail.com"},
{"customerComment", "example"}, {"customerComment", "example"},
{"customFields", new Dictionary<string, object>(){ {"customFields", new Dictionary<string, object>(){
{"reciever_phone", "example"}, {"reciever_phone", "example"},
@ -94,7 +102,9 @@ catch (WebException e)
if (response.isSuccessful() && 201 == response["statusCosde"]) { if (response.isSuccessful() && 201 == response["statusCosde"]) {
System.Console.WriteLine("Заказ успешно создан. ID заказа в retailCRM = " + response["id"]); System.Console.WriteLine("Заказ успешно создан. ID заказа в retailCRM = " + response["id"]);
} else { } else {
System.Console.WriteLine("Ошибка создания заказа: [Статус HTTP-ответа " + response["statusCosde"] + "] " + response["errorMsg"]); System.Console.WriteLine(
"Ошибка создания заказа: [Статус HTTP-ответа " + response["statusCosde"] + "] " + response["errorMsg"]
);
} }
``` ```