Amazon-SP-API-CSharp
Amazon-SP-API-CSharp copied to clipboard
AmazonUnauthorizedException when calling FbaInventory.GetInventorySummariesAsync
I am trying to get a list of all inventory I've ever had including deleted listings. The data does not appear to be included in the report manager GetProductsAsync results so I am attempting to get it via FbaInventory.GetInventorySummariesAsync however my calls to that endpoint are resulting in an exception and I'm not sure why?
FikaAmazonAPI.AmazonSpApiSDK.Models.Exceptions.AmazonUnauthorizedException: Access to requested resource is denied
Why would special permissions be needed to get inventory data? Am I missing anything?
var searchParams = new ParameterGetInventorySummaries
{
marketplaceIds = new[] {MarketPlace.UnitedKingdom.ToString()},
granularityType = Granularity.GranularityTypeEnum.Marketplace,
granularityId = MarketPlace.UnitedKingdom.ID,
nextToken = nextToken,
details = includeDetails
};
return await _amazonConnection.FbaInventory.GetInventorySummariesAsync(searchParams);
//YOU CANT DO THIS
marketplaceIds = new[] {MarketPlace.UnitedKingdom.ToString()}
//THIS TRUE
//YOU CANT DO THIS
marketplaceIds = new[] {MarketPlace.UnitedKingdom.ID}
Is that solve your problem?
Perfect - that was exactly the problem! Sorry, I had copied my logic from another request where that line for some reason was working but didn't get an error so have gone back and corrected it elsewhere too. Thanks for pointing out my now obvious error.