﻿---
sidebar_position: 7
---

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

# Create story
 Creates a story from an image



`Function CreateStory(Val Image, Val URL = "", Val Parameters = "") Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | Image | --picture | String, BinaryData | &#x2714; | Story background |
  | URL | --url | String | &#x2716; | URL for button under the story |
  | Parameters | --auth | Structure Of String | &#x2716; | Authorization JSON or path to .json |

  
  Returns:  Map Of KeyAndValue - serialized JSON response from VK

<br/>

:::tip
Parameters with Binary data type can also accept file paths on disk and URLs
:::
<br/>



```bsl title="1C:Enterprise/OneScript code example"
    Parameters = GetVKParameters();
    URL        = "https://github.com/Bayselonarrend/OpenIntegrations";

    Image = "https://api.athenaeum.digital/test_data/picture.jpg"; // URL, Path to file or Binary Data
    TFN   = GetTempFileName("png");
    CopyFile(Image, TFN);
    Image = New BinaryData(TFN);

    Result = OPI_VK.CreateStory(Image , URL, Parameters);

    Result = OPI_VK.CreateStory(TFN, , Parameters);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint vk CreateStory \
             --picture "C:\Users\Administrator\AppData\Local\Temp\3dajaq035pt.png" \
             --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 CreateStory ^
             --picture "C:\Users\Administrator\AppData\Local\Temp\3dajaq035pt.png" ^
             --auth "{'access_token':'***','owner_id':'-218861756','app_id':'51694790','group_id':'218861756'}"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "response": {
  "count": 1,
  "items": [
   {
    "id": 456240002,
    "owner_id": -218861756,
    "access_key": "story",
    "can_comment": 1,
    "can_reply": 1,
    "can_see": 1,
    "can_like": true,
    "can_share": 1,
    "can_hide": 1,
    "date": 1728453724,
    "expires_at": 1728540124,
    "link": {
     "text": "Ещё",
     "url": "https://github.com/Bayselonarrend/OpenIntegrations"
    },
    "photo": {
     "album_id": -81,
     "date": 1728453724,
     "id": 457249076,
     "owner_id": -218861756,
     "sizes": [
      {
       "height": 56,
       "type": "s",
       "width": 75,
       "url": "https://sun56-1.userapi.com/s/v1/ig2/ThGIg1sYfgXAZUYVzUjJqluCzKhtUuvDLcJtPsHGrioIwe8KrLy5AyHySWYkCP15VtugfWaIFYv4zKyHHkFzOvJP.jpg?size=75x56&quality=95&type=story"
      },
      {
       "height": 97,
       "type": "m",
       "width": 130,
       "url": "https://sun56-1.userapi.com/s/v1/ig2/ORIQl3y2_g7mMeup9alevCqrO3fE7bSbLJ2JkXpQdshBBCfI8AOhOQPiXVxXWFEfjjhHeahup5i4GP_F431DdWVA.jpg?size=130x97&quality=95&type=story"
      },
      {
       "height": 192,
       "type": "j",
       "width": 256,
       "url": "https://sun56-1.userapi.com/s/v1/ig2/xoto12wh7mi1WEO1y9hDlvijf9J0FS4X9Og8hRscocnwcg_VldRIzwUKwf-mddh_OtPzZIJDxy9KBTW8uTdGlsgU.jpg?size=256x192&quality=95&type=story"
      },
      {
       "height": 453,
       "type": "x",
       "width": 604,
       "url": "https://sun56-1.userapi.com/s/v1/ig2/0C2jpD_cTXilTHPedjRJxqRmo9CoCrcFK58dWrmctdyAVoOmdS5q-X7RX0lw482Zwc-pl426jUvsjf_li5WPDIq4.jpg?size=604x453&quality=95&type=story"
      },
      {
       "height": 605,
       "type": "y",
       "width": 807,
       "url": "https://sun56-1.userapi.com/s/v1/ig2/Sb_g2E27IHayxpRXUUYt8o87y4aXcO_YsG1Bv5zKjTfgaa3gXGYUteMhFqAlnad1-yklST95wEidi_wLVvb-6w2N.jpg?size=807x605&quality=95&type=story"
      },
      {
       "height": 960,
       "type": "z",
       "width": 1280,
       "url": "https://sun56-1.userapi.com/s/v1/ig2/jK_pcU1ucaExAG4jpzdjIUpuyp4YoHpoexaam4jk911tLWd_BWEW5Yb-VFKWYvB7x9ONtOj4KbR8lqeCM_I5Ccrw.jpg?size=1280x960&quality=95&type=story"
      },
      {
       "height": 1920,
       "type": "w",
       "width": 2560,
       "url": "https://sun56-1.userapi.com/s/v1/ig2/y6YSc3M4nLKIyt48O5DW3XvuxIg8UC-par28D54_vJLn0dyS-0VAUMYRCY1g9T926sG4XHLXw6loMFbHNvzFF35G.jpg?size=2560x1920&quality=95&type=story"
      }
     ],
     "text": "",
     "user_id": 100,
     "web_view_token": "cec38f3d661278427c",
     "has_tags": false
    },
    "replies": {
     "count": 0,
     "new": 0
    },
    "track_code": "story/3AAQAdLy9G9EAs4bMauCA84nNfHkBAAFoAagB6AIAA==",
    "type": "photo",
    "views": 0,
    "likes_count": 0,
    "reaction_set_id": "reactions",
    "no_sound": false,
    "can_ask": 0,
    "can_ask_anonymous": 0,
    "narratives_count": 0,
    "can_use_in_narrative": true
   }
  ]
 }
}
```
