InSales API - Заказы

Материал из Insales Wiki
Перейти к: навигация, поиск

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

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

Ответ:

HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<orders type="array">
    <order>
        <accepted-at type="timestamp" nil="true"/>
        <comment/>
        <created-at type="timestamp">2010-08-16 18:39:58 +0400</created-at>
        <delivered-at type="timestamp">2010-08-19 10:26:16 +0400</delivered-at>
        <delivery-description>
            Самовывоз + скидка 2%, тк. до этого делала зказ свыше 2 тысяч
        </delivery-description>
        <delivery-price type="decimal">0.0</delivery-price>
        <financial-status>paid</financial-status>
        <fulfillment-status>delivered</fulfillment-status>
        <id type="integer">36289</id>
        <key>c6a090e74498a8e18d78f2f1424ffa5e</key>
        <number type="integer">2900</number>
        <payment-description nil="true"/>
        <payment-title>Наличными</payment-title>
        <referer/>
        <updated-at type="timestamp">2010-08-19 10:26:16 +0400</updated-at>
        <shipping-address>
            <address>Самовывоз</address>
            <city>Москва</city>
            <country>RU</country>
            <name>Самовывоз</name>
            <phone>Самовывоз</phone>
            <state>Московская область</state>
            <zip nil="true"/>
        </shipping-address>
        <order-lines type="array">
            <order-line>
                <created-at type="timestamp">2010-08-16 18:39:58 +0400</created-at>
                <id type="integer">94695</id>
                <quantity type="integer">1</quantity>
                <sale-price type="decimal">740.0</sale-price>
                <sku>QP023MVEN-g</sku>
                <title>Van Gogh Sketchbook Emerald</title>
                <updated-at type="timestamp">2010-08-16 18:39:58 +0400</updated-at>
                <variant-id type="integer">16637</variant-id>
            </order-line>
        </order-lines>
        <discounts type="array">
            <discount>
                <created-at type="timestamp">2010-08-19 10:25:51 +0400</created-at>
                <description>2%</description>
                <id type="integer">3347</id>
                <updated-at type="timestamp">2010-08-19 10:25:51 +0400</updated-at>
                <amount type="integer">15</amount>
            </discount>
        </discounts>
        <client>
            <client-group-id type="integer" nil="true"/>
            <created-at type="timestamp">2010-08-16 18:39:58 +0400</created-at>
            <email nil="true"/>
            <id type="integer">36854</id>
            <name>Самовывоз</name>
            <phone>Самовывоз</phone>
            <registered type="boolean">false</registered>
            <subscribe type="boolean">true</subscribe>
            <updated-at type="timestamp">2010-08-16 18:39:58 +0400</updated-at>
        </client>
    </order>
    <order>
        <accepted-at type="timestamp" nil="true"/>
        <comment/>
        <created-at type="timestamp">2010-08-16 14:39:46 +0400</created-at>
        <delivered-at type="timestamp">2010-08-19 10:25:11 +0400</delivered-at>
        <delivery-description>Курьером по Москве (на следующий рабочий день)</delivery-description>
        <delivery-price type="decimal">200.0</delivery-price>
        <financial-status>paid</financial-status>
        <fulfillment-status>delivered</fulfillment-status>
        <id type="integer">36228</id>
        <key>93dc91ffaa5d48025c38d4663f2adb93</key>
        <number type="integer">2899</number>
        <payment-description nil="true"/>
        <payment-title>Наличными</payment-title>
        <referer>
            http://www.google.ru/search?hl=ru&newwindow=1&q=%D0%B7%D0%B0%D0%BF%D0%B8%D1%81%D0%BD%D0%B0%D1%8F+%D0%BA%D0%BD%D0%B8%D0%B6%D0%BA%D0%B0+%D0%BA%D1%83%D0%BF%D0%B8%D1%82%D1%8C&lr=&aq=f&aqi=&aql=&oq=&gs_rfai=
        </referer>
        <updated-at type="timestamp">2010-08-19 10:25:11 +0400</updated-at>
        <shipping-address>
            <address>ул. Ленина д. 12</address>
            <city>Москва</city>
            <country>RU</country>
            <name>Артем Демидчик</name>
            <phone>8 915 123 45 67</phone>
            <state>Московская область</state>
            <zip nil="true"/>
        </shipping-address>
        <order-lines type="array">
            <order-line>
                <created-at type="timestamp">2010-08-16 16:04:40 +0400</created-at>
                <id type="integer">94612</id>
                <quantity type="integer">1</quantity>
                <sale-price type="decimal">720.0</sale-price>
                <sku>QP617EN</sku>
                <title>Moleskine Soft Large Squared Notebook</title>
                <updated-at type="timestamp">2010-08-16 16:04:40 +0400</updated-at>
                <variant-id type="integer">16325</variant-id>
            </order-line>
        </order-lines>
        <discounts type="array"/>
        <client>
            <client-group-id type="integer" nil="true"/>
            <created-at type="timestamp">2010-08-16 14:39:46 +0400</created-at>
            <email>artem@gmail.com</email>
            <id type="integer">36794</id>
            <name>Артем Демидчик</name>
            <phone>8 915 123 45 67</phone>
            <registered type="boolean">true</registered>
            <subscribe type="boolean">true</subscribe>
            <updated-at type="timestamp">2010-08-16 14:39:46 +0400</updated-at>
        </client>
    </order>
    <order>
        <accepted-at type="timestamp">2010-08-16 14:31:01 +0400</accepted-at>
        <comment/>
        <created-at type="timestamp">2010-08-16 14:14:50 +0400</created-at>
        <delivered-at type="timestamp" nil="true"/>
        <delivery-description>
            Самовывоз (Бронь заказа не более 2 дней, забор  с 10 до 18  часов по рабочим дням, адрес см. на сайте магазина)
        </delivery-description>
        <delivery-price type="decimal">0.0</delivery-price>
        <financial-status>pending</financial-status>
        <fulfillment-status>approved</fulfillment-status>
        <id type="integer">36218</id>
        <key>4ecee989d7e429bf55cead7cdc616adf</key>
        <number type="integer">2898</number>
        <payment-description nil="true"/>
        <payment-title>Наличными</payment-title>
        <referer>
            http://yandex.ru/yandsearch?text=%D0%B1%D0%BB%D0%BE%D0%BA%D0%BD%D0%BE%D1%82%D1%8B+moleskine&lr=213
        </referer>
        <updated-at type="timestamp">2010-08-20 15:25:02 +0400</updated-at>
        <shipping-address>
            <address>Рязанский проспект 12</address>
            <city>Москва</city>
            <country>RU</country>
            <name>Слесарев Игорь</name>
            <phone>+7 903 321-54-76</phone>
            <state>Московская область</state>
            <zip nil="true"/>
        </shipping-address>
        <order-lines type="array">
            <order-line>
                <created-at type="timestamp">2010-08-16 14:14:50 +0400</created-at>
                <id type="integer">94519</id>
                <quantity type="integer">1</quantity>
                <sale-price type="decimal">1590.0</sale-price>
                <sku>DHB12DC5QEN</sku>
                <title>Ежедневник "Classic" (2011), A4, черный</title>
                <updated-at type="timestamp">2010-08-16 14:14:50 +0400</updated-at>
                <variant-id type="integer">1199651</variant-id>
            </order-line>
        </order-lines>
        <discounts type="array"/>
        <client>
            <client-group-id type="integer" nil="true"/>
            <created-at type="timestamp">2010-08-16 14:14:50 +0400</created-at>
            <email>igor@yandex.ru</email>
            <id type="integer">36784</id>
            <name>Слесарев Игорь</name>
            <phone>+7 903 321-54-65</phone>
            <registered type="boolean">true</registered>
            <subscribe type="boolean">true</subscribe>
            <updated-at type="timestamp">2010-08-16 14:14:50 +0400</updated-at>
        </client>
    </order>
