nodejs-ebay-api icon indicating copy to clipboard operation
nodejs-ebay-api copied to clipboard

Switching country code per request

Open taitems opened this issue 8 years ago • 2 comments

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
    }
  );

taitems avatar Sep 22 '15 12:09 taitems

dont know if you still need to know: options.globalId is what you're looking for

thar0x29a avatar Sep 05 '16 11:09 thar0x29a

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)
        },```

kiskinvlad avatar Jan 30 '17 15:01 kiskinvlad