Icontem

Node.js eBay API promise: Send requests to eBay API using Node.js

Recommend this page to a friend!
  Info   View files Documentation   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2014-10-29 (4 years ago) RSS 2.0 feedNot yet rated by the usersTotal: 75 This week: 1All time: 457 This week: 10Up
Version License JavaScript version Categories
qebayapi 0.2.0MIT/X Consortium ...5Node.js, Web services
Description Author

This is a Node.js module to send requests to eBay API.

It sends XML HTTP POST requests to the eBay trading API Web server.

The module uses Q promises fulfilled or rejected passing the response optionally parsed when it is the JSON format when it succeeds, or the error message for missing parameters or unknown trading API call when it fails.

  Performance   Level  
Name: Daniele Cruciani <contact>
Classes: 2 packages by
Country: Italy Italy
Age: 43
All time rank: 842 in Italy Italy
Week rank: 10 Up1 in Italy Italy Up
Innovation award
Innovation award
Nominee: 1x

Winner: 1x

Details
qebayapi
========

Promise oriented ebay api interface. Trading API.

eBay Trading API support xml and soap. This implementation use xml interface. It is almost asynchronous via Kriskoval's Q implemenation of promise.

Just one call now.

    var ebayapi = require("qebayapi");
    
    var options = {appName: '...','appCert':'...','devName':'...','callname':'GetItem','requestJSON':{'ItemID':'341341341'}, parseMode: 'json' };

    ebayapi.TradingApi(options)
    .then(function(response) {
      console.log(response.response.Ack);
      console.log('response': response.response);
    });


It use q-io, so it is almost asynchronous, something could be improved in this field for request xml creation phase.

https://github.com/benbuckman/nodejs-ebay-api is another nodejs module for ebay api interface

qebayapi have a number of advance over nodejs-ebay-api related to ebay trading api

Advance over other implementation
=================================

It has a single parameter structured, it means **complete isolation** of every call from each other, ie you can use it concurrently for a number of ebay application (say sandbox and production app), or response type required.

You have the control with little switches, **parseMode**: json, xmlNode, xmlString let you choose what to get back based on your need. (extending this with other parsing method is out of scope)

Input switch, **rMode** : json, xmlNode, xmlString. Let you manage your request as you need, ie manipulate and resend to the eBay, without transforming those in json for passing the library: hey, the eBay trading api is already xml, skip unuseful translations.

It use q promise from kriskowal and q-io, it is completely asynchronous (at least for what is sensible).

It **verify** legal call name! This option could be disabled, but it verify if the callname you pass is in trading api call list, and fail if not conforming. [a simple code to paste into console while surfing ebay api site to generate the callname list is in index.js code as comment:

    var apiCallNames = [];
    $("table tr td:first-child a").each(function(a,b,c) { apiCallNames.push(b.text); });
    console.log(JSON.stringify(apiCallNames));
    // from chrome console url: developer.ebay.com/Devzone/xml/docs/Reference/eBay/index.html
]

It is **only trading api**. Only ebay trading api. It is separate because it use only xml protocol and there are no other way to comminicate with trading api.

Its variable scope is simple, clean, no massive reference to local variable, strong isolation.

Code improvements
=================


Separate concerns:
  1. request creation in its own class, then use strategy pattern: what is rMode (request mode)?
    'json', 'xmlNode', 'xmlString' and ... how to extend it? function or
     {preparse:function(opts), create:function(opts), createHeaders: function(opts) }
  1. parse response: parseMode == 'json' or ... function(opts)

Rationale:
* testing: make ebayXml2JsonParse testable
* improving api. i.e. callname based options
  Files folder image Files  
File Role Description
Files folder imagespec (3 files)
Accessible without login Plain text file api-info.json Data ebay api info
Plain text file index.js Class the module file
Accessible without login Plain text file package.json Data npm info
Accessible without login Plain text file README.md Doc. readme

  Files folder image Files  /  spec  
File Role Description
  Accessible without login Plain text file app-credential-ex.json Data data for test
  Accessible without login Plain text file README Doc. test info
  Accessible without login Plain text file test-trading-spec.js Test test

 Version Control Unique User Downloads Download Rankings  
 100%
Total:75
This week:1
All time:457
This week:10Up