Shirts.io Javascript Wrapper
Introduction
Shirts.io is a t-shirt printing and fulfillment platform that lets you print and ship shirts anywhere in the world on demand.
Create an Account
Creating an account is simple and quick! Create an account here.
After creating an account, you will be given a unique API key to grant you access to the Shirts.io API.
How it works
The Shirts.io API is broken up into four main components:
-
Products API
- View our entire product selection
- Access thousands of high-quality product images
- View product specifications, available colors, available sizes
- Check stock levels before placing an order
-
Quote API
- Get an exact quote before placing an order
-
Order API
- Place an order
- Upload artwork and all order details
-
Status API
- Check the current status of your order
- Receive tracking numbers when available
You can learn more by reading the API Manual
Installation
Requirements
- Node.js
- npm (Node.js Package Manager)
npm install needle
clone source shirtsio.js
Usage
var api_key = 'abc'; // secret Shirts.io API key var shirtsio = require('shirtsio.js')(api_key); shirtsio.products.list_categories( function(err, response) { if (err) { console.log(err); return; } console.log(response); console.log(response.length); } );
Detail see example.js
API Basics
Authentication
Our API uses an API key authentication system. When you create an account, you will be given a unique API key. Every call you make through the shirts.io API must include this key.
Errors
HTTP Status Code Summary
200 OK - Request successfully delivered.
400 Bad Request - Parameters invalid.
401 Unauthorized - API key was invalid or deactivated.
402 Request Failed - Request failed on server end.
Product Sizes
xxsml - 2XSmall
xsml - XSmall
sml - Small
med - Medium
lrg - Large
xlg - XLarge
xxl - 2XLarge
xxxl - 3XLarge
xxxxl - 4XLarge
xxxxxl - 5XLarge
xxxxxxl - 6XLarge
Please see https://www.shirts.io/docs/getting_started/ for the most up-to-date documentation.
API Specifics
All methods takes a callback as their last parameter. The callback is called with a Javascript
Error
(if any) and then the response.
-
shirtio.products
- retrieve categories, products and inventory-
.list_categories
- retrieve categories -
.list_products(category_id)
- retrieve products -
.get_product(product_id)
- retrieve product -
.inventory_count(product_id, color, state)
- retrieve inventory count
-
-
shirtio.status
- retrieve status information-
.check_order_status(parameter)
- retrieve current status on the order
-
-
shirtio.quote
- retrieve quote-
.get_quote(parameters)
- retrieve quote
-
-
shirtio.billing
- retrieve payment information and update payment status-
.payment(parameters)
- retrieve payment information -
.update_payment_status(parameters)
- update payment status
-
-
shirtio.webHook
- add, delete, retrieve webhook(s) and add payment webhook-
.add_webhook(parameters)
- add webhook -
.delete_webhook(url)
- delete webhook -
.list_webhook
- retrieve webhooks -
.add_payment_webhook(url)
- add payment webhook
-
-
shirtio.order
- Placing an Order-
.place_order(parameters)
- placing an Order
-
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request