Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetMyFeesEstimate returns "invalid xml" #115

Open
fr3shn3ss opened this issue Dec 16, 2019 · 9 comments
Open

GetMyFeesEstimate returns "invalid xml" #115

fr3shn3ss opened this issue Dec 16, 2019 · 9 comments
Assignees

Comments

@fr3shn3ss
Copy link

It won't work for >4 ASINs. <4 works great though. Scratchpad works for >4.

Here is my code:
//asinList is an array of ASINs
var GetMyFeesEstimate = async function (asinList) {
var obj = {
'Version': '2011-10-01',
'Action': 'GetMyFeesEstimate',
'SellerId': SellerId,
'MWSAuthToken': MWSAuthToken,
'FeesEstimateRequestList.FeesEstimateRequest.1.MarketplaceId': 'ATVPDKIKX0DER',
'FeesEstimateRequestList.FeesEstimateRequest.1.IdType': 'ASIN'
}

//adding each asin from asinList to obj >> ASINList.ASIN.X
for (var i = 1; i <= asinList.length; i++) {
    obj['FeesEstimateRequestList.FeesEstimateRequest.' + i + '.MarketplaceId'] = MarketplaceId;
    obj['FeesEstimateRequestList.FeesEstimateRequest.' + i + '.IdType'] = 'ASIN';
    obj['FeesEstimateRequestList.FeesEstimateRequest.' + i + '.IdValue'] = asinList[i - 1];
    obj['FeesEstimateRequestList.FeesEstimateRequest.' + i + '.IsAmazonFulfilled'] = 'true';
    obj['FeesEstimateRequestList.FeesEstimateRequest.' + i + '.Identifier'] = 'Hello';
    obj['FeesEstimateRequestList.FeesEstimateRequest.' + i + '.PriceToEstimateFees.ListingPrice.CurrencyCode'] = 'USD';
    obj['FeesEstimateRequestList.FeesEstimateRequest.' + i + '.PriceToEstimateFees.ListingPrice.Amount'] = '10';
    obj['FeesEstimateRequestList.FeesEstimateRequest.' + i + '.PriceToEstimateFees.Shipping.CurrencyCode'] = 'USD';
    obj['FeesEstimateRequestList.FeesEstimateRequest.' + i + '.PriceToEstimateFees.Shipping.Amount'] = '0';
    obj['FeesEstimateRequestList.FeesEstimateRequest.' + i + '.PriceToEstimateFees.Points.PointsNumber'] = '0';

}


console.log(obj)
try {
    const r = await amazonMws.products.search(obj);
    console.log(JSON.stringify(r))
} catch (e) {
    console.log(e)
}

};

@fr3shn3ss
Copy link
Author

fr3shn3ss commented Jan 5, 2020

@bhushankumarl any ideas?
Thanks.

@bhushankummar
Copy link
Owner

@fr3shn3ss
Can you send me an actual error?

@bhushankummar bhushankummar self-assigned this Jan 28, 2020
@fr3shn3ss
Copy link
Author

