InSales API - Дополнительные поля — различия между версиями

Материал из Insales Wiki
Перейти к: навигация, поиск
(Добавление)
(Получение списка)
Строка 8: Строка 8:
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<objects type="array">
 
<objects type="array">
   <object>
+
   <field>
 
     <position type="integer">0</position>
 
     <position type="integer">0</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 20: Строка 20:
 
     <destiny type="integer">1</destiny>
 
     <destiny type="integer">1</destiny>
 
     <system-name>country</system-name>
 
     <system-name>country</system-name>
   </object>
+
   </field>
   <object>
+
   <field>
 
     <position type="integer">0</position>
 
     <position type="integer">0</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 33: Строка 33:
 
     <destiny type="integer">2</destiny>
 
     <destiny type="integer">2</destiny>
 
     <system-name>surname</system-name>
 
     <system-name>surname</system-name>
   </object>
+
   </field>
   <object>
+
   <field>
 
     <position type="integer">1</position>
 
     <position type="integer">1</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 46: Строка 46:
 
     <destiny type="integer">3</destiny>
 
     <destiny type="integer">3</destiny>
 
     <system-name nil="true"></system-name>
 
     <system-name nil="true"></system-name>
   </object>
+
   </field>
   <object>
+
   <field>
 
     <position type="integer">1</position>
 
     <position type="integer">1</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 59: Строка 59:
 
     <destiny type="integer">2</destiny>
 
     <destiny type="integer">2</destiny>
 
     <system-name>name</system-name>
 
     <system-name>name</system-name>
   </object>
+
   </field>
   <object>
+
   <field>
 
     <position type="integer">1</position>
 
     <position type="integer">1</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 72: Строка 72:
 
     <destiny type="integer">1</destiny>
 
     <destiny type="integer">1</destiny>
 
     <system-name>state</system-name>
 
     <system-name>state</system-name>
   </object>
+
   </field>
   <object>
+
   <field>
 
     <position type="integer">2</position>
 
     <position type="integer">2</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 85: Строка 85:
 
     <destiny type="integer">2</destiny>
 
     <destiny type="integer">2</destiny>
 
     <system-name>middlename</system-name>
 
     <system-name>middlename</system-name>
   </object>
+
   </field>
   <object>
+
   <field>
 
     <position type="integer">2</position>
 
     <position type="integer">2</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 98: Строка 98:
 
     <destiny type="integer">3</destiny>
 
     <destiny type="integer">3</destiny>
 
     <system-name nil="true"></system-name>
 
     <system-name nil="true"></system-name>
   </object>
+
   </field>
   <object>
+
   <field>
 
     <position type="integer">2</position>
 
     <position type="integer">2</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 111: Строка 111:
 
     <destiny type="integer">1</destiny>
 
     <destiny type="integer">1</destiny>
 
     <system-name>city</system-name>
 
     <system-name>city</system-name>
   </object>
+
   </field>
   <object>
+
   <field>
 
     <position type="integer">3</position>
 
     <position type="integer">3</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 124: Строка 124:
 
     <destiny type="integer">2</destiny>
 
     <destiny type="integer">2</destiny>
 
     <system-name nil="true"></system-name>
 
     <system-name nil="true"></system-name>
   </object>
+
   </field>
   <object>
+
   <field>
 
     <position type="integer">3</position>
 
     <position type="integer">3</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 137: Строка 137:
 
     <destiny type="integer">1</destiny>
 
     <destiny type="integer">1</destiny>
 
     <system-name>address</system-name>
 
     <system-name>address</system-name>
   </object>
+
   </field>
   <object>
+
   <field>
 
     <position type="integer">4</position>
 
     <position type="integer">4</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 150: Строка 150:
 
     <destiny type="integer">1</destiny>
 
     <destiny type="integer">1</destiny>
 
     <system-name>zip</system-name>
 
     <system-name>zip</system-name>
   </object>
+
   </field>
   <object>
+
   <field>
 
     <position type="integer">4</position>
 
     <position type="integer">4</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 163: Строка 163:
 
     <destiny type="integer">2</destiny>
 
     <destiny type="integer">2</destiny>
 
     <system-name>phone</system-name>
 
     <system-name>phone</system-name>
   </object>
+
   </field>
   <object>
+
   <field>
 
     <position type="integer">5</position>
 
     <position type="integer">5</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 176: Строка 176:
 
     <destiny type="integer">2</destiny>
 
     <destiny type="integer">2</destiny>
 
     <system-name>email</system-name>
 
     <system-name>email</system-name>
   </object>
