The Stateset Node.js Library provides convenient access to the Stateset API from applications written in server-side JavaScript.
Install the package with:
npm install stateset-node --save
The package needs to be configured with your account's secret key, which is available in the Stateset Cloud Platform Dashboard.
- Go to the Stateset Cloud Platform Dashboard.
- Login with your Stateset account.
- Create an API key.
- Try the Node.js quickstart
See the Node.js quickstart for complete code.
- Install the SDK package
npm install stateset-node
- Initialize the client
import stateset from 'stateset-node';
const client = new stateset({apiKey: process.env.STATESET_API_KEY});
- Make an API call
try {
const response = await client.returns.list();
const returns = response.returns;
console.log(returns);
} catch (error) {
console.error('Error fetching returns:', error);
}
This repository contains sample Node and web apps demonstrating how the SDK can access and utilize the Stateset API for various use cases.
To try out the sample Node app, follow these steps:
- Check out the Stateset Node.js Library repository.
- Obtain an API key from the Stateset Cloud Platform Dashboard.
- Navigate to the
samples
folder and runnpm install
. - Set your API key as an environment variable:
export STATESET_API_KEY=YOUR_API_KEY
. - Open the sample file you're interested in, e.g.,
returns_list.js
. - Run the sample file:
node returns_list.js
.
See the Stateset API Documentation for complete documentation.
See CONTRIBUTING.md for more information on contributing to the Stateset Node.js Library.
The contents of this repository are licensed under the Apache License, version 2.0.