Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
printify-node-api
Advanced tools
Readme
npm install printify-node-api
Just require the Printify class by typing:
const Printify = require('printify-node-api');
const API = Printify.getInstance( 'myShopId', options)
Parameters:
shopID
: Your Printify shop ID
options
: A configuration object with the following properties:
version
- default "v1"
: The Printify API version.authKey
: Your printify API keymode
- default undefined
: Can be set to "debug"
to print additional information to the consoleproducts
collectionAccess your products via API.products
and the respective method.
//Create a product
API.products.create(payload);
//Get all products
API.products.getAll()
.then(response => console.log(response.data))
.catch( err => console.log(err.message));
//Get a single product
API.products.getById('yourProductId')
.then(response => console.log(response.data))
.catch( err => console.log(err.message));
//Update a product
API.products.update('yourProductId', payload);
//Delete a product
API.products.delete('yourProductId');
//Publish a new product
//TODO
//Unpublish a published product
//TODO
orders
collectionAccess your orders via API.orders
and the respective method.
//Create an order
API.orders.create(payload);
//Get all orders
API.orders.getAll()
.then(response => console.log(response.data))
.catch( err => console.log(err.message));
//Get a single order
API.orders.getById('yourProductId')
.then(response => console.log(response.data))
.catch( err => console.log(err.message));
//Update an order
API.orders.update('yourProductId', payload);
//Delete an order
API.orders.delete('yourProductId');
//Send an order to production
//TODO
//Calculate shipping costs of an order
//TODO
webhooks
collection//TODO
If you use the printify-node-api in combination with express, you can register an endpoint for the printify webhooks. Events will be sent to the defined endpoint and whenever and event arrives at this endpoint, the printify-node-api will emit an event of the event type that has been received.
You can then listen to these events and implement your own handlers to react to these events.
WARNING: Printify does not provide webhooks for local test environments. This feature can only be used in production or if your express server is reachable.
const express = require('express');
const app = express();
/** Your express setup **/
//Register an endpoint for your events
API.registerWebhookEndpoint(app, '/webhooks', whsec);
//Listen to events. Only events with a registered webhook will be fired by printify
// The event will be passed to the listener
API.on('order:created', (event) => {
/*** your listener implementation***/
})
//TODO
For information about printify's events please visit the Printify API Reference
FAQs
A small API implementation to communicate with your printify shops
The npm package printify-node-api receives a total of 2 weekly downloads. As such, printify-node-api popularity was classified as not popular.
We found that printify-node-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.