Я пытаюсь получить отчет от Amazon Publisher Service.
Но я не могу найти решение этой проблемы.
Скажите, пожалуйста, как это исправить.
Это код в виде скрипта Google Apps.
function get(access_key_id, secret_access_key){
const today = new Date();
const date = Utilities.formatDate(today, 'Europe/London', "yyyyMMdd'T'HHmmss'Z'")
const object = "/aps-external-download/aps-download-publisher-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx//earnings_report/2020-01-01/report_data";
const string_to_sign = "GET" + "\n" +
"\n\n\n" +
"x-amz-date:" + date + "\n" +
object;
const signature = Utilities.base64Encode( Utilities.computeHmacSignature(Utilities.MacAlgorithm.HMAC_SHA_1,string_to_sign , secret_access_key, Utilities.Charset.UTF_8) );
const authorization = "AWS" + " " + access_key_id + ":" + signature;
const headers = {
'Authorization' : authorization,
'x-amz-date' : date
};
const options = {
'method' : 'get',
'headers' : headers,
'muteHttpExceptions' : true
};
const url = "s3:/" + object;
return UrlFetchApp.fetch(url, options); //Execute request.
}
Метод возвращает сообщение.
[20-03-03 21:02:07:837 PST] <?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>aps-download-
publisher-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/</Key><RequestId>xxxxxxxxxxxxxxxx</RequestId>
<HostId>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</HostId></Error>
Я ввожу тот же URL-адрес, что и в качестве примера в Amazon Publisher Service (https://ams.amazon.com/webpublisher/s3_download). И страница предоставила сообщение.
All S3 Reports are located in the s3 location below and stored in format s3://[Your s3
bucket]/[report name]/[date]/report_data . For example, your 2018/01/31 earning report is located at:
s3://aps-external-download/aps-download-publisher-xxxxxxxx-xxxx-xxxx-xxxx-
xxxxxxxxxxxx//earnings_report/2017-12-01/report_data