Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 10.3   10.4   10.5   11.0   11.1   11.2   11.3   11.4   11.5   11.6    Statistic    FMM    Blog  


Query predigend URL for Amazon Webservices.

Component Version macOS Windows Linux Server iOS SDK
CURL 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "CURL.AWSPresignURL"; AWSAccessKeyId; AWSSecretAccessKey; Region; Service; Path; Domain { ; Verb; Expires; QueryParameters; Headers } )   More


Parameter Description Example Flags
AWSAccessKeyId Your access key for AWS.
AWSSecretAccessKey Your secret.
Region The region to use. "eu-central-1"
Service The service to use. "s3"
Path The path for the URL.
Should always start with "/".
Domain Optional the domain to use.
By default we just build it from region and service.
"" or ""
Verb The HTTP Operation to do.
Default is GET.
"GET" Optional
Expires Expiration duration.
Provides the time period, in seconds, for which the generated presigned URL is valid. For example, 86400 (24 hours). This value is an integer. The minimum value you can set is 1, and the maximum is 604800 (seven days).
A presigned URL can be valid for a maximum of seven days because the signing key you use in signature calculation is valid for up to seven days.

Default is 86400 for one day.
QueryParameters List of query parameters to include.
Keys and values must be URL encoded.
Keys may need to be lowercase.
"id=123¶test=abc" Optional
Headers Extra HTTP headers to include.
Here you can specify various headers to include in signature and request.


Returns URL or error.


Query predigend URL for Amazon Webservices.
This implements AWS4-HMAC-SHA256 pre-signature for credentials.

Works also for other compatible S3 services beside Amazon's like the one from Wasabi or Dell ECS.


Try it for a S3 request:

86400 )

Example result:

Build an URL and use it:

# our parameters
Set Variable [ $AWSAccessKeyId ; Value: "AKIAXYQWFBIBSX2I6GEA" ]
Set Variable [ $AWSSecretAccessKey ; Value: "cE5ctB8xXOG3V7F3zoq1W2gg8x52f7r4y7H5ei03" ]
Set Variable [ $Region ; Value: "eu-central-1" ]
Set Variable [ $Bucketname ; Value: "monkeybreadsoftware" ]
Set Variable [ $Filename ; Value: "test.jpg" ]
Set Variable [ $Verb ; Value: "GET" ]
Set Variable [ $Service ; Value: "s3" ]
# Keep domain empty for default, which is service concatted by region
Set Variable [ $Domain ; Value: "" ]
# Build a path
Set Variable [ $Path ; Value: "/" & $BucketName & "/" & $Filename ]
# and get the URL
Set Variable [ $URL ; Value: MBS( "CURL.AWSPresignURL"; $AWSAccessKeyId; $AWSSecretAccessKey; $Region; $Service; $Path; $Domain; $Verb ) ]
# try it
Set Variable [ $curl ; Value: MBS("CURL.New") ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionURL"; $curl; $URL) ]
Set Field [ CURL Test::Result ; MBS("CURL.Perform"; $curl) ]
Set Field [ CURL Test::Image ; MBS("CURL.GetResultAsJPEG"; $curl) ]
Set Field [ CURL Test::debug ; MBS("CURL.GetDebugAsText"; $curl) ]
Set Variable [ $result ; Value: MBS("CURL.Release"; $curl) ]

See also

Release notes

Blog Entries

Created 24th June 2021, last changed 17th July 2021

CUPS.PrintFile - CURL.AddInputFile

Feedback: Report problem or ask question.

MBS Xojo PDF Plugins

Start Chat