</orders>

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

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

Ответ:

HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<order>
    <accepted-at type="timestamp" nil="true"/>
    <comment/>
    <created-at type="timestamp">2010-08-16 18:39:58 +0400</created-at>
    <delivered-at type="timestamp">2010-08-19 10:26:16 +0400</delivered-at>
    <delivery-description>
        Самовывоз + скидка 2%, тк. до этого делала зказ свыше 2 тысяч
    </delivery-description>
    <delivery-price type="decimal">0.0</delivery-price>
    <financial-status>paid</financial-status>
    <fulfillment-status>delivered</fulfillment-status>
    <id type="integer">36289</id>
    <key>c6a090e74498a8e18d78f2f1424ffa5e</key>
    <number type="integer">2900</number>
    <payment-description nil="true"/>
    <payment-title>Наличными</payment-title>
    <referer/>
    <updated-at type="timestamp">2010-08-19 10:26:16 +0400</updated-at>
    <shipping-address>
        <address>Самовывоз</address>
        <city>Москва</city>
        <country>RU</country>
        <name>Самовывоз</name>
        <phone>Самовывоз</phone>
        <state>Московская область</state>
        <zip nil="true"/>
    </shipping-address>
    <order-lines type="array">
        <order-line>
            <created-at type="timestamp">2010-08-16 18:39:58 +0400</created-at>
            <id type="integer">94695</id>
            <quantity type="integer">1</quantity>
            <sale-price type="decimal">740.0</sale-price>
            <sku>QP023MVEN-g</sku>
            <title>Van Gogh Sketchbook Emerald</title>
            <updated-at type="timestamp">2010-08-16 18:39:58 +0400</updated-at>
            <variant-id type="integer">16637</variant-id>
        </order-line>
    </order-lines>
    <discounts type="array">
        <discount>
            <created-at type="timestamp">2010-08-19 10:25:51 +0400</created-at>
            <description>2%</description>
            <id type="integer">3347</id>
            <updated-at type="timestamp">2010-08-19 10:25:51 +0400</updated-at>
            <amount type="integer">15</amount>
        </discount>
    </discounts>
    <client>
        <client-group-id type="integer" nil="true"/>
        <created-at type="timestamp">2010-08-16 18:39:58 +0400</created-at>
        <email nil="true"/>
        <id type="integer">36854</id>
        <name>Самовывоз</name>
        <phone>Самовывоз</phone>
        <registered type="boolean">false</registered>
        <subscribe type="boolean">true</subscribe>
        <updated-at type="timestamp">2010-08-16 18:39:58 +0400</updated-at>
    </client>
