Created
March 22, 2022 19:32
-
-
Save vorvulev/e7c5259d7325cb4cfc61a7e9feeb1196 to your computer and use it in GitHub Desktop.
Insales API products extended
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ИЗМЕНЕНИЕ ПАРАМЕТРОВ ТОВАРА | |
Важный момент: передавать надо все параметры, если ранее установленный параметр не будет передан в запросе, то он будет удален. | |
Запрос: PUT /admin/products/#{id}.xml | |
<?xml version="1.0" encoding="UTF-8"?> | |
<product> | |
<id type="integer">41658</id> | |
<properties-attributes type="array"> | |
<properties-attribute> | |
<title>Бумага</title> | |
<value>в линейку</value> | |
</properties-attribute> | |
</properties-attributes> | |
</product> | |
{ | |
"id": 41658, | |
"properties_attributes": [ | |
{ | |
"title": "Бумага", | |
"value": "в линейку" | |
} | |
] | |
} | |
__________________________________________________________________________________________________________________________________ | |
РУЧНАЯ СОРТИРОВКА ТОВАРОВ | |
Зарос: PUT /admin/collects/#{id}.xml | |
<?xml version="1.0" encoding="UTF-8"?> | |
<collect> | |
<position type="integer">10</position> | |
</collect> | |
{ | |
"position": 10 | |
} | |
__________________________________________________________________________________________________________________________________ | |
ПОЛУЧЕНИЕ СПИСКА ТОВАРОВ С ПАРАМЕТРАМИ | |
Возможные параметры запроса: | |
category_id - идентификатор категории на складе | |
collection_id - идентификатор категории на сайте | |
deleted - получить удаленные товары | |
Запрос: GET /admin/products.xml?category_id=478 | |
__________________________________________________________________________________________________________________________________ | |
ДОБАВЛЕНИЕ ТОВАРА С ПАРАМЕТРАМИ | |
Запрос: 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> | |
<properties-attributes type="array"> | |
<properties-attribute> | |
<title>Бумага</title> | |
<value>в линейку</value> | |
</properties-attribute> | |
</properties-attributes> | |
<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-attributes> | |
</product> | |
{ | |
"category_id": 478, | |
"title": "Van Gogh Ruled Peach Notebook", | |
"description": "<p><span style=\"font-family: 'Times New Roman'; font-size: 16px;\"></span></p>", | |
"short_description": "Алая записная книжка \"Ван Гог\" в линейку", | |
"properties_attributes": [ | |
{ | |
"title": "Бумага", | |
"value": "в линейку" | |
} | |
], | |
"variants_attributes": [ | |
{ | |
"sku": "QP021MVEN-r", | |
"price": 740, | |
"cost_price": 487 | |
} | |
] | |
} | |
__________________________________________________________________________________________________________________________________ | |
ДОБАВЛЕНИЕ ТОВАРА СО СВОЙСТВАМИ | |
Запрос: 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> | |
<title>Размер</title> | |
<value>XL</value> | |
</option> | |
<option> | |
<title>Цвет</title> | |
<value>белый</value> | |
</option> | |
</options> | |
<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-attributes> | |
</product> | |
{ | |
"category_id": 478, | |
"is_hidden": false, | |
"title": "Модная майка", | |
"options": [ | |
{ | |
"title": "Размер", | |
"value": "XL" | |
}, | |
{ | |
"title": "Цвет", | |
"value": "Белый" | |
} | |
], | |
"variants_attributes": [ | |
{ | |
"price": 740, | |
"old_price": 1000, | |
"cost_price": 487, | |
"quantity": 10 | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment