InSales API - Widgets — различия между версиями

Материал из Insales Wiki
Перейти к: навигация, поиск
(Добавление)
Строка 8: Строка 8:
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<widgets type="array">
 
<widgets type="array">
    <widget>
+
  <widget>
        <created-at type="datetime">2012-08-09T00:36:54+04:00</created-at>
+
    <created-at type="datetime">2012-08-09T00:36:54+04:00</created-at>
        <id type="integer">1</id>
+
    <id type="integer">1</id>
        <widget-code>&lt;script&gt;alert(order_info.referer);&lt;/script&gt;</widget-code>
+
    <widget-code>&lt;script&gt;alert(order_info.referer);&lt;/script&gt;</widget-code>
    </widget>
+
  </widget>
    <widget>
+
  <widget>
        <created-at type="datetime">2012-08-09T00:36:54+04:00</created-at>
+
    <created-at type="datetime">2012-08-09T00:36:54+04:00</created-at>
        <id type="integer">2</id>
+
    <id type="integer">2</id>
        <widget-code>some widget code here</widget-code>
+
    <widget-code>some widget code here</widget-code>
    </widget>
+
  </widget>
 
</widgets>
 
</widgets>
 
</pre>
 
</pre>
Строка 31: Строка 31:
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<widget>
 
<widget>
    <created-at type="datetime">2012-08-09T00:36:54+04:00</created-at>
+
  <created-at type="datetime">2012-08-09T00:36:54+04:00</created-at>
    <id type="integer">1</id>
+
  <id type="integer">1</id>
    <widget-code><script>alert(order_info.referer);</script></widget-code>
+
  <widget-code><script>alert(order_info.referer);</script></widget-code>
 
</widget>
 
</widget>
 
</pre>
 
</pre>
Строка 51: Строка 51:
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<widget>
 
<widget>
    <created-at type="datetime">2012-08-09T17:26:48+04:00</created-at>
+
  <created-at type="datetime">2012-08-09T17:26:48+04:00</created-at>
    <id type="integer">6</id>
+
  <id type="integer">6</id>
    <widget-code>some html or javascript code</widget-code>
+
  <widget-code>some html or javascript code</widget-code>
 
</widget>
 
</widget>
 
</pre>
 
</pre>

Версия 13:33, 9 августа 2012

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

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

Ответ:

HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<widgets type="array">
  <widget>
    <created-at type="datetime">2012-08-09T00:36:54+04:00</created-at>
    <id type="integer">1</id>
    <widget-code><script>alert(order_info.referer);</script></widget-code>
  </widget>
  <widget>
    <created-at type="datetime">2012-08-09T00:36:54+04:00</created-at>
    <id type="integer">2</id>
    <widget-code>some widget code here</widget-code>
  </widget>
</widgets>


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

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

Ответ:

HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<widget>
  <created-at type="datetime">2012-08-09T00:36:54+04:00</created-at>
  <id type="integer">1</id>
  <widget-code><script>alert(order_info.referer);</script></widget-code>
</widget>

Добавление

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

<widget>
  <widget-code>some html or javascript code</widget-code>
</widget>

Ответ:

HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<widget>
  <created-at type="datetime">2012-08-09T17:26:48+04:00</created-at>
  <id type="integer">6</id>
  <widget-code>some html or javascript code</widget-code>
</widget>