Package Exports
- stamps-api
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 (stamps-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Stamps.com node.js client
A client for stamps.com API.
Sign up with stamps.com developer program to receive credentials to the API.
##Installation npm install stamps-api
##API
###Create client Create client for work with Stamps api.
var Stamps = require('stamps-api');###Auth client For use most api's you need auth with your Stamps account data
Stamps.connect().then(() => {
Stamps.auth(options).then(() => {
console.log(options);
});
});- options - is a object with fields
- auth function has 2 parameter type of bool, if his true make request for get auth token from stamps else use creaditials as auth data(by default false)
- connect - this function have parameter type of object with property isDev for enable dev mode
Exmaple:
Stamps.connect({isDev: true}).then(() => {
Stamps.auth(options).then(() => {
console.log(options);
});
});{
"id": "your_integrations_stamps_id",
"username": "you_stmaps_username",
"password": "you_stmaps_password"
}###Make request For send requests to stamps use this api after connect and auth. Example get track number.
Stamps.request('TrackShipment', {
TrackingNumber: 'needed_track_Number'
}).then(function(trackingResponse) {
console.log(trackingResponse);
});#Run test
Before run test set env variables you stamps auth data:
STAMPS_ID
STAMPS_USERNAME
STAMPS_PASSWORDnpm test