﻿---
sidebar_position: 4
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
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, VK]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Add product
 Adds a new product to the community's catalog



`Function AddProduct(Val ProductDescription, Val Selection = "", Val Parameters = "") Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | ProductDescription | --product | Map Of KeyAndValue | &#x2714; | JSON description of the product or path |
  | Selection | --sel | String | &#x2716; | Selection ID for placing the product, if needed |
  | Parameters | --auth | Structure Of String | &#x2716; | Authorization JSON or path to .json |

  
  Returns:  Map Of KeyAndValue - serialized JSON response from VK

<br/>




```bsl title="1C:Enterprise/OneScript code example"
    Parameters = GetVKParameters();

    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
    Selection = "139";

    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);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint vk AddProduct \
             --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}" \
             --auth "{'access_token':'***','owner_id':'-218861756','app_id':'51694790','group_id':'218861756'}"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            :: JSON data can also be passed as a path to a .json file
            
            oint vk AddProduct ^
             --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}" ^
             --auth "{'access_token':'***','owner_id':'-218861756','app_id':'51694790','group_id':'218861756'}"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "response": {
  "market_item_id": 9709208
 }
}
```
