moltin util
Tool for working with the Moltin API. Plus: promises and CLI.
install
$ npm install moltin-util
Or for the CLI:
$ npm install -g moltin-util
example
Upload an image:
var MoltinUtil = ; var client = ; client // opts for api: https://docs.moltin.com/images/ ;
Get a list of products:
;var client = publicId: processenvPUBLIC_ID secretKey: processenvSECRET_KEY; client ;
Create a product. Takes an optional array of images.
;var client = publicId: processenvPUBLIC_ID secretKey: processenvSECRET_KEY; var product = title: 'Bulk Glass Eye Charms' price: 30 description: 'Eye charms' slug: 'bulk-glass-eye-charms' sku: 'bulk-glass-eye-charms' status: 1 category: '123' stock_level: '1' stock_status: 1 requires_shipping: 1 catalog_only: 0 tax_band: '123'; var images = 'http://example.com/image.jpg'; client ;
command line
$ npm install -g moltin-util
Fetch data from the API and print it to stdout. It looks for a .moltin-utilrc
file in the normal places (like your home directory), or authentication keys can be passed in as environment variables.
; .moltin-utilrc PUBLIC_ID=123SECRET_KEY=123
examples
GET request to flows
endpoint:
$ moltin flows
Additional path segments are just added on as arguments:
Call https://api.molt.in/v1/flows/products/fields
:
$ moltin flows products fields