+
   </field>
   <object>
+
   <field>
 
     <position type="integer">6</position>
 
     <position type="integer">6</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 189: Строка 189:
 
     <destiny type="integer">1</destiny>
 
     <destiny type="integer">1</destiny>
 
     <system-name nil="true"></system-name>
 
     <system-name nil="true"></system-name>
   </object>
+
   </field>
   <object>
+
   <field>
 
     <position type="integer">6</position>
 
     <position type="integer">6</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 202: Строка 202:
 
     <destiny type="integer">2</destiny>
 
     <destiny type="integer">2</destiny>
 
     <system-name>email_confirmation</system-name>
 
     <system-name>email_confirmation</system-name>
   </object>
+
   </field>
   <object>
+
   <field>
 
     <position type="integer">7</position>
 
     <position type="integer">7</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 212: Строка 212:
 
     <obligatory type="boolean">false</obligatory>
 
     <obligatory type="boolean">false</obligatory>
 
     <id type="integer">180611</id>
 
     <id type="integer">180611</id>
     <title>&#1055;&#1086;&#1076;&#1087;&#1080;&#1089;&#1072;&#1090;&#1100;&#1089;&#1103; &#1085;&#1072; &#1085;&#1086;&#1074;&#1086;&#1089;&#1090;&#1080; &#1084;&#1072;&#1075;&#1072;&#1079;&#1080;&#1085;&#1072;</title>
+
     <title>Подписка на новости</title>
 
     <destiny type="integer">2</destiny>
 
     <destiny type="integer">2</destiny>
 
     <system-name>subscribe</system-name>
 
     <system-name>subscribe</system-name>
   </object>
+
   </field>
   <object>
+
   <field>
 
     <position type="integer">8</position>
 
     <position type="integer">8</position>
 
     <for-buyer type="boolean">true</for-buyer>
 
     <for-buyer type="boolean">true</for-buyer>
Строка 228: Строка 228:
 
     <destiny type="integer">2</destiny>
 
     <destiny type="integer">2</destiny>
 
     <system-name nil="true"></system-name>
 
     <system-name nil="true"></system-name>
   </object>
+
   </field>
 
</objects>
 
</objects>
 
</pre>
 
</pre>

Версия 09:37, 24 июля 2012

Получение списка

Запрос: GET /admin/fields.xml

Ответ:

HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<objects type="array">
  <field>
    <position type="integer">0</position>
    <for-buyer type="boolean">true</for-buyer>
    <example nil="true"></example>
    <office-title>Страна</office-title>
    <created-at type="datetime">2010-11-18T00:11:30+03:00</created-at>
    <updated-at type="datetime">2012-05-30T16:51:19+04:00</updated-at>
    <obligatory type="boolean">false</obligatory>
    <id type="integer">1</id>
    <title nil="true"></title>
    <destiny type="integer">1</destiny>
    <system-name>country</system-name>
  </field>
  <field>
    <position type="integer">0</position>
    <for-buyer type="boolean">true</for-buyer>
    <example nil="true"></example>
    <office-title>Фамилия</office-title>
    <created-at type="datetime" nil="true"></created-at>
    <updated-at type="datetime">2012-06-18T12:42:15+04:00</updated-at>
    <obligatory type="boolean">false</obligatory>
    <id type="integer">136291</id>
    <title></title>
    <destiny type="integer">2</destiny>
    <system-name>surname</system-name>
  </field>
  <field>
    <position type="integer">1</position>
    <for-buyer type="boolean">true</for-buyer>
    <example nil="true"></example>
    <office-title>Номер постамата</office-title>
    <created-at type="datetime">2012-03-30T16:55:19+04:00</created-at>
    <updated-at type="datetime">2012-03-30T16:55:19+04:00</updated-at>
    <obligatory type="boolean">false</obligatory>
    <id type="integer">511497</id>
    <title>Номер постамата</title>
    <destiny type="integer">3</destiny>
    <system-name nil="true"></system-name>
  </field>
  <field>
    <position type="integer">1</position>
    <for-buyer type="boolean">true</for-buyer>
    <example nil="true"></example>
    <office-title>Имя</office-title>
    <created-at type="datetime" nil="true"></created-at>
    <updated-at type="datetime">2012-06-18T12:42:15+04:00</updated-at>
    <obligatory type="boolean">true</obligatory>
    <id type="integer">65588</id>
    <title>Имя</title>
    <destiny type="integer">2</destiny>
    <system-name>name</system-name>
  </field>
  <field>
    <position type="integer">1</position>
    <for-buyer type="boolean">true</for-buyer>
    <example nil="true"></example>
    <office-title>Область</office-title>
    <created-at type="datetime">2010-11-18T00:11:31+03:00</created-at>
    <updated-at type="datetime">2012-07-10T14:18:34+04:00</updated-at>
    <obligatory type="boolean">false</obligatory>
    <id type="integer">2</id>
    <title></title>
    <destiny type="integer">1</destiny>
    <system-name>state</system-name>
  </field>
  <field>
    <position type="integer">2</position>
    <for-buyer type="boolean">true</for-buyer>
    <example nil="true"></example>
    <office-title>Отчество</office-title>
    <created-at type="datetime" nil="true"></created-at>
    <updated-at type="datetime">2012-06-18T12:42:15+04:00</updated-at>
    <obligatory type="boolean">false</obligatory>
    <id type="integer">150050</id>
    <title></title>
    <destiny type="integer">2</destiny>
    <system-name>middlename</system-name>
  </field>
  <field>
    <position type="integer">2</position>
    <for-buyer type="boolean">true</for-buyer>
    <example nil="true"></example>
    <office-title>Адрес постомата</office-title>
    <created-at type="datetime">2012-03-30T16:55:19+04:00</created-at>
    <updated-at type="datetime">2012-03-30T16:55:19+04:00</updated-at>
    <obligatory type="boolean">false</obligatory>
    <id type="integer">511498</id>
    <title>Адрес постомата</title>
    <destiny type="integer">3</destiny>
    <system-name nil="true"></system-name>
  </field>
  <field>
    <position type="integer">2</position>
    <for-buyer type="boolean">true</for-buyer>
    <example nil="true"></example>
    <office-title>Город</office-title>
    <created-at type="datetime">2010-11-18T00:11:31+03:00</created-at>
    <updated-at type="datetime">2012-07-10T14:18:34+04:00</updated-at>
    <obligatory type="boolean">false</obligatory>
    <id type="integer">3</id>
    <title></title>
    <destiny type="integer">1</destiny>
    <system-name>city</system-name>
  </field>
  <field>
    <position type="integer">3</position>
    <for-buyer type="boolean">true</for-buyer>
    <example></example>
    <office-title>ИНН</office-title>
    <created-at type="datetime">2012-06-18T12:42:06+04:00</created-at>
    <updated-at type="datetime">2012-06-18T12:42:15+04:00</updated-at>
    <obligatory type="boolean">false</obligatory>
    <id type="integer">624245</id>
    <title>ИНН</title>
    <destiny type="integer">2</destiny>
    <system-name nil="true"></system-name>
  </field>
  <field>
    <position type="integer">3</position>
    <for-buyer type="boolean">true</for-buyer>
    <example nil="true"></example>
    <office-title>Адрес</office-title>
    <created-at type="datetime">2010-11-18T00:11:31+03:00</created-at>
    <updated-at type="datetime">2012-07-10T14:18:34+04:00</updated-at>
    <obligatory type="boolean">true</obligatory>
    <id type="integer">4</id>
    <title></title>
    <destiny type="integer">1</destiny>
    <system-name>address</system-name>
  </field>
  <field>
    <position type="integer">4</position>
    <for-buyer type="boolean">true</for-buyer>
    <example nil="true"></example>
    <office-title>Почтовый индекс</office-title>
    <created-at type="datetime">2010-11-18T00:11:31+03:00</created-at>
    <updated-at type="datetime">2012-07-10T14:18:34+04:00</updated-at>
    <obligatory type="boolean">true</obligatory>
    <id type="integer">5</id>
    <title></title>
    <destiny type="integer">1</destiny>
    <system-name>zip</system-name>
  </field>
  <field>
    <position type="integer">4</position>
    <for-buyer type="boolean">true</for-buyer>
    <example>Например: +7(926)111-11-11</example>
    <office-title>Телефон</office-title>
    <created-at type="datetime" nil="true"></created-at>
    <updated-at type="datetime">2012-06-18T12:42:15+04:00</updated-at>
    <obligatory type="boolean">true</obligatory>
    <id type="integer">78672</id>
    <title></title>
    <destiny type="integer">2</destiny>
    <system-name>phone</system-name>
  </field>
  <field>
    <position type="integer">5</position>
    <for-buyer type="boolean">true</for-buyer>
    <example nil="true"></example>
    <office-title>E-mail</office-title>
    <created-at type="datetime" nil="true"></created-at>
    <updated-at type="datetime">2012-06-18T12:42:15+04:00</updated-at>
    <obligatory type="boolean">false</obligatory>
    <id type="integer">93555</id>
    <title></title>
    <destiny type="integer">2</destiny>
    <system-name>email</system-name>
  </field>
  <field>
    <position type="integer">6</position>
    <for-buyer type="boolean">true</for-buyer>
    <example/>
    <office-title>КЛАДР</office-title>
    <created-at type="datetime">2012-05-30T16:49:26+04:00</created-at>
    <updated-at type="datetime">2012-07-09T18:21:43+04:00</updated-at>
    <obligatory type="boolean">true</obligatory>
    <id type="integer">605960</id>
    <title>Адрес</title>
    <destiny type="integer">1</destiny>
    <system-name nil="true"></system-name>
  </field>
  <field>
    <position type="integer">6</position>
    <for-buyer type="boolean">true</for-buyer>
    <example nil="true"></example>
    <office-title>Подтверждение email</office-title>
    <created-at type="datetime" nil="true"></created-at>
    <updated-at type="datetime">2012-06-18T12:42:15+04:00</updated-at>
    <obligatory type="boolean">false</obligatory>
    <id type="integer">105738</id>
    <title></title>
    <destiny type="integer">2</destiny>
    <system-name>email_confirmation</system-name>
  </field>
  <field>
    <position type="integer">7</position>
    <for-buyer type="boolean">true</for-buyer>
    <example nil="true"></example>
    <office-title>Подписка на новости/office-title>
    <created-at type="datetime">2011-03-10T16:38:06+03:00</created-at>
    <updated-at type="datetime">2012-06-18T12:42:15+04:00</updated-at>
    <obligatory type="boolean">false</obligatory>
    <id type="integer">180611</id>
    <title>Подписка на новости</title>
    <destiny type="integer">2</destiny>
    <system-name>subscribe</system-name>
  </field>
  <field>
    <position type="integer">8</position>
    <for-buyer type="boolean">true</for-buyer>
    <example></example>
    <office-title>Статус покупателя</office-title>
    <created-at type="datetime">2011-11-14T13:21:13+04:00</created-at>
    <updated-at type="datetime">2012-06-18T12:42:15+04:00</updated-at>
    <obligatory type="boolean">false</obligatory>
    <id type="integer">389591</id>
    <title>Статус покупателя</title>
    <destiny type="integer">2</destiny>
    <system-name nil="true"></system-name>
  </field>