@bhushankumarl thanks. I just tested again. 4 asins work fine, but 5 throws this error
no proxy set (HTTP_PROXY) { Version: '2011-10-01', Action: 'GetMyFeesEstimate', SellerId: 'XXXXXXXXXXXXXXXXXXXXXXX', MWSAuthToken: 'XXXXXXXXXXXXXXXXXXXXXXX', 'FeesEstimateRequestList.FeesEstimateRequest.1.MarketplaceId': 'ATVPDKIKX0DER', 'FeesEstimateRequestList.FeesEstimateRequest.1.IdType': 'ASIN', 'FeesEstimateRequestList.FeesEstimateRequest.1.IdValue': '0735201439', 'FeesEstimateRequestList.FeesEstimateRequest.1.IsAmazonFulfilled': 'true', 'FeesEstimateRequestList.FeesEstimateRequest.1.Identifier': 'Hello', 'FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.ListingPrice.CurrencyCode': 'USD', 'FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.ListingPrice.Amount': '10', 'FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.Shipping.CurrencyCode': 'USD', 'FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.Shipping.Amount': '0', 'FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.Points.PointsNumber': '0', 'FeesEstimateRequestList.FeesEstimateRequest.2.MarketplaceId': 'ATVPDKIKX0DER', 'FeesEstimateRequestList.FeesEstimateRequest.2.IdType': 'ASIN', 'FeesEstimateRequestList.FeesEstimateRequest.2.IdValue': '0571198775', 'FeesEstimateRequestList.FeesEstimateRequest.2.IsAmazonFulfilled': 'true', 'FeesEstimateRequestList.FeesEstimateRequest.2.Identifier': 'Hello', 'FeesEstimateRequestList.FeesEstimateRequest.2.PriceToEstimateFees.ListingPrice.CurrencyCode': 'USD', 'FeesEstimateRequestList.FeesEstimateRequest.2.PriceToEstimateFees.ListingPrice.Amount': '10', 'FeesEstimateRequestList.FeesEstimateRequest.2.PriceToEstimateFees.Shipping.CurrencyCode': 'USD', 'FeesEstimateRequestList.FeesEstimateRequest.2.PriceToEstimateFees.Shipping.Amount': '0', 'FeesEstimateRequestList.FeesEstimateRequest.2.PriceToEstimateFees.Points.PointsNumber': '0', 'FeesEstimateRequestList.FeesEstimateRequest.3.MarketplaceId': 'ATVPDKIKX0DER', 'FeesEstimateRequestList.FeesEstimateRequest.3.IdType': 'ASIN', 'FeesEstimateRequestList.FeesEstimateRequest.3.IdValue': '8186685596', 'FeesEstimateRequestList.FeesEstimateRequest.3.IsAmazonFulfilled': 'true', 'FeesEstimateRequestList.FeesEstimateRequest.3.Identifier': 'Hello', 'FeesEstimateRequestList.FeesEstimateRequest.3.PriceToEstimateFees.ListingPrice.CurrencyCode': 'USD', 'FeesEstimateRequestList.FeesEstimateRequest.3.PriceToEstimateFees.ListingPrice.Amount': '10', 'FeesEstimateRequestList.FeesEstimateRequest.3.PriceToEstimateFees.Shipping.CurrencyCode': 'USD', 'FeesEstimateRequestList.FeesEstimateRequest.3.PriceToEstimateFees.Shipping.Amount': '0', 'FeesEstimateRequestList.FeesEstimateRequest.3.PriceToEstimateFees.Points.PointsNumber': '0', 'FeesEstimateRequestList.FeesEstimateRequest.4.MarketplaceId': 'ATVPDKIKX0DER', 'FeesEstimateRequestList.FeesEstimateRequest.4.IdType': 'ASIN', 'FeesEstimateRequestList.FeesEstimateRequest.4.IdValue': '1401309747', 'FeesEstimateRequestList.FeesEstimateRequest.4.IsAmazonFulfilled': 'true', 'FeesEstimateRequestList.FeesEstimateRequest.4.Identifier': 'Hello', 'FeesEstimateRequestList.FeesEstimateRequest.4.PriceToEstimateFees.ListingPrice.CurrencyCode': 'USD', 'FeesEstimateRequestList.FeesEstimateRequest.4.PriceToEstimateFees.ListingPrice.Amount': '10', 'FeesEstimateRequestList.FeesEstimateRequest.4.PriceToEstimateFees.Shipping.CurrencyCode': 'USD', 'FeesEstimateRequestList.FeesEstimateRequest.4.PriceToEstimateFees.Shipping.Amount': '0', 'FeesEstimateRequestList.FeesEstimateRequest.4.PriceToEstimateFees.Points.PointsNumber': '0', 'FeesEstimateRequestList.FeesEstimateRequest.5.MarketplaceId': 'ATVPDKIKX0DER', 'FeesEstimateRequestList.FeesEstimateRequest.5.IdType': 'ASIN', 'FeesEstimateRequestList.FeesEstimateRequest.5.IdValue': '0974721719', 'FeesEstimateRequestList.FeesEstimateRequest.5.IsAmazonFulfilled': 'true', 'FeesEstimateRequestList.FeesEstimateRequest.5.Identifier': 'Hello', 'FeesEstimateRequestList.FeesEstimateRequest.5.PriceToEstimateFees.ListingPrice.CurrencyCode': 'USD', 'FeesEstimateRequestList.FeesEstimateRequest.5.PriceToEstimateFees.ListingPrice.Amount': '10', 'FeesEstimateRequestList.FeesEstimateRequest.5.PriceToEstimateFees.Shipping.CurrencyCode': 'USD', 'FeesEstimateRequestList.FeesEstimateRequest.5.PriceToEstimateFees.Shipping.Amount': '0', 'FeesEstimateRequestList.FeesEstimateRequest.5.PriceToEstimateFees.Points.PointsNumber': '0' } { [Error] Type: 'AmazonMwsAPIError', Code: 'GenericError', Message: 'Invalid XML received from the AmazonMws API', StatusCode: 400 }

@bhushankummar
Copy link
Owner

@fr3shn3ss
Thank you for sharing. I will be check soon.

@fr3shn3ss
Copy link
Author

@bhushankumarl the issue is also reported here .
#74 (comment)

Thanks :)

@akycop
Copy link

akycop commented Oct 21, 2020

Did you ever figure this out? I have the same issue. I can only get up to 4 ASINs using

@fr3shn3ss
Copy link
Author

Last time I checked, that was still an issue. My app is now make one call for each ASIN so I don't need it anymore. I think you need to either fix it yourself or switch to a different library

@macpatel
Copy link

I too have issues even with 1 ASIN, for me the error is ""Error occurred from AmazonMws API", i checked everything looks good and test the same data on scratchpad as well.

@ReyazBeigh
Copy link

ReyazBeigh commented Jun 17, 2022

was having similar issue with FulfillmentInboundShipment API:

Changed the file /amazon-mws/lib/resources/FulfillmentInboundShipment.js from this :


'use strict';

var AmazonMwsResource = require('../AmazonMwsResource');
var amazonMwsMethod = AmazonMwsResource.method;

module.exports = AmazonMwsResource.extend({

    path: 'FulfillmentInboundShipment',
    search: amazonMwsMethod({
        method: 'GET'
    })

});

To This:

 'use strict';

var AmazonMwsResource = require('../AmazonMwsResource');
var amazonMwsMethod = AmazonMwsResource.method;

module.exports = AmazonMwsResource.extend({

    path: 'FulfillmentInboundShipment',
    search: amazonMwsMethod({
        useBody: false,
        method: 'POST'
    }),
    searchFor: amazonMwsMethod({
        useBody: true,
        method: 'POST'
    })

});

used searchFor to create inbound shipment plan and it worked.

The general problem is this lib. used GET method for some some APIs that support POST method and when the request data goes beyond the URL size limit supported by Amazon, the API starts responding with 400 - bad request.

Hope this helps someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants