2024-06-05 10:19:46 +00:00
|
|
|
---
|
|
|
|
sidebar_position: 4
|
|
|
|
---
|
|
|
|
|
|
|
|
# Add product
|
|
|
|
Adds a new product to the community's catalog
|
|
|
|
|
|
|
|
|
2024-07-10 11:59:55 +03:00
|
|
|
|
2024-07-10 13:58:29 +03:00
|
|
|
`Function AddProduct(Val ProductDescription, Val Selection = "", Val Parameters = "") Export`
|
2024-06-05 10:19:46 +00:00
|
|
|
|
2024-08-13 15:52:26 +03:00
|
|
|
| Parameter | CLI option | Type | 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-06-05 10:19:46 +00:00
|
|
|
|
2024-08-13 15:52:26 +03:00
|
|
|
|
|
|
|
Returns: Map Of KeyAndValue - Serialized JSON response from VK
|
2024-06-05 10:19:46 +00:00
|
|
|
|
2024-07-10 14:05:58 +03:00
|
|
|
<br/>
|
2024-07-10 11:59:55 +03:00
|
|
|
|
2024-07-10 13:58:29 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-05 10:19:46 +00:00
|
|
|
```bsl title="Code example"
|
2024-08-13 16:47:32 +03:00
|
|
|
Parameters = GetVKParameters();
|
|
|
|
|
2024-08-20 13:11:21 +03:00
|
|
|
Image1 = "https://openintegrations.dev/test_data/picture.jpg"; // URL, Path to file or binary Data
|
|
|
|
Image2 = "https://openintegrations.dev/test_data/picture2.jpg"; // URL, Path to file or binary Data
|
|
|
|
Selection = "123";
|
2024-08-13 16:47:32 +03:00
|
|
|
|
|
|
|
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);
|
2024-06-05 10:19:46 +00:00
|
|
|
```
|
2024-08-13 15:52:26 +03:00
|
|
|
|
2024-07-10 11:59:55 +03:00
|
|
|
|
2024-06-05 10:19:46 +00:00
|
|
|
|
|
|
|
```sh title="CLI command example"
|
2024-08-13 15:52:26 +03:00
|
|
|
|
|
|
|
oint vk AddProduct --product %product% --sel "125" --auth "GetVKParameters()"
|
2024-06-05 10:19:46 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```json title="Result"
|
2024-08-14 09:06:31 +03:00
|
|
|
{
|
2024-08-13 15:52:26 +03:00
|
|
|
"response": {
|
|
|
|
"market_item_id": 8656047
|
|
|
|
}
|
|
|
|
}
|
2024-06-05 10:19:46 +00:00
|
|
|
```
|