1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-12-09 23:12:35 +02:00
Files
OpenIntegrations/docs/en/md/S3/Objects-management/Get-object-upload-link.mdx

89 lines
3.3 KiB
Plaintext
Raw Normal View History

2024-12-01 13:49:27 +03:00
---
sidebar_position: 17
2025-05-05 11:15:20 +03:00
description: Get object upload 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
2025-05-05 09:49:19 +03:00
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, S3]
2024-12-01 13:49:27 +03:00
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Get object upload link
Gets a direct link to upload (put) an object without additional authorization
2025-08-13 16:57:49 +03:00
`Function GetObjectUploadLink(Val Name, Val Bucket, Val BasicData, Val Expire = 3600, Val Headers = Undefined, Val Directory = False) Export`
2024-12-01 13:49:27 +03:00
| 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 |
2024-12-29 17:57:09 +03:00
| BasicData | --basic | Structure Of KeyAndValue | ✔ | Basic request data. See GetBasicDataStructure |
2024-12-01 13:49:27 +03:00
| Expire | --expires | String, Number | ✖ | Link lifetime in seconds. 604800 max. |
| Headers | --headers | Map Of KeyAndValue | ✖ | Additional request headers, if necessary |
2025-09-01 14:51:24 +03:00
| Directory | --dir | Boolean | ✖ | True > Path style URL, False > Virtual hosted style URL |
2024-12-01 13:49:27 +03:00
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"
2025-10-21 11:36:43 +03:00
URL = "storage-155.s3hoster.by";
AccessKey = "BRN5RKJE67...";
SecretKey = "NNhv+i9PrytpT8Tu0C1N...";
2024-12-01 13:49:27 +03:00
Region = "BTC";
BasicData = OPI_S3.GetBasicDataStructure(URL, AccessKey, SecretKey, Region);
2025-09-01 14:51:24 +03:00
Name = "pictureU.jpg";
Directory = True; // Formation URL in path-style
2024-12-01 13:49:27 +03:00
Bucket = "newbucket2";
2025-09-01 14:51:24 +03:00
Result = OPI_S3.GetObjectUploadLink(Name, Bucket, BasicData, 7200, , Directory);
2024-12-01 13:49:27 +03:00
```
2024-12-04 15:18:40 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
2025-10-07 19:27:04 +03:00
# JSON data can also be passed as a path to a .json file
2024-12-04 15:18:40 +03:00
oint s3 GetObjectUploadLink \
--name "pictureU.jpg" \
--bucket "newbucket2" \
--basic "{'URL':'storage-155.s3hoster.by','AccessKey':'***','SecretKey':'***','Region':'BTC','Service':'s3'}" \
2025-09-16 09:07:33 +03:00
--expires 7200 \
--dir true
2024-12-04 15:18:40 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
2025-10-07 19:27:04 +03:00
:: JSON data can also be passed as a path to a .json file
2024-12-04 15:18:40 +03:00
oint s3 GetObjectUploadLink ^
--name "pictureU.jpg" ^
--bucket "newbucket2" ^
--basic "{'URL':'storage-155.s3hoster.by','AccessKey':'***','SecretKey':'***','Region':'BTC','Service':'s3'}" ^
2025-09-16 09:07:33 +03:00
--expires 7200 ^
--dir true
2024-12-04 15:18:40 +03:00
```
</TabItem>
</Tabs>
```json title="Result"
2025-10-15 14:32:00 +03:00
"storage-155.s3hoster.by/newbucket2/pictureU.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=BRN5RKJE67YCVDZRRQVI%2F20251015%2FBTC%2Fs3%2Faws4_request&X-Amz-Date=20251015T103510Z&X-Amz-Expires=7200&X-Amz-SignedHeaders=host&X-Amz-Signature=c4caa463b500af1880e2b257cd2414ff75c10f487383bf1ad8e142feb2c5aa3b"
2024-12-04 15:18:40 +03:00
```