1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-12-07 23:03:08 +02:00
Files
OpenIntegrations/docs/en/md/VK/Product-management/Add-product.mdx

94 lines
4.4 KiB
Plaintext
Raw Normal View History

2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 4
2025-05-05 11:15:20 +03:00
description: Add product and other functions to work with VK in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
2025-05-05 09:49:19 +03:00
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, VK]
2024-10-15 10:16:04 +03:00
---
2024-10-15 10:50:56 +03:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-10-15 10:16:04 +03:00
# Add product
Adds a new product to the community's catalog
`Function AddProduct(Val ProductDescription, Val Selection = "", Val Parameters = "") Export`
2024-10-15 15:15:47 +03:00
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| ProductDescription | --product | Map Of KeyAndValue | ✔ | JSON description of the product or path |
| Selection | --sel | String | ✖ | Selection ID for placing the product, if needed |
| Parameters | --auth | Structure Of String | ✖ | Authorization JSON or path to .json |
2024-10-15 10:16:04 +03:00
Returns: Map Of KeyAndValue - serialized JSON response from VK
<br/>
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2024-10-15 10:16:04 +03:00
Parameters = GetVKParameters();
2025-04-16 22:15:09 +03:00
Image1 = "https://api.athenaeum.digital/test_data/picture.jpg"; // URL, Binary or File path
Image2 = "https://api.athenaeum.digital/test_data/picture2.jpg"; // URL, Binary or File path
2025-05-21 08:49:49 +03:00
Selection = "139";
2024-10-15 10:16:04 +03:00
ImageArray = New Array;
ImageArray.Add(Image1);
ImageArray.Add(Image2);
2025-03-06 20:58:59 +03:00
ProductDescription = New Map;
2025-03-06 23:26:18 +03:00
ProductDescription.Insert("Name" , "TestProduct");
ProductDescription.Insert("Description" , "Product description");
ProductDescription.Insert("Category" , "20173");
ProductDescription.Insert("Price" , 1);
ProductDescription.Insert("OldPrice" , 15);
ProductDescription.Insert("MainPhoto" , Image1);
ProductDescription.Insert("URL" , "https://github.com/Bayselonarrend/OpenIntegrations");
ProductDescription.Insert("AdditionalPhotos" , ImageArray);
ProductDescription.Insert("MainInGroup" , True);
ProductDescription.Insert("Width" , 20);
ProductDescription.Insert("Height" , 30);
ProductDescription.Insert("Depth" , 40);
ProductDescription.Insert("Weight" , 100);
ProductDescription.Insert("SKU" , "12345");
ProductDescription.Insert("AvailableBalance" , "10");
2024-10-15 10:16:04 +03:00
Result = OPI_VK.AddProduct(ProductDescription, Selection, Parameters);
```
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
2024-10-22 08:59:24 +03:00
# JSON data can also be passed as a path to a .json file
2024-10-20 22:36:03 +03:00
oint vk AddProduct \
2025-05-21 10:35:46 +03:00
--product "{'Name':'Test product (another)','Description':'Product description','Category':'20173','Price':1,'OldPrice':15,'MainPhoto':'https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg','URL':'https://github.com/Bayselonarrend/OpenIntegrations','AdditionalPhotos':['https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg','https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture2.jpg'],'MainInGroup':true,'GroupNumber':null,'Width':20,'Height':30,'Depth':40,'Weight':100,'SKU':12345,'AvailableBalance':'10','PropertyValues':6215}" \
2024-10-22 08:59:24 +03:00
--auth "{'access_token':'***','owner_id':'-218861756','app_id':'51694790','group_id':'218861756'}"
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
2024-10-22 08:59:24 +03:00
:: JSON data can also be passed as a path to a .json file
2024-10-20 22:36:03 +03:00
oint vk AddProduct ^
2025-05-21 10:35:46 +03:00
--product "{'Name':'Test product (another)','Description':'Product description','Category':'20173','Price':1,'OldPrice':15,'MainPhoto':'https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg','URL':'https://github.com/Bayselonarrend/OpenIntegrations','AdditionalPhotos':['https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg','https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture2.jpg'],'MainInGroup':true,'GroupNumber':null,'Width':20,'Height':30,'Depth':40,'Weight':100,'SKU':12345,'AvailableBalance':'10','PropertyValues':6215}" ^
2024-10-22 08:59:24 +03:00
--auth "{'access_token':'***','owner_id':'-218861756','app_id':'51694790','group_id':'218861756'}"
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
2024-10-15 10:16:04 +03:00
```json title="Result"
{
"response": {
"market_item_id": 9709208
}
}
```