1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-11-29 22:27:42 +02:00
Files
OpenIntegrations/docs/en/md/S3/Objects-management/Get-object-download-link.mdx
Vitaly the Alpaca (bot) abbcdf3723 Main build (Jenkins)
2025-09-18 13:55:48 +03:00

84 lines
3.2 KiB
Plaintext
Vendored

---
sidebar_position: 16
description: Get object download link and other functions to work with S3 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, S3]
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Get object download link
Get presigned link for object retrieving without authorization
`Function GetObjectDownloadLink(Val Name, Val Bucket, Val BasicData, Val Expire = 3600, Val Headers = Undefined, Val Directory = False) Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Name | --name | String | ✔ | Name of the object in the bucket |
| Bucket | --bucket | String | ✔ | Name of the bucket to put the object |
| BasicData | --basic | Structure Of KeyAndValue | ✔ | Basic request data. See GetBasicDataStructure |
| Expire | --expires | String, Number | ✖ | Link lifetime in seconds. 604800 max. |
| Headers | --headers | Map Of KeyAndValue | ✖ | Additional request headers, if necessary |
| Directory | --dir | Boolean | ✖ | True > Path style URL, False > Virtual hosted style URL |
Returns: String - URL for object retrieving
<br/>
:::tip
In Headers you need to add all x-amz headers that will be used when accessing the received URL
Process at AWS documentation: [Download and upload objects with presigned URLs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html)
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
URL = "storage-155.s3hoster.by";
AccessKey = "BRN5RKJE67...";
SecretKey = "NNhv+i9PrytpT8Tu0C1N...";
Region = "BTC";
BasicData = OPI_S3.GetBasicDataStructure(URL, AccessKey, SecretKey, Region);
Name = "picture.jpg";
Directory = True; // Formation URL in path-style
Bucket = "opi-dirbucket3";
Result = OPI_S3.GetObjectDownloadLink(Name, Bucket, BasicData, 7200, , Directory);
```
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint s3 GetObjectDownloadLink \
--name "picture.jpg" \
--bucket "opi-dirbucket3" \
--basic "{'URL':'storage-155.s3hoster.by','AccessKey':'***','SecretKey':'***','Region':'BTC','Service':'s3'}" \
--expires 7200 \
--dir true
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint s3 GetObjectDownloadLink ^
--name "picture.jpg" ^
--bucket "opi-dirbucket3" ^
--basic "{'URL':'storage-155.s3hoster.by','AccessKey':'***','SecretKey':'***','Region':'BTC','Service':'s3'}" ^
--expires 7200 ^
--dir true
```
</TabItem>
</Tabs>
```json title="Result"
"storage-155.s3hoster.by/opi-dirbucket3/picture.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=BRN5RKJE67YCVDZRRQVI%2F20250915%2FBTC%2Fs3%2Faws4_request&X-Amz-Date=20250915T231834Z&X-Amz-Expires=7200&X-Amz-SignedHeaders=host&X-Amz-Signature=a86f9514bf798f56b497ad3124733d51c4a4ab942a0007330e558606ea63d1a1"
```