1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2024-12-02 09:21:37 +02:00
OpenIntegrations/docs/en/md/VK/Product-management/Add-product.mdx

70 lines
2.2 KiB
Plaintext
Raw Normal View History

2024-10-15 09:50:56 +02:00
---
2024-10-15 09:16:04 +02:00
sidebar_position: 4
---
2024-10-15 09:50:56 +02:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-10-15 09:16:04 +02:00
# Add product
Adds a new product to the community's catalog
`Function AddProduct(Val ProductDescription, Val Selection = "", Val Parameters = "") Export`
2024-10-15 14:15:47 +02: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 09:16:04 +02:00
Returns: Map Of KeyAndValue - serialized JSON response from VK
<br/>
2024-10-15 20:15:56 +02:00
```bsl title="1C:Enterprise/OneScript code example"
2024-10-15 09:16:04 +02:00
Parameters = GetVKParameters();
Image1 = "https://api.athenaeum.digital/test_data/picture.jpg"; // URL, Binary or Path to file
Image2 = "https://api.athenaeum.digital/test_data/picture2.jpg"; // URL, Binary or Path to file
Selection = "130";
ImageArray = New Array;
ImageArray.Add(Image1);
ImageArray.Add(Image2);
ProductDescription = New Map();
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");
Result = OPI_VK.AddProduct(ProductDescription, Selection, Parameters);
```
```json title="Result"
{
"response": {
"market_item_id": 9709208
}
}
```