
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
This was built to power the "eBay Picks" section of AntiquesNearMe.com. It can currently query the FindingService, MerchandisingService, and Shopping API via JSON-GET requests, and the Trading API via XML-POST. Other services can be added as needed. (Pull requests welcome!)
npm install ebay-api
var ebay = require('ebay-api');
(See the examples)
eBay has an enormous collection of APIs built over the years. Enter the labyrinth here: http://developer.ebay.com or here: https://www.x.com/developers/ebay/products
Sign up for an API key here: https://publisher.ebaypartnernetwork.com/PublisherToolsAPI (You'll need a key to run the examples.)
Make sure to obey the eBay API License and Terms when using this library.
Node.js is great at running HTTP requests asynchronously. If each request takes 5 seconds to run and 5 seconds to parse, for example, dozens of requests can run in parallel and only take 10 seconds total, instead of 10 seconds for each. (This module uses restler for the HTTP handling and the async library for flow control.)
Node.js speaks JSON natively, so the response data from the JSON APIs can be very easily parsed in code, or dumped into MongoDB.
Javascript is a little insane and a lot of fun.
ebayApiGetRequest(options, callback)
Make an individual request to a GET service.
options
must contain:
and can optionally contain:
parseItemsFromResponse
. To return the raw data, pass in a function like function(data, callback) { callback(null, data); }
.callback
gets (error, items)
or (error, data)
depending on the parser.
paginateGetRequest(options, callback)
Make a multi-page request to a GET service, running them in parallel and combining the results.
options
contains the same parameters as ebayApiGetRequest
, plus:
parser
here needs to return an array, so the results can be concatenated and passed to callback
.
Note: Because the pages all run in parallel, they can cause spikes on CPU and network activity. In the future, I might switch this to using an async queue
(instead of forEach
) with a variable concurrency. (A forEachSeries
can also be used, but negates the purpose of running the requests asynchronously.)
callback
gets (error, items)
parseItemsFromResponse(data, callback)
Default parser, takes the response from an API request and parses items or other units per request type.
Each response type is a little different, so this needs to be built out further.
Is used as the default parser
option for paginateGetRequest
.
callback
gets (error, items)
where items
are the items parsed from data
.
ebayApiPostXmlRequest(options, callback)
Make an individual request to a POST-XML service.
options
must contain:
and can optionally contain:
(for authentication)
params (for the XML input)
GetCategories
and possibly other services, pass the auth token as params.authToken
, not RequesterCredentials.eBayAuthToken
as indicated in the API documentation.)buildXmlInput()
for ways to structure this.reqOptions: headers and other options to pass to the request
params
. See the API documentation.sandbox: true/false (default false = production). May need to add additional endpoint URLs to the code as needed.
rawXml: boolean. If true
, passes the raw XML response back to callback. false
means XML is converted to JSON (for consistency with other APIs). Default is false
/JSON.
callback
gets (error, data)
. (There is not currently a default parser for these endpoints.)
flatten(obj)
Simplifies the JSON format of the API responses:
{ @key:KEY, __value__:VALUE }
is flattened to its key:value pair.Its purpose is to make the data easier to handle in code, and to model/query in MongoDB.
Runs synchronously, returns flattened object.
ItemFilter(name, value, paramName, paramValue)
A class constructor to simplify creating filters. (See the examples)
checkAffiliateUrl(url)
If you want your affiliate codes included in returned items (see the examples for how to do that), use this to verify that the URLs are of the right format.
e.g. checkAffiliateUrl(item.viewItemURL)
Returns boolean.
getLatestApiVersions(callback)
Get the version numbers of the APIs that make their version available.
See the /examples directory. There are two examples, one with a single-page findItemsByKeywords
request, the other a paginated findItemsAdvanced
request. It should be reasonably apparent from the examples how these functions are used.
To run the examples, you need to add your own app key (I don't want my keys to be disabled for abuse!) - you can get one here.
async.forEach
to async.queue
for more fine-grained concurrency control.Created by Ben Buckman of New Leaf Digital, an independent dev/consulting shop specializing in Node.js, Drupal, mapping, system architecture, and general "full stack" development. Ben writes a dev blog about Node.js and many other subjects.
Ben's other hat is co-founder and CTO of Antiques Near Me, and this library was created for use there.
Enjoy!
FAQs
Simplified eBay API Client
The npm package ebay-apis receives a total of 0 weekly downloads. As such, ebay-apis popularity was classified as not popular.
We found that ebay-apis demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.