insane-openbazaar-api
Openbazaar API client. It's just a curl wrapper. WARNING: Incomplete implementation!!
Installation
Usage
var OpenBazaarAPI = require('insane-openbazaar-api');
var ob = new OpenBazaarAPI({
"username": "chris_grimmett",
"password": "rosebud"
});
ob.login(function(err) {
if (err) throw err;
ob.profile(function(err, reply) {
if (err) throw err;
console.log(reply.profile.short_description);
ob.profile(function('a06aa22a38f0e62221ab74464c311bd88305f88c', err, reply) {
if (err) throw err;
console.log(reply.profile.website);
});
});
});
Convenience methods
ob.login
and ob.profile
are simple wrappers to the OpenBazaar-Server API endpoints. You have to make sure that your app is logged into the OpenBazaar-Server before you can call ob.profile
. If the OpenBazaar-Server restarts while your API client is running, your past authentication cookies are invalidated and you have to log in again. This means you have to write extra code to check the state of your login, which can be annoying. To make your job easier, I've made a convenience method for getting information from the API. Just call it and expect a response. Calling .get() will ensure that you have a valid authentication cookie and you're able to receive information from the API.
ob.get('profile', 'a06aa22a38f0e62221ab74464c311bd88305f88c', function(err, reply) {
if (err) throw err;
console.log(reply.profile.handle);
});
Implemented API
Notes
The OpenBazaar-Server API is defined as API blueprint format
Roadmap