mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-03-29 21:57:16 +02:00
83 lines
2.8 KiB
Plaintext
83 lines
2.8 KiB
Plaintext
---
|
|
sidebar_position: 17
|
|
---
|
|
|
|
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
|
|
|
|
|
|
|
|
`Function GetObjectUploadLink(Val Name, Val Bucket, Val BasicData, Val Expire = 3600, Val Headers = Undefined) 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 |
|
|
|
|
|
|
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 = "pictureU.jpg";
|
|
Bucket = "newbucket2";
|
|
|
|
Result = OPI_S3.GetObjectUploadLink(Name, Bucket, BasicData, 7200);
|
|
```
|
|
|
|
|
|
<Tabs>
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
```bash
|
|
# JSON data can also be passed as a path to a .json file
|
|
|
|
oint s3 GetObjectUploadLink \
|
|
--name "pictureU.jpg" \
|
|
--bucket "newbucket2" \
|
|
--basic "{'URL':'storage-155.s3hoster.by','AccessKey':'***','SecretKey':'***','Region':'BTC','Service':'s3'}" \
|
|
--expires 7200
|
|
```
|
|
</TabItem>
|
|
|
|
<TabItem value="bat" label="CMD/Bat" default>
|
|
```batch
|
|
:: JSON data can also be passed as a path to a .json file
|
|
|
|
oint s3 GetObjectUploadLink ^
|
|
--name "pictureU.jpg" ^
|
|
--bucket "newbucket2" ^
|
|
--basic "{'URL':'storage-155.s3hoster.by','AccessKey':'***','SecretKey':'***','Region':'BTC','Service':'s3'}" ^
|
|
--expires 7200
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
|
|
```json title="Result"
|
|
"newbucket2.storage-155.s3hoster.by/pictureU.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=BRN5RKJE67YCVDZRRQVI%2F20241203%2FBTC%2Fs3%2Faws4_request&X-Amz-Date=20241203T102113Z&X-Amz-Expires=7200&X-Amz-SignedHeaders=host&X-Amz-Signature=1e50717199a48444b44cce1bab99e46649a1c5e0265cd9ac8f50f0eaf721f459"
|
|
```
|