2024-10-15 10:50:56 +03:00
|
|
|
---
|
2024-10-13 01:21:47 +03:00
|
|
|
sidebar_position: 7
|
|
|
|
---
|
|
|
|
|
2024-10-15 10:50:56 +03:00
|
|
|
import Tabs from '@theme/Tabs';
|
|
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
|
2024-10-13 01:21:47 +03:00
|
|
|
# Upload attachments array
|
|
|
|
Uploads files to the server and returns their IDs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`Function UploadAttachmentsArray(Val ArrayOfFiles, Val AttachmentsType, Val Parameters = "") Export`
|
|
|
|
|
2024-10-15 15:15:47 +03:00
|
|
|
| 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 |
|
2024-10-13 01:21:47 +03:00
|
|
|
|
|
|
|
|
|
|
|
Returns: Array Of String - Media ID array
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
2024-10-15 13:51:58 +03:00
|
|
|
:::tip
|
|
|
|
Parameters with Binary data type can also accept file paths on disk and URLs
|
|
|
|
:::
|
|
|
|
<br/>
|
2024-10-13 01:21:47 +03:00
|
|
|
|
|
|
|
|
2024-10-15 21:15:56 +03:00
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
2024-10-13 01:21:47 +03:00
|
|
|
Parameters = GetTwitterAuthData();
|
|
|
|
|
2024-10-15 10:07:27 +03:00
|
|
|
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
|
2024-10-13 01:21:47 +03:00
|
|
|
|
|
|
|
ImageArray = New Array();
|
|
|
|
ImageArray.Add(Image1);
|
|
|
|
ImageArray.Add(Image2);
|
|
|
|
|
|
|
|
Result = OPI_Twitter.UploadAttachmentsArray(ImageArray, "tweet_image", Parameters);
|
|
|
|
```
|
2024-10-15 09:53:37 +03:00
|
|
|
|
2024-10-13 01:21:47 +03:00
|
|
|
|
2024-10-20 22:36:03 +03:00
|
|
|
<Tabs>
|
|
|
|
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
|
|
```bash
|
2024-10-22 08:59:24 +03:00
|
|
|
# JSON data can also be passed as a path to a .json file
|
|
|
|
|
2024-10-20 22:36:03 +03:00
|
|
|
oint twitter UploadAttachmentsArray \
|
2024-10-22 08:59:24 +03:00
|
|
|
--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':'***'}"
|
2024-10-20 22:36:03 +03:00
|
|
|
```
|
|
|
|
</TabItem>
|
|
|
|
|
|
|
|
<TabItem value="bat" label="CMD/Bat" default>
|
|
|
|
```batch
|
2024-10-22 08:59:24 +03:00
|
|
|
:: JSON data can also be passed as a path to a .json file
|
|
|
|
|
2024-10-20 22:36:03 +03:00
|
|
|
oint twitter UploadAttachmentsArray ^
|
2024-10-22 08:59:24 +03:00
|
|
|
--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':'***'}"
|
2024-10-20 22:36:03 +03:00
|
|
|
```
|
|
|
|
</TabItem>
|
|
|
|
</Tabs>
|
2024-10-13 01:21:47 +03:00
|
|
|
|
|
|
|
|
|
|
|
```json title="Result"
|
|
|
|
[
|
|
|
|
"1843891479330058240",
|
|
|
|
"1843891499429142528"
|
|
|
|
]
|
|
|
|
```
|