pajaydev/ebay-node-api

How to specify MinPrice and MaxPrice in completed items call?

doverradio opened this issue · 6 comments

Hello,

I am trying to get the completed items within a specified MinPrice and MaxPrice to show only sold items but it keeps giving error response. However, according to this ebay page, MinPrice and MaxPrice must be passed in as params. Can you please check my code? Perhaps I am doing something wrong?

ebay.findCompletedItems({
    keyword: 'safaveih',
    categoryId: '45510',
    itemFilter: [ 
        `Condition: 1000`, 
        `LocatedIn: 'US'`, 
        `FreeShippingOnly: true`, 
        `ReturnsAcceptedOnly: true`
    ],
    SoldItemsOnly: true,
  })

When I remove the SoldItemsOnly: true, then it works.

I also need to specify MinPrice and MaxPrice. Can this be done in this call? Things that I need to achieve in this call, if possible are:

LocatedIn: 'US'
FreeShippingOnly: true
ReturnsAcceptedOnly: true
Condition: 1000
ListingType: 'FixedPrice'
categoryId: '45510'

I also attempted this with the other call findItemsAdvanced but it was also tricky and didn't give me what I want.

ebay.findItemsAdvanced({
  // LocatedIn: 'US',
  // Condition: 1000,
  keyword: 'safaveih',
  categoryId: '45510',
  itemFilter: [ 
    `SoldItemsOnly: true`,
      `Condition: 1000`, 
      `LocatedIn: 'US'`, 
      `FreeShippingOnly: true`, 
      `ReturnsAcceptedOnly: true`
  ],
  // SoldItemsOnly: true,
  // FreeShippingOnly: true,
  // ListingType: 'FixedPrice',
  // ReturnsAcceptedOnly: true,
}

Please help me to solve this if it is possible to meet those conditions and which is the appropriate call to use for it.

Right now it's not honoring itemFilter as separate field. you can provide it like this .

I will try to do more documentation as this is more confusing to users.

As of now, You can use like this

ebay.findCompletedItems({
    keywords: "pre-CBS",
    MaxPrice: 2500.00,
    SoldItemsOnly: true,
    MinPrice: 2000.00
    }).then((data) => {
     console.log(data);
    //console.log(data[0].errorMessage[0].error[0].message[0]);
    }, (error) => {
    console.log(error);
    });

@doverradio Let me know if the issue got resolved. I will close the bug

Closing this bug.

@pajaydev
There is bug in code for itemFilter. in some itemFilter, param name and value also require. for example. to filter by min and max price, you need to specify currency also

itemFilter(0).name=MinPrice&
   itemFilter(0).value=11.00&
   itemFilter(0).paramName=Currency&
   itemFilter(0).paramValue=USD&
   itemFilter(1).name=MaxPrice&
   itemFilter(1).value=25.00&
   itemFilter(1).paramName=Currency&
   itemFilter(1).paramValue=USD&

https://developer.ebay.com/Devzone/finding/CallRef/findItemsIneBayStores.html#Samples

@padaliyajay Thanks for reporting, I will take a look. let me reopen this bug.

@padaliyajay You can use like this for other sites. Closing this bug and let me know if you face any other issues.

const ebay = new Ebay({
    clientID: clientId,
    countryCode: 'EBAY-US'
});

ebay.findItemsIneBayStores({
    storeName: 'Battery Gallery',
    SoldItemsOnly: true,
    MinPrice: '5.00',
    MaxPrice: '800.00',
}).then((data) => {
    console.log(data);
}, (error) => {
    console.log(error);
});