Ebay API Client for node js.
The intent is to simplify the request process by handling the tedious logic. It's a thin wrapper around eBay Api.
Documentation: https://pajaydev.github.io/ebay-node-api
npm install ebay-node-apilet eBay = require("ebay-node-api");
let ebay = new eBay({
clientID: "-- Client APP ID ----",
env: "SANDBOX", // optional default = 'PRODUCTION'
headers: {
// optional
"X-EBAY-C-MARKETPLACE-ID": "EBAY_GB" // For Great Britain https://www.ebay.co.uk
}
});For Country Code and 市场 id check here
Check out the Starter Guide documentation with examples to get started.
You can consume these ebay node api's using Express. You can checkout the sample app in Codesandbox playground.
| HTTP Method | Methods | Description | Usage | Offical doc |
|---|---|---|---|---|
| GET | findItemsByKeywords | 搜索es for items on eBay by a keyword query. | Example | doc |
| GET | findCompletedItems | 搜索es for items whose listings are completed and are no longer available for sale by category (using categoryId), by keywords (using keywords), or a combination of the two. | Example | doc |
| GET | findItemsByProduct | 搜索es for items on eBay using specific eBay product values. | Example | doc |
| GET | findItemsAdvanced | 搜索es items on eBay by category or keyword or both. | Example | doc |
| GET | getSingleItem | Retrieves publicly visible details about one listing on eBay. | Example | doc |
| GET | getMultipleItems | Retrieves publicly available data for one or more listings. | Example | doc |
| GET | getShippingCosts | Retrieve estimated shipping cost to ship an active item to a specified destination country and postal code. | Example | doc |
| GET | getItemStatus | Get item status for given item ids. | Example | doc |
| GET | getUserDetails | Get User 个人资料. | Example | doc |
| GET | getDeals(Deprecated) | Get details about the deals across eBay. | Example | doc |
| HTTP Method | Methods | Description | Usage | Offical doc |
|---|---|---|---|---|
| GET | searchItems | 搜索es for eBay items by various query parameters and retrieves summaries of the items. You can search by keyword, category, eBay product ID (ePID), or GTIN, charity ID, or a combination of these. | Example | doc |
| GET | getItem | Retrieve the complete details of a specific item. | Example | doc |
| GET | getItemsByItemGroup | Retrieve all the individual items in a group. | Example | doc |
| GET | getItemByLegacyId | Returns the RESTful item ID, which can then be used in any of other Buy API methods. | Example | doc |
| GET | searchByImage | Returns the RESTful item ID, which can then be used in any of other Buy API methods. | Example | doc |
| GET | getMostWatchedItems | Retrieves data for items with the highest watch counts for the entire site or for a specific category. | Example | doc |
| GET | getSimilarItems | Retrieves recommended similar items for a specified item. | Example | doc |
| GET | getItemAspectsForCategory | Retrieve an array of aspects that are appropriate for describing items in a specified category. | Example | doc |
| GET | getDefaultCategoryTreeId | Retrieve the default category tree reference for a specific eBay marketplace. | Example | doc |
| GET | getCategoryTree | Retrieve the complete category tree for category id. | Example | doc |
// findItemsBykeyword
ebay
.findItemsByKeywords({
keywords: "Garmin nuvi 1300 Automotive GPS Receiver",
sortOrder: "PricePlusShippingLowest", //https://developer.ebay.com/devzone/finding/callref/extra/fndcmpltditms.rqst.srtordr.html
pageNumber: 2,
limit: 10
})
.then(
data => {
console.log(data);
},
error => {
console.log(error);
}
);
// Get Single item listing on eBay
ebay.getSingleItem("153265274986").then(data => {
console.log(data);
});
// 搜索 Items by Keyword
ebay.getAccessToken().then(data => {
ebay
.searchItems({
keyword: "drone",
limit: "3"
})
.then(data => {
console.log(data);
// Data is in format of JSON
// To check the format of Data, Go to this url (https://developer.ebay.com/api- docs/buy/browse/resources/item_summary/methods/search#w4-w1-w4-搜索forItemsbyKeyword-0)
});
});
// perform Advance 搜索 Items by Keyword or category or both
// 搜索 Buy It Now ipad items with one day shipping. (https://developer.ebay.com/DevZone/finding/CallRef/findItemsAdvanced.html)
ebay
.findItemsAdvanced({
entriesPerPage: 2,
keywords: "ipad",
ExpeditedShippingType: "OneDayShipping",
ListingType: "AuctionWithBIN"
})
.then(
data => {
console.log(data);
},
error => {
console.log(error);
}
);All test files are present inside test folder. You can run using
npm run testIf you are facing any issues or missing something, you can create the issues here.
Show your ❤️ and support by giving a ⭐. Willing to share your idea or ready to contribute, check here
MIT.
I have provided the examples here https://github.com/pajaydev/ebay-node-api/tree/master/demo.