Realy needs some more testing! This library can also be used with "modern" browsers using porter.js http://github.com/hij1nx/Porter
var cebelcaAPI = require('./lib/cebelcabiz-api.js')
Run tests with:
npm test
Make docs with:
npm start
Resource: POST https://www.cebelca.biz/API?_r=invoice-sent&_m=insert-into
'title' : '2011-0001', 'date_sent' : '2011-01-02', 'date_to_pay' : '2011-04-12', 'id_partner' : 1
Add invoice head and get the id
[instance].invoice.create(
{},
{"title":"2011-0001","date_sent":"2011-01-02","date_to_pay":"2011-04-12","id_partner":1},
function(error, response) {
// do something...
}
);
Resource: POST https://www.cebelca.biz/API?_r=invoice-sent&_m=insert-into
'title' : 'programming service', 'qty' : 10, 'mu' : 'piece', 'price' : 120, 'vat' : 20, 'discount' : 0, 'id_invoice_sent' : 1
Add invoice body line and get the id - invoice can have multiple body lines
[instance].invoice.add(
{},
{"title":"programming service","qty":10,"mu":"piece","price":120,"vat":20,"discount":0,"id_invoice_sent":1},
function(error, response) {
// do something...
}
);
Resource: POST https://www.cebelca.biz/API?_r=partner&_m=assure
'name' : 'My Company', 'street' : 'Downing street', 'postal' : 'E1w201', 'city' : 'London'
Assure partner (add if it doesn't exits and get the id, otherwise just get the id)
[instance].invoice.assignPartner(
{},
{"name":"My Company","street":"Downing street","postal":"E1w201","city":"London"},
function(error, response) {
// do something...
}
);
Resource: POST https://www.cebelca.biz/API?_r=invoice-sent&_m=delete
'id_partner' : 10
Delete partner based on partner_id
[instance].invoice.delete(
{},
{"id_partner":10},
function(error, response) {
// do something...
}
);
Export PDF based on invoice_id
[instance].generate.pdf(
{"invoice_id":10},
{},
function(error, response) {
// do something...
}
);
Export Word doc based on invoice_id
[instance].generate.doc(
{"invoice_id":10},
{},
function(error, response) {
// do something...
}
);
Export OO otf based on invoice_id
[instance].generate.otf(
{"invoice_id":10},
{},
function(error, response) {
// do something...
}
);
Resource: POST https://www.cebelca.biz/API?_r=partner&_m=select-all
List all partners
[instance].partner.list(
{},
{},
function(error, response) {
// do something...
}
);
Resource: POST https://www.cebelca.biz/API?_r=partner&_m=assure
'name' : 'My Company', 'street' : 'Downing street', 'postal' : 'E1w201', 'city' : 'London'
Assure partner (add if it doesn't exits and get the id, otherwise just get the id)
[instance].partner.get_add(
{},
{"name":"My Company","street":"Downing street","postal":"E1w201","city":"London"},
function(error, response) {
// do something...
}
);
Resource: POST https://www.cebelca.biz/API?_r=partner&_m=delete
'id_partner' : 10
Delete partner based on id_partner
[instance].partner.delete(
{},
{"id_partner":10},
function(error, response) {
// do something...
}
);