1.0.1 • Published 2 years ago

@subscriptionflow-developer/subscriptionflow-node v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

SubscriptionFlow Node Client Library - API v1

This is the node.js Library for integrating with SubscriptionFlow. Sign up for a SubscriptionFlow account here.

License

MIT

Getting started

Getting authentication information

This library is intended to interact with the Subscription Flow api, so first of all we need an account there. Once you are logged in your account you can get the base url of your instance in the address bar, it should look like "https://example.subscriptionflow.com". Then you should go to Administration Settings > USERS AND CONTROL > OAuth Clients, there you can create the OAuth Client and copy the client id and client secret.

Starting to code

Inside a node project you can install the library running:

npm i @subscriptionflow-developer/subscriptionflow-node
const SFlow = require('@subscriptionflow-developer/subscriptionflow-node');
var sFlow = new SFlow(base_url, client_id, client_secret);
//Get all the products
products = await sFlow.products.get();
//Get a product by id
product = await sFlow.products.getById(recordId);
let createRecordData = {
    "name": "Test product",
    "description": "Test product created using api",
    "type": "Base Products",
    "status": "Active"
}

//Create Record
product = await sFlow.products.create(createRecordData);
let updateRecordData = {
    "name": "Edited Test product"
}

//Update record
product = await sFlow.products.updateById(recordId, updateRecordData);
//Delete record
product = await sFlow.products.deleteById(recordId);