Overview
Our REST API is a REST-ful implementation for print-on-demand services. You must be authorized and registered to use these services and access is granted on a case by case basis. If you are interested in access, please use the contact form on the website and drop us a note with your project ideas and needs and we'll be glad to see how we can work together.
Basic Sytax
Below is the basic syntax when communicating with the Shortrunposters.com API:
[rest-verb] https://api.shortrunposters.com/rest/v1/[resource-path]?[param-name]=[param-value]
Common Headers Parameters
API Key
This header is required in all calls and also used in creating a session token.
Header Name: X-DreamFactory-Application-Name
Header Value: shortrunposters-api-v1
Session Token
For all authenticated requests made (outside of the browser session control) after logging in, to the API, you’ll need to pass the session_id
received in the login response along with each call to authenticate the request. This can currently only be done in the following way...
Header Name: X-DreamFactory-Session-Token
Header Value: your-session-id
Authentication
Access to any service or data components will require authentication. To authenticate a user, simply POST a JSON string to /user/session that takes on the following format: {“email":"email_value", “password":"password_value"}
If successful, in the response, you’ll see a session_id indicating that a new session has been created.
Very Important: For all future requests to the API, you’ll need to pass the session_id as a new request header called X-DreamFactory-Session-Token .
Basic HTTP Authentication is also available. You can pass the authorization header and your base64 encoded username:password as the value. This enables you to post without first creating a session.
Header Name: Authorization
Header Value: Basic username:password
Sandbox vs. Live
All examples given are using the Live API. When you are initially created an account, you will be granted access to a Sandbox API that mimics the Live API in every way. To use the Sandbox API, simply replace the header:
Header Name: X-DreamFactory-Application-Name
Header Value: shortrunposters-sandbox-sv1
You'll also need to change the url you're making calls to:
Header Name: https://api.shortrunposters.com/rest/sv1
Curl Examples
// login - POST to /user/session
Use returned session_id as X-DreamFactory-Session-Token header in subsequent calls
curl -i -k -X POST https://api.shortrunposters.com/rest/user/session \ -H "X-DreamFactory-Application-Name: shortrunposters-api-v1" \ -d '{ "email" : "[email protected]", "password" : "yourpassword" }'
// Get products list
This returns all available products
curl -i -k -X GET https://api.shortrunposters.com/rest/v1/products \ -H "X-DreamFactory-Application-Name: shortrunposters-api-v1" \ -H "X-DreamFactory-Session-Token: bhc7lov8r41h4cbn6pue1r63gbgh7jf6"
// Get all order records
This returns base order data, not any item, product, status or shipping related info
curl -i -k -X GET https://api.shortrunposters.com/rest/v1/orders \ -H "X-DreamFactory-Application-Name: shortrunposters-api-v1" \ -H "X-DreamFactory-Session-Token: bhc7lov8r41h4cbn6pue1r63gbgh7jf6"
// Get a particular record with related data
This returns a record with related data: item, product, status and shipping
curl -i -k -X GET https://api.shortrunposters.com/rest/v1/orders/100001?related=* \ -H "X-DreamFactory-Application-Name: shortrunposters-api-v1" \ -H "X-DreamFactory-Session-Token: bhc7lov8r41h4cbn6pue1r63gbgh7jf6"
// Post a record to orders
Post a record to orders table with one item
curl -i -k -X POST https://api.shortrunposters.com/rest/v1/orders \ -H "X-DreamFactory-Application-Name: shortrunposters-api-v1" \ -H "X-DreamFactory-Session-Token: 1v6kf9f11t49v4jliupc3ih297" \ -d "{ \"record\": [{ \"orderNumber\": \"CD12340000209\", \"supplierName\": \"Amazon.com\", \ \"shipFirstName\": \"Mike\", \"shipLastName\": \"Smith\", \"shipToAddressLine1\": \ \"120 20th Avenue South\", \"shipToCity\": \"Nashville\", \"shipToState\": \"TN\", \ \"shipToPostalCode\": \"37203\", \"shipToCountry\": \"US\", \"items_by_orderId\": \ [ { \"itemId\": 8, \"extSKU\": \"A120P1654\", \"name\": \"Stars Poster\", \"quantity\": \ 1, \"description\": \"Stars Poster\"} ] }]}"
// Log out and end session
End your session...
curl -i -k -X DELETE https://api.shortrunposters.com/rest/user/session \ -H "X-DreamFactory-Application-Name: shortrunposters-api-v1" \ -H "X-DreamFactory-Session-Token: 1v6kf9f11t49v4jliupc3ih297"
Resources
Orders
https://api.shortrunposters.com/rest/v1/orders
Verbs: POST & GET
Field |
Required |
Note |
id | N/A | System Use Only - Auto generated order number |
orderNumber | Yes | Your order number |
orderDate | No | Date of order (Your order date) |
ownerId | N/A | System Use Only - Auto Generated |
supplierName | Yes | Supplier Name (Your company name) |
supplierCode | No | Supplier Code |
thirdPartyName | No | 3rd Party Shipment Company Name |
thirdPartyAccount | No | 3rd Party Shipment Account Number |
shipFirstName | Yes | Shipping address first name |
shipLastName | Yes | Shipping address last name |
shipCompany | No | Shipping address company name |
shipToAddressLine1 | Yes | Shipping address street line 1 |
shipToAddressLine2 | No | Shipping address street line 2 |
shipToAddressLine3 | No | Shipping address street line 3 |
shipToCity | Yes | Shipping address city |
shipToState | Yes | Shipping address state |
shipToPostalCode | Yes | Shipping address postal code |
shipToCountry | No | Shipping address country |
shipToPhone | No | Shipping address phone number |
shipToEmail | No | Shipping address email address |
billFirstName | No | Billing address first name |
billLastName | No | Billing address last name |
billCompany | No | Billing address company |
billToAddressLine1 | No | Billing address street line 1 |
billToAddressLine2 | No | Billing address street line 2 |
billToAddressLine3 | No | Billing address street line 3 |
billToCity | No | Billing address city |
billToState | No | Billing address state |
billToPostalCode | No | Billing address postal code |
billToCountry | No | Billing address country |
billToPhone | No | Billing address phone number |
billToEmail | No | Billing address email |
requestedShippingMethod | Yes | Shipping method to be used for shipment |
requestedShippingCarrier | Yes | Shipping carrier to be used for shipment |
completed | N/A | System Use Only |
orderStatus | N/A | System Use Only - will show current status of order |
orderURL | No | URL for misc order info image (8.5" x 11" scale) |
packingURL | No | URL of packing slip image (8.5" x 11" scale) |
shippingURL | No | URL of shipping label image (8.5" x 11" scale) |
cartonURL | No | URL of carton sheet image (8.5" x 11" scale) |
notes | No | Notes on order - internal use only |
createdDate | N/A | System Use Only - date of record creation |
modifiedDate | N/A | System Use Only - date of most recent modification |
Below are the item object fields
Field | Required |
Note |
id | N/A | System Use Only - Auto generated item id |
orderId | N/A | Order Id reference |
ownerId | N/A | System Use Only - Auto generated owner id |
itemId | Yes | The product id that this item references |
extSKU | No | External client item ID or sku |
name | No | Name of item |
quantity | Yes | Item quantity |
description | No | Item description |
itemURL | No | External URL for print file |
createdDate | N/A | Created date of record |
modifiedDate | N/A | Modified date of record |
Below is a JSON response for an order and all related data. Shown is the order data, related item data, related product data, realated shipping entries and related status entries.
{ "id": 20, "orderNumber": "CD12340000200", "orderDate": "2015-02-02 16:56:17", "ownerId": 1, "supplierName": "Art Company ABC", "supplierCode": null, "thirdPartyName": null, "thirdPartyAccount": null, "shipFirstName": "John", "shipLastName": "Smith", "shipCompany": null, "shipToAddressLine1": "1200 Main Street", "shipToAddressLine2": null, "shipToAddressLine3": null, "shipToCity": "Nashville", "shipToState": "TN", "shipToPostalCode": "37203", "shipToCountry": "US", "shipToPhone": null, "shipToEmail": null, "billFirstName": null, "billLastName": null, "billCompany": null, "billToAddressLine1": null, "billToAddressLine2": null, "billToAddressLine3": null, "billToCity": null, "billToState": null, "billToPostalCode": null, "billToCountry": null, "billToPhone": null, "billToEmail": null, "requestedShippingMethod": null, "requestedShippingCarrier": null, "completed": false, "orderStatus": "shipped", "orderURL": null, "packingURL": null, "shippingURL": null, "cartonURL": null, "notes": null, "createdDate": "2015-02-03 12:40:12", "modifiedDate": "2015-02-03 12:46:08", "items_by_orderId": [ { "id": 4, "orderId": 20, "ownerId": 1, "itemId": 8, "extSKU": "A120P1654", "name": "Stars Poster", "quantity": 1, "description": "Stars Poster", "itemURL": null, "createdDate": "2015-02-03 12:40:12", "modifiedDate": "2015-02-03 12:40:12" } ], "products_by_items": [ { "id": 8, "type": "Poster", "SKU": "PP18", "name": "18x24", "description": "18x24 Poster Print", "paperType": "80# Coated Cover", "height": 24, "width": 18, "weight": 0, "notes": null } ], "shipments_by_orderId": [ { "id": 1, "orderId": 20, "ownerId": 1, "orderNumber": "CD12340000200", "trackingNumber": "1Z94A6A20392226413", "shippingMethod": "", "shippingCarrier": "UPS", "shippingCost": 10.17, "totalCharges": 0, "totalWeight": 0, "comments": null, "shippedDate": "2015-02-03 06:00:00", "processedDate": "0000-00-00 00:00:00", "createdDate": "0000-00-00 00:00:00", "modifiedDate": "2015-02-03 12:46:09" } ], "statuses_by_orderId": [ { "id": 1, "orderId": 20, "ownerId": 1, "status": "prepress", "comments": "", "createdDate": "0000-00-00 00:00:00", "modifiedDate": "2015-02-03 12:43:51" }, { "id": 2, "orderId": 20, "ownerId": 1, "status": "printed", "comments": "", "createdDate": "0000-00-00 00:00:00", "modifiedDate": "2015-02-03 12:44:33" }, { "id": 3, "orderId": 20, "ownerId": 1, "status": "shipped", "comments": "UPS Ground - 1Z94A6A20392226413", "createdDate": "0000-00-00 00:00:00", "modifiedDate": "2015-02-03 12:46:09" } ] }
Products
https://api.shortrunposters.com/rest/v1/products
Verbs: GET
Field | Required |
Note |
id | N/A | Product ID |
type | N/A | Product Type (Poster, Framed Poster, etc.) |
SKU | N/A | Internal SKU identifier |
name | N/A | Common product name |
description | N/A | Description of product |
paperType | N/A | Paper type |
height | N/A | Product height |
width | N/A | Product width |
weight | N/A | Product weight |
notes | N/A | Product notes |
Below is a JSON response for the first four products only
{ "record": [ { "id": 1, "type": "Poster", "SKU": "PP08", "name": "8x10", "description": "8x10 Poster Print", "paperType": "80# Coated Cover", "height": 10, "width": 8, "weight": 0, "notes": null }, { "id": 2, "type": "Poster", "SKU": "PP09", "name": "9x12", "description": "9x12 Poster Print", "paperType": "80# Coated Cover", "height": 12, "width": 9, "weight": 0, "notes": null }, { "id": 3, "type": "Poster", "SKU": "PP10", "name": "11x14", "description": "11x14 Poster Print", "paperType": "80# Coated Cover", "height": 14, "width": 11, "weight": 0, "notes": null }, { "id": 4, "type": "Poster", "SKU": "PP11", "name": "11x17", "description": "11x17 Poster Print", "paperType": "80# Coated Cover", "height": 17, "width": 11, "weight": 0, "notes": null } ] }
Shipments
https://api.shortrunposters.com/rest/v1/shipments
Verbs: GET
Field | Required |
Note |
id | N/A | Shipment ID |
orderId | N/A | Internal order ID |
ownerId | N/A | Owner ID |
orderNumber | N/A | Your order number |
trackingNumber | N/A | Tracking number |
shippingMethod | N/A | Shipping method (Ground, 2nd Day, etc.) |
shippingCarrier | N/A | Shipping Carrier (UPS, FedEx, etc.) |
shippingCost | N/A | Shipping cost |
totalCharges | N/A | Total shipping charges |
totalWeight | N/A | Shipping weight |
comments | N/A | Shipping Comments |
shippedDate | N/A | Date of shipment |
processedDate | N/A | Date shipment was processed |
createdDate | N/A | Created date of record |
ModifiedDate | N/A | Modified date of record |
Below is a JSON response for a shipment record
{ "id": 1, "orderId": 20, "ownerId": 1, "orderNumber": "CD12340000200", "trackingNumber": "1Z94A6A20392226413", "shippingMethod": "Ground", "shippingCarrier": "UPS", "shippingCost": 10.17, "totalCharges": 10.17, "totalWeight": 5, "comments": null, "shippedDate": "2015-02-03 06:00:00", "processedDate": "0000-00-00 00:00:00", "createdDate": "0000-00-00 00:00:00", "modifiedDate": "2015-02-03 12:46:09" }
Order Status
*A note about order status - the status of the order is also updated on the Orders table. Statuses are updated live as an order travels through production.
https://api.shortrunposters.com/rest/v1/status
Verbs: GET
Field | Required |
Note |
id | N/A | Shipment ID |
orderId | N/A | Internal order ID |
ownerId | N/A | Owner ID |
orderNumber | N/A | Your order number |
status | N/A | Status of order |
comments | N/A | Status comments |
createdDate | N/A | Created date of record |
ModifiedDate | N/A | Modified date of record |
Below is a JSON response for a status record
{ "id": 1, "orderId": 20, "ownerId": 1, "orderNumber": "CD12340000200", "status": "prepress", "comments": "", "createdDate": "0000-00-00 00:00:00", "modifiedDate": "2015-02-03 12:43:51" }
Webhooks
A method to create webhooks to send a JSON formatted response of a status update or shipment update to a defined URL. You can only have two webhooks, one each for shipments and status updates.
https://api.shortrunposters.com/rest/v1/webhooks
Verbs: GET, POST & DELETE
Field | Required |
Note |
id | N/A | Webhook ID |
ownerId | N/A | Owner ID |
url | N/A | The URL where the JSON response is to be sent |
type | N/A | Type of webhook ("tracking" or "status" |
createdDate | N/A | Created date of record |
ModifiedDate | N/A | Modified date of record |
Below is a JSON response for a status record
{ "record": [ { "id": 7, "ownerId": 2, "url": "http://api.mywebsite.com/werufjj1273", "type": "tracking", "createdDate": "2015-02-05 13:58:57", "modifiedDate": "2015-02-05 13:58:57" }, { "id": 9, "ownerId": 2, "url": "http://api.mywebsite.com/17u9uh21", "type": "status", "createdDate": "2015-02-05 14:20:14", "modifiedDate": "2015-02-05 14:20:14" } ] }