nodejs-ebay-api
nodejs-ebay-api copied to clipboard
Switching country code per request
I'm a wee bit stuck and getting a bit tired of trying this and that, so I thought I'd ask the community.
If I'm building something that would change the country being searched per request, can I do something like the following?
var filters = {};
filters.ItemFilter = [
new ebay.ItemFilter("ListingType", "FixedPrice"),
new ebay.ItemFilter("AvailableTo", "AU")
];
var reqOptions = {};
reqOptions["X-EBAY-SOA-GLOBAL-ID"] = "EBAY-AU";
ebay.ebayApiGetRequest({
serviceName: 'FindingService',
opType: 'findItemsByProduct',
appId: credentials.prod.ebay.appId,
params: params,
filters: filters,
reqOptions: reqOptions,
parser: ebay.parseItemsFromResponse
},
// gets all the items together in a merged array
function itemsCallback(error, items) {
// handle it
}
);
dont know if you still need to know: options.globalId is what you're looking for
My solution:
var globalId = 'EBAY-PL';
ebay.xmlRequest({
serviceName: 'Finding',
opType: 'findItemsAdvanced',
appId: '.........', // FILL IN YOUR OWN APP KEY, GET ONE HERE:
params: params,
globalId: globalId,
parser: ebay.parseResponseJson // (default)
},```