Skip to main content

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) Export

ParameterCLI optionTypeRequiredDescription
Name--nameStringName of the object in the bucket
Bucket--bucketStringName of the bucket to put the object
BasicData--basicStructure Of KeyAndValueBasic request data. See GetBasicDataStructure
Expire--expiresString, NumberLink lifetime in seconds. 604800 max.
Headers--headersMap Of KeyAndValueAdditional request headers, if necessary

Returns: String - URL for object retrieving


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


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";
Bucket = "opi-gpbucket3";

Result = OPI_S3.GetObjectDownloadLink(Name, Bucket, BasicData, 7200);
    # JSON data can also be passed as a path to a .json file

oint s3 GetObjectDownloadLink \
--name "picture.jpg" \
--bucket "opi-gpbucket3" \
--basic "{'URL':'storage-155.s3hoster.by','AccessKey':'***','SecretKey':'***','Region':'BTC','Service':'s3'}" \
--expires 7200
Result
"opi-gpbucket3.storage-155.s3hoster.by/picture.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=BRN5RKJE67YCVDZRRQVI%2F20241129%2FBTC%2Fs3%2Faws4_request&X-Amz-Date=20241129T083519Z&X-Amz-Expires=7200&X-Amz-SignedHeaders=host&X-Amz-Signature=03283ce0413f4fae0885198e996961e721559fef61b2c0c1da9b39a00a338ef4"