</order>

Редактирование заказа

Запрос: PUT /admin/orders/#{id}.xml

<order>
    <id type="integer">36289</id>
    <comment>
        Перезвонить завтра
    </comment>
</order>

Ответ:

HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<order>
    <accepted-at type="timestamp" nil="true"/>
    <comment>
        Перезвонить завтра
    </comment>
    <created-at type="timestamp">2010-08-16 18:39:58 +0400</created-at>
    <delivered-at type="timestamp">2010-08-19 10:26:16 +0400</delivered-at>
    <delivery-description>
        Самовывоз + скидка 2%, тк. до этого делала зказ свыше 2 тысяч
    </delivery-description>
    <delivery-price type="decimal">0.0</delivery-price>
    <financial-status>paid</financial-status>
    <fulfillment-status>delivered</fulfillment-status>
    <id type="integer">36289</id>
    <key>c6a090e74498a8e18d78f2f1424ffa5e</key>
    <number type="integer">2900</number>
    <payment-description nil="true"/>
    <payment-title>Наличными</payment-title>
    <referer/>
    <updated-at type="timestamp">2010-08-19 10:26:16 +0400</updated-at>
    <shipping-address>
        <address>Самовывоз</address>
        <city>Москва</city>
        <country>RU</country>
        <name>Самовывоз</name>
        <phone>Самовывоз</phone>
        <state>Московская область</state>
        <zip nil="true"/>
    </shipping-address>
    <order-lines type="array">
        <order-line>
            <created-at type="timestamp">2010-08-16 18:39:58 +0400</created-at>
            <id type="integer">94695</id>
            <quantity type="integer">1</quantity>
            <sale-price type="decimal">740.0</sale-price>
            <sku>QP023MVEN-g</sku>
            <title>Van Gogh Sketchbook Emerald</title>
            <updated-at type="timestamp">2010-08-16 18:39:58 +0400</updated-at>
            <variant-id type="integer">16637</variant-id>
        </order-line>
    </order-lines>
    <discounts type="array">
        <discount>
            <created-at type="timestamp">2010-08-19 10:25:51 +0400</created-at>
            <description>2%</description>
            <id type="integer">3347</id>
            <updated-at type="timestamp">2010-08-19 10:25:51 +0400</updated-at>
            <amount type="integer">15</amount>
        </discount>
    </discounts>
    <client>
        <client-group-id type="integer" nil="true"/>
        <created-at type="timestamp">2010-08-16 18:39:58 +0400</created-at>
        <email nil="true"/>
        <id type="integer">36854</id>
        <name>Самовывоз</name>
        <phone>Самовывоз</phone>
        <registered type="boolean">false</registered>
        <subscribe type="boolean">true</subscribe>
        <updated-at type="timestamp">2010-08-16 18:39:58 +0400</updated-at>
    </client>
</order>

Удаление заказа

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

Ответ:

HTTP/1.1 200 OK