--- sidebar_position: 7 --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; # Upload attachments array Uploads files to the server and returns their IDs `Function UploadAttachmentsArray(Val ArrayOfFiles, Val AttachmentsType, Val Parameters = "") Export` | Parameter | CLI option | Type | Required | Description | |-|-|-|-|-| | ArrayOfFiles | --files | Array of String, BinaryData | ✔ | Array of files to be uploaded | | AttachmentsType | --type | String | ✔ | Attachment type: tweet_video, tweet_image, tweet_gif | | Parameters | --auth | Structure Of String | ✖ | Authorization data. See GetStandardParameters | Returns: Array Of String - Media ID array
:::tip Parameters with Binary data type can also accept file paths on disk and URLs :::
```bsl title="1C:Enterprise/OneScript code example" Parameters = GetTwitterAuthData(); Image1 = "https://api.athenaeum.digital/test_data/picture.jpg"; // URL, Binary Data or Path to file Image2 = "https://api.athenaeum.digital/test_data/picture2.jpg"; // URL, Binary Data or Path to file ImageArray = New Array(); ImageArray.Add(Image1); ImageArray.Add(Image2); Result = OPI_Twitter.UploadAttachmentsArray(ImageArray, "tweet_image", Parameters); ``` ```bash # JSON data can also be passed as a path to a .json file oint twitter UploadAttachmentsArray \ --files "['https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg','https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture2.jpg']" \ --type "tweet_image" \ --auth "{'redirect_uri':'https://api.athenaeum.digital/opi/hs/twitter','client_id':'***','client_secret':'***','access_token':'***','refresh_token':'***','oauth_token':'***','oauth_token_secret':'***','oauth_consumer_key':'***','oauth_consumer_secret':'***'}" ``` ```batch :: JSON data can also be passed as a path to a .json file oint twitter UploadAttachmentsArray ^ --files "['https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture.jpg','https://github.com/Bayselonarrend/OpenIntegrations/raw/main/service/test_data/picture2.jpg']" ^ --type "tweet_image" ^ --auth "{'redirect_uri':'https://api.athenaeum.digital/opi/hs/twitter','client_id':'***','client_secret':'***','access_token':'***','refresh_token':'***','oauth_token':'***','oauth_token_secret':'***','oauth_consumer_key':'***','oauth_consumer_secret':'***'}" ``` ```json title="Result" [ "1843891479330058240", "1843891499429142528" ] ```