</objects>

Получение информации

Запрос: GET /admin/fields/#{id}.xml

Ответ:

HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<field>
  <position type="integer">8</position>
  <for-buyer type="boolean">true</for-buyer>
  <example></example>
  <office-title>Статус покупателя</office-title>
  <created-at type="datetime">2011-11-14T13:21:13+04:00</created-at>
  <updated-at type="datetime">2012-06-18T12:42:15+04:00</updated-at>
  <obligatory type="boolean">false</obligatory>
  <id type="integer">389591</id>
  <title>Статус покупателя</title>
  <destiny type="integer">2</destiny>
  <system-name nil="true"></system-name>
</field>

Добавление

Запрос: POST /admin/fields.xml

<field>
  <type>Field::TextField</type>
  <for-buyer type="boolean">true</for-buyer>
  <office-title>Статус покупателя</office-title>
  <obligatory type="boolean">false</obligatory>
  <title>Статус покупателя</title>
  <destiny type="integer">2</destiny>
</field>

Ответ:

HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<field>
  <position type="integer">8</position>
  <for-buyer type="boolean">true</for-buyer>
  <example></example>
  <office-title>Статус покупателя</office-title>
  <created-at type="datetime">2011-11-14T13:21:13+04:00</created-at>
  <updated-at type="datetime">2012-06-18T12:42:15+04:00</updated-at>
  <obligatory type="boolean">false</obligatory>
  <id type="integer">389591</id>
  <title>Статус покупателя</title>
  <destiny type="integer">2</destiny>
  <system-name nil="true"></system-name>
</field>

Удаление

Запрос: DELETE /admin/fields/#{id}.xml

Ответ:

HTTP/1.1 200 OK