InSales API - Товары — различия между версиями
Материал из Insales Wiki
Vb (обсуждение | вклад) |
Vb (обсуждение | вклад) (→Добавление товара) |
||
Строка 184: | Строка 184: | ||
=Добавление товара= | =Добавление товара= | ||
− | ==Добавление товара | + | ==Добавление товара== |
Запрос: POST /admin/products.xml | Запрос: POST /admin/products.xml | ||
Строка 194: | Строка 194: | ||
<description>&lt;p&gt;&lt;span style=&quot;font-family: 'Times New Roman'; font-size: 16px;&quot;&gt; &lt;/span&gt;&lt;/p&gt;</description> | <description>&lt;p&gt;&lt;span style=&quot;font-family: 'Times New Roman'; font-size: 16px;&quot;&gt; &lt;/span&gt;&lt;/p&gt;</description> | ||
<short-description>Алая записная книжка "Ван Гог" в линейку</short-description> | <short-description>Алая записная книжка "Ван Гог" в линейку</short-description> | ||
− | <variants type="array"> | + | <variants-attributes type="array"> |
<variant> | <variant> | ||
<sku>QP021MVEN-r</sku> | <sku>QP021MVEN-r</sku> | ||
Строка 256: | Строка 256: | ||
</pre> | </pre> | ||
− | ==Добавление товара | + | ==Добавление товара со свойствами== |
Запрос: POST /admin/products.xml | Запрос: POST /admin/products.xml | ||
Строка 275: | Строка 275: | ||
</option-name> | </option-name> | ||
</option-names> | </option-names> | ||
− | <variants type="array"> | + | <variants-attributes type="array"> |
<variant> | <variant> | ||
<cost-price type="decimal">487.0</cost-price> | <cost-price type="decimal">487.0</cost-price> |
Версия 08:29, 13 мая 2011
Содержание
Получение списка товаров
Возможные параметры запроса:
- category_id - идентификатор категории на складе
- collection_id - идентификатор категории на сайте
Запрос: GET /admin/products.xml?category_id=478
Ответ:
HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <products type="array"> <product> <category-id type="integer">478</category-id> <created-at type="timestamp">2009-06-04 14:22:34 +0400</created-at> <id type="integer">41658</id> <is-hidden type="boolean">false</is-hidden> <updated-at type="timestamp">2010-07-14 13:40:01 +0400</updated-at> <title>Van Gogh Ruled Peach Notebook</title> <description><p><span style="font-family: 'Times New Roman'; font-size: 16px;"> </span></p></description> <short-description>Алая записная книжка "Ван Гог" в линейку</short-description> <permalink>Van-Gogh-Ruled-Rose-Notebook</permalink> <html-title nil="true"/> <meta-keywords nil="true"/> <meta-description nil="true"/> <option-names type="array"> <option-name> <id type="integer">1171</id> <position type="integer">1</position> <title>Модификация</title> </option-name> </option-names> <images type="array"> <image> <created-at type="timestamp">2009-06-04 14:22:34 +0400</created-at> <id type="integer">24690</id> <position type="integer">1</position> <url>http://static.insales.ru/images/products/24690/thumb/vangogh-red.jpg</url> <title nil="true"/> </image> </images> <variants type="array"> <variant> <cost-price type="decimal">487.0</cost-price> <created-at type="timestamp">2009-06-04 14:22:34 +0400</created-at> <id type="integer">48136</id> <old-price type="decimal" nil="true"/> <price type="decimal">740.0</price> <product-id type="integer">41658</product-id> <quantity type="integer" nil="true"/> <sku>QP021MVEN-r</sku> <updated-at type="timestamp">2010-07-16 13:20:04 +0400</updated-at> <title>Базовая</title> <option-values type="array"> <option-value> <id type="integer">5649</id> <option-name-id type="integer">1171</option-name-id> <position type="integer">1</position> <title>Базовая</title> </option-value> </option-values> </variant> </variants> </product> <product> <category-id type="integer">478</category-id> <created-at type="timestamp">2009-04-10 00:00:05 +0400</created-at> <id type="integer">15757</id> <is-hidden type="boolean">false</is-hidden> <updated-at type="timestamp">2009-12-08 14:58:34 +0300</updated-at> <title>Van Gogh Sketchbook Peach</title> <description nil="true" /> <short-description>Персиковая записная книжка "Ван Гог" для рисунков</short-description> <permalink>Van-Gogh-Sketchbook-Peach</permalink> <html-title nil="true"/> <meta-keywords nil="true"/> <meta-description nil="true"/> <option-names type="array"> <option-name> <id type="integer">1171</id> <position type="integer">1</position> <title>Модификация</title> </option-name> </option-names> <images type="array"> <image> <created-at type="timestamp">2009-04-10 00:00:05 +0400</created-at> <id type="integer">13886</id> <position type="integer">1</position> <url>http://static.insales.ru/images/products/13886/thumb/vangogh-orange.jpg</url> <title nil="true"/> </image> </images> <variants type="array"> <variant> <cost-price type="decimal">487.0</cost-price> <created-at type="timestamp">2009-04-10 00:00:05 +0400</created-at> <id type="integer">16638</id> <old-price type="decimal" nil="true"/> <price type="decimal">740.0</price> <product-id type="integer">15757</product-id> <quantity type="integer">0</quantity> <sku>QP023MVEN-o</sku> <updated-at type="timestamp">2010-07-16 13:20:05 +0400</updated-at> <title>Базовая</title> <option-values type="array"> <option-value> <id type="integer">5649</id> <option-name-id type="integer">1171</option-name-id> <position type="integer">1</position> <title>Базовая</title> </option-value> </option-values> </variant> </variants> </product> </products>
Получение информации о товаре
Запрос: GET /admin/products/#{id}.xml
Ответ:
HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <product> <category-id type="integer">478</category-id> <created-at type="timestamp">2009-06-04 14:22:34 +0400</created-at> <id type="integer">41658</id> <is-hidden type="boolean">false</is-hidden> <updated-at type="timestamp">2010-07-14 13:40:01 +0400</updated-at> <title>Van Gogh Ruled Peach Notebook</title> <description><p><span style="font-family: 'Times New Roman'; font-size: 16px;"> </span></p></description> <short-description>Алая записная книжка "Ван Гог" в линейку</short-description> <permalink>Van-Gogh-Ruled-Rose-Notebook</permalink> <html-title nil="true"/> <meta-keywords nil="true"/> <meta-description nil="true"/> <option-names type="array"> <option-name> <id type="integer">1171</id> <position type="integer">1</position> <title>Модификация</title> </option-name> </option-names> <images type="array"> <image> <created-at type="timestamp">2009-06-04 14:22:34 +0400</created-at> <id type="integer">24690</id> <position type="integer">1</position> <url>http://static.insales.ru/images/products/24690/thumb/vangogh-red.jpg</url> <title nil="true"/> </image> </images> <variants type="array"> <variant> <cost-price type="decimal">487.0</cost-price> <created-at type="timestamp">2009-06-04 14:22:34 +0400</created-at> <id type="integer">48136</id> <old-price type="decimal" nil="true"/> <price type="decimal">740.0</price> <product-id type="integer">41658</product-id> <quantity type="integer" nil="true"/> <sku>QP021MVEN-r</sku> <updated-at type="timestamp">2010-07-16 13:20:04 +0400</updated-at> <title>Базовая</title> <option-values type="array"> <option-value> <id type="integer">5649</id> <option-name-id type="integer">1171</option-name-id> <position type="integer">1</position> <title>Базовая</title> </option-value> </option-values> </variant> </variants> </product>
Добавление товара
Добавление товара
Запрос: POST /admin/products.xml
<?xml version="1.0" encoding="UTF-8"?> <product> <category-id type="integer">478</category-id> <title>Van Gogh Ruled Peach Notebook</title> <description><p><span style="font-family: 'Times New Roman'; font-size: 16px;"> </span></p></description> <short-description>Алая записная книжка "Ван Гог" в линейку</short-description> <variants-attributes type="array"> <variant> <sku>QP021MVEN-r</sku> <quantity type="integer" nil="true"/> <price type="decimal">740.0</price> <cost-price type="decimal">487.0</cost-price> <old-price type="decimal" nil="true"/> </variant> </variants> </product>
Ответ:
HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <product> <category-id type="integer">478</category-id> <created-at type="timestamp">2009-06-04 14:22:34 +0400</created-at> <id type="integer">41658</id> <is-hidden type="boolean">false</is-hidden> <updated-at type="timestamp">2010-07-14 13:40:01 +0400</updated-at> <title>Van Gogh Ruled Peach Notebook</title> <description><p><span style="font-family: 'Times New Roman'; font-size: 16px;"> </span></p></description> <short-description>Алая записная книжка "Ван Гог" в линейку</short-description> <permalink>Van-Gogh-Ruled-Rose-Notebook</permalink> <html-title nil="true"/> <meta-keywords nil="true"/> <meta-description nil="true"/> <option-names type="array"> <option-name> <id type="integer">1171</id> <position type="integer">1</position> <title>Модификация</title> </option-name> </option-names> <images type="array" /> <variants type="array"> <variant> <cost-price type="decimal">487.0</cost-price> <created-at type="timestamp">2009-06-04 14:22:34 +0400</created-at> <id type="integer">48136</id> <old-price type="decimal" nil="true"/> <price type="decimal">740.0</price> <product-id type="integer">41658</product-id> <quantity type="integer" nil="true"/> <sku>QP021MVEN-r</sku> <updated-at type="timestamp">2010-07-16 13:20:04 +0400</updated-at> <title>Базовая</title> <option-values type="array"> <option-value> <id type="integer">5649</id> <option-name-id type="integer">1171</option-name-id> <position type="integer">1</position> <title>Базовая</title> </option-value> </option-values> </variant> </variants> </product>
Добавление товара со свойствами
Запрос: POST /admin/products.xml
<?xml version="1.0" encoding="UTF-8"?> <product> <category-id type="integer">478</category-id> <is-hidden type="boolean">false</is-hidden> <title>Модная майка</title> <options type="array"> <option-name> <title>Размер</title> <value>XL</value> </option-name> <option-name> <title>Цвет</title> <value>белый</value> </option-name> </option-names> <variants-attributes type="array"> <variant> <cost-price type="decimal">487.0</cost-price> <old-price type="decimal">1000</old-price> <price type="decimal">740.0</price> <quantity type="integer">10</quantity> </variant> </variants> </product>
Ответ:
HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <product> <id type="integer">41658</id> <category-id type="integer">478</category-id> <created-at type="timestamp">2009-06-04 14:22:34 +0400</created-at> <is-hidden type="boolean">false</is-hidden> <updated-at type="timestamp">2010-07-14 13:40:01 +0400</updated-at> <title>Майка</title> <description nil="true"> <short-description nil="true"> <permalink>Majka</permalink> <html-title nil="true"/> <meta-keywords nil="true"/> <meta-description nil="true"/> <option-names type="array"> <option-name> <id type="integer">1171</id> <position type="integer">1</position> <title>Размер</title> </option-name> <option-name> <id type="integer">1172</id> <position type="integer">2</position> <title>Цвет</title> </option-name> </option-names> <images type="array" /> <variants type="array"> <variant> <id type="integer">48136</id> <product-id type="integer">41658</product-id> <cost-price type="decimal">487.0</cost-price> <old-price type="decimal">1000</old-price> <price type="decimal">740.0</price> <quantity type="integer">10</quantity> <sku nil="true" /> <title>XL/белый</title> <created-at type="timestamp">2009-06-04 14:22:34 +0400</created-at> <updated-at type="timestamp">2010-07-16 13:20:04 +0400</updated-at> <option-values type="array"> <option-value> <id type="integer">5649</id> <option-name-id type="integer">1171</option-name-id> <position type="integer">1</position> <value>XL</value> </option-value> <option-value> <id type="integer">5650</id> <option-name-id type="integer">1172</option-name-id> <position type="integer">1</position> <value>белый</value> </option-value> </option-values> </variant> </variants> </product>
Редактирование товара
Запрос: PUT /admin/products/#{id}.xml
<?xml version="1.0" encoding="UTF-8"?> <product> <id type="integer">41658</id> <title>Van Gogh Ruled Peach Notebook</title> </product>
Ответ:
HTTP/1.1 200 OK <?xml version="1.0" encoding="UTF-8"?> <product> <category-id type="integer">478</category-id> <created-at type="timestamp">2009-06-04 14:22:34 +0400</created-at> <id type="integer">41658</id> <is-hidden type="boolean">false</is-hidden> <updated-at type="timestamp">2010-07-14 13:40:01 +0400</updated-at> <title>Van Gogh Ruled Peach Notebook</title> <description><p><span style="font-family: 'Times New Roman'; font-size: 16px;"> </span></p></description> <short-description>Алая записная книжка "Ван Гог" в линейку</short-description> <permalink>Van-Gogh-Ruled-Rose-Notebook</permalink> <html-title nil="true"/> <meta-keywords nil="true"/> <meta-description nil="true"/> <option-names type="array"> <option-name> <id type="integer">1171</id> <position type="integer">1</position> <title>Модификация</title> </option-name> </option-names> <images type="array"> <image> <created-at type="timestamp">2009-06-04 14:22:34 +0400</created-at> <id type="integer">24690</id> <position type="integer">1</position> <url>http://static.insales.ru/images/products/24690/thumb/vangogh-red.jpg</url> <title nil="true"/> </image> </images> <variants type="array"> <variant> <cost-price type="decimal">487.0</cost-price> <created-at type="timestamp">2009-06-04 14:22:34 +0400</created-at> <id type="integer">48136</id> <old-price type="decimal" nil="true"/> <price type="decimal">740.0</price> <product-id type="integer">41658</product-id> <quantity type="integer" nil="true"/> <sku>QP021MVEN-r</sku> <updated-at type="timestamp">2010-07-16 13:20:04 +0400</updated-at> <title>Базовая</title> <option-values type="array"> <option-value> <id type="integer">5649</id> <option-name-id type="integer">1171</option-name-id> <position type="integer">1</position> <title>Базовая</title> </option-value> </option-values> </variant> </variants> </product>
Удаление товара
Запрос: DELETE /admin/products/#{id}.xml
Ответ:
HTTP/1.1 200 OK