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

Problem with buildXmlInput

Open loricelli opened this issue 9 years ago • 4 comments

var xmlBody contains a xml request with a wrong syntax. The ItemId it's wrong. The correct identificator is ItemID.

loricelli avatar Apr 10 '16 15:04 loricelli

A first solution could be this one:

` var tmp= xmlBody.toString().split('ItemId');

var xmlb= tmp[0].toString()+"ItemID"+tmp[1].toString()+"ItemID"+tmp[2];

return xmlb;`

I added this 2 lines at the end of the function just to replace ItemId,

loricelli avatar Apr 10 '16 16:04 loricelli

Can you paste your original JSON input?

benbuckman avatar Apr 11 '16 01:04 benbuckman

  ebay.xmlRequest({
  'serviceName': 'Shopping',
  'opType': 'GetSingleItem',
  'appId': 'my app id',      // FILL IN YOUR OWN APP KEY, GET ONE HERE: https://publisher.ebaypartnernetwork.com/PublisherToolsAPI

  params: {
    'ItemId': item_id    // FILL IN A REAL ItemID
  }
.
.

The input is correct and if you print on the console the xmlBody variable you'll see that ItemId is the problem.

I found a better solution now:

  var xmlb=xmlBody.toString().split('ItemId').join("ItemID");//split the string and replace ItemId with ItemID

loricelli avatar Apr 11 '16 08:04 loricelli

Could you please fix the problem?any time I add a new npm module i have to change those values by myself.

loricelli avatar May 05 '16 09:05 loricelli