Package Exports
- convictional
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (convictional) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Introduction
This is the Node.JS client library for the Convictional Commerce API.
For more documentation, please visit our docs site here.
This is the best way to build apps on Convictional. This library offers complete test coverage across all RPC and REST endpoints and is used in production for all integration work that we do.
The library will be updated as the API changes so ensure you keep it up to date.
To install, type:
npm install convictional
Config
You can optionally pass configurations like your API key or API URL in like so:
// Top of your file with all your requires:
var convictional = require('convictional')({
'apiKey': '86e7ccdc-55b5-4066-a79f-7a1e0e59c690'
})
// ... later where you want to use it:
var orderId = '5a692f658f6d524e8282dac7'
convictional.getOrder(orderId).then((order) => {
console.log(order)
}).catch((error) => { console.error(error) })
Or you can pass configurations on a call-specific basis:
// Top of your file with all your requires:
var convictional = require('convictional')
// ... later where you want to use it:
var apiKey = '86e7ccdc-55b5-4066-a79f-7a1e0e59c690'
var orderId = '5a692f658f6d524e8282dac7'
convictional.getOrder(orderId, apiKey).then((order) => {
console.log(order)
}).catch((error) => { console.error })
Methods
- Methods start with the HTTP method and end with the resource: getOrders, postProducts, etc.
- The first parameter is a string, object or array with the payload for the request.
- The optional second parameter is the API key for the account you are using.
- The optional third parameter is the API URL, defaults to main API url: https://api.convictional.com.
- All methods return promises, so you must use then/catch verbs to handle them.
Method usage example:
var query = { 'shipped': false }
getOrders(query)
.then((orders) => { console.log(orders) })
.catch((error) => { console.error(error) })
List of methods:
Actions (RPC)
sync(method)
- GET (runs and queues) one method, by method nametranslate(doc)
- POST (translate) one document, by document
Orders (REST)
getOrder(id)
- GET (read) one order, by IDgetOrders(query)
- GET (read) many orders, by querypostOrder(order)
- POST (create) one new order, by order objectpostOrders(orders)
- POST (create) many new orders, by array of ordersputOrder(order)
- PUT (update) one order, by order objectputOrders(orders)
- PUT (update) many orders, by array of ordersdeleteOrder(id)
- DELETE (delete) one order, by IDdeleteOrders(ids)
- DELETE (delete) many orders, by array of IDs
Products (REST)
getProduct(id)
- GET (read) one product, by IDgetProducts(query)
- GET (read) many products, by querypostProduct(product)
- POST (create) one new product, by product objectpostProducts(products)
- POST (create) many new products, by array of productsputProduct(product)
- PUT (update) one product, by product objectputProducts(products)
- PUT (update) many products, by array of productsdeleteProduct(id)
- DELETE (delete) one product, by IDdeleteProducts(ids)
- DELETE (delete) many products, by array of IDs
Partners (REST)
getPartner(id)
- GET (read) one partner, by IDgetPartners(query)
- GET (read) many partners, by querypostPartner(partner)
- POST (create) one new partner, by partner objectpostPartners(partners)
- POST (create) many new partners, by array of partnersputPartner(partner)
- PUT (update) one partner, by partner objectputPartners(partners)
- PUT (update) many partners, by array of partnersdeletePartner(id)
- DELETE (delete) one partner, by IDdeletePartners(ids)
- DELETE (delete) many partners, by array of IDs
Prices (REST)
getPrice(id)
- GET (read) one price, by IDgetPrices(query)
- GET (read) many prices, by querypostPrice(price)
- POST (create) one new price, by price objectpostPrices(prices)
- POST (create) many new prices, by array of pricesputPrice(price)
- PUT (update) one price, by price objectputPrices(prices)
- PUT (update) many prices, by array of pricesdeletePrice(id)
- DELETE (delete) one price, by IDdeletePrices(ids)
- DELETE (delete) many prices, by array of IDs
Logs (REST)
getLog(id)
- GET (read) one log, by IDgetLogs(query)
- GET (read) many logs, by querypostLog(log)
- POST (create) one new log, by log objectpostLogs(logs)
- POST (create) many new logs, by array of logsputLog(log)
- PUT (update) one log, by log objectputLogs(logs)
- PUT (update) many logs, by array of logsdeleteLog(id)
- DELETE (delete) one log, by IDdeleteLogs(ids)
- DELETE (delete) many logs, by array of IDs