bhushankummar / amazon-mws

Amazon MWS NodeJS Wrapper
MIT License
197 stars 78 forks source link

overrideHost clairfication #11

Closed moggiex closed 6 years ago

moggiex commented 6 years ago

Howdy Bhushankumar

Line 363 here I can see we have:

var host = self.overrideHost || self._AmazonMws.getApiField('host');

But how on earth do I override/set the host value before making the request?

Matt

bhushankummar commented 6 years ago

@moggiex It will be set like

    var amazonMws = require('amazon-mws')(accessKey, accessSecret);
    amazonMws.setApiKey(accessKey, accessSecret);
    amazonMws.setHost('YOUR HOST');
    // amazonMws.setHost('YOUR HOST', 443); // Alternate way
    amazonMws.orders.search({
        'Version': '2013-09-01',
        'Action': 'ListOrders',
        'SellerId': 'SELLER_ID',
        'MWSAuthToken': 'MWS_AUTH_TOKEN',
        'MarketplaceId.Id.1': 'MARKET_PLEACE_ID_1',
        'LastUpdatedAfter': new Date(13, 12, 2016)
    }, function (error, response) {
        if (error) {
            console.log('error ', error);
            return;
        }
        console.log('response', response);
    });
moggiex commented 6 years ago

Outstanding, it was in plain sight all along 👍