Hello guys,
is there a way to make http requests via code execution and if so how?
When I try something in BAS it always gives a parse or syntax error.
At the end I would like to make a request like this:
var filePath = [[FILE_PATH]];
var uploadUrl = [[URL]];
HTTPClient.Request({
url: uploadUrl,
method: 'PUT',
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0',
'Accept': 'application/xml, text/xml, */*; q=0.01',
'Accept-Language': 'en-US,en;q=0.5',
'Accept-Encoding': 'gzip, deflate, br',
'Content-Type': 'application/octet-stream',
'Content-Length': [[CONTENT_LENGTH]],
'Referer': 'https://xxx.com/',
'x-amz-server-side-encryption': 'AES256',
'x-amz-acl': 'private',
'Content-Disposition': 'attachment;filename="' + [[FILE_NAME]] + '"; filename*=utf-8\'\'' + [[FILE_NAME]],
'x-amz-storage-class': 'STANDARD',
'x-amz-meta-user-id': [[AMZ_UID]],
'Origin': 'https://xxx.com'
},
body: File.ReadBinary(filePath),
success: function(response) {
Log(response.body);
},
fail: function(response) {
Log('Error on upload: ' + response.body);
}
});
Thank you for helping