I am using C# Amazon SP-API library, I have converted C# wrapper classes using swagger codegen and all working fine with Pricing and also some of function in Reports API.
But when I tried to call getReportDocument, it gives error of AWS Signature does not match.
If you can confirm that the problem occurs only when calling single items by id like GetOrder, GetReport and you are using Amazon.SellingPartnerAPIAA.csproj provided by amazon for signing, it is most likely that AWSSigV4Signer.CreateCanonicalRequest
Method signs the url with the segment placeholder not the id itself.
e.g. "/reports/2021-06-30/documents/{reportDocumentId}" instead of "/reports/2021-06-30/documents/0356cf79-b8b0-4226-b4b9-0ee058ea5760"
One possible solution is resolving the url "by hand" before calling ExtractCanonicalURIParameters
foreach(var par in restRequest.Parameters)
{
if(restRequest.Resource.Contains($"{{{par.Name}}}"))
{
restRequest.Resource = restRequest.Resource.Replace($"{{{par.Name}}}", par.Value.ToString());
}
}
//CanonicalURI
canonicalizedRequest.AppendFormat("{0}\n", AwsSignerHelper.ExtractCanonicalURIParameters(restRequest.Resource));