Node.js Pixc API bindings. API docs available here: https://pixc.com/api
npm install --save pixc-api-node
Creates a new PixcApiNode
instance.
options
- Optional - A plain JavaScript object that contains the configuration options.
token
- Required (String) - Access token obtained from https://pixc.com/dashboard/account/api page.test
- Optional (Boolean) - Enables or disables test mode. In this mode no real changes will be made. Only returns mock data.
A PixcApiNode
instance.
const PixcApiNode = require('pixc-api-node');
const pixcApiNode = new PixcApiNode({
token: 'YOUR_TOKEN',
test: true
});
pixcApiNode.get('order', { limit: 5 }).then(
orders => console.log(orders),
err => console.log(err)
);
[
{
"orderId": 1,
"status": 0,
"payment": "paid",
"templateId": 1
}
]
pixcApiNode.put('template/1', { active: false }).then(
template => console.log(template),
err => console.log(err)
);
{
"templateId": 1,
"active": false
}
pixcApiNode.post('order', { files: [
{
url: 'https://via.placeholder.com/600',
name: 'Placeholder.jpg'
}
] }).then(
order => console.log(order),
err => console.log(err)
);
{
"orderId": 1,
"status": 0,
"payment": "paid",
"templateId": 1
}
pixcApiNode.remove('tempalte/1').then(
() => console.log('SUCCESS'),
err => console.log(err)
);