API

General details on API communications

How to make API requests?

Each API request should include your identity by specifying AppID and Signature.

  • The AppID is static value which can be taken from your API Settings page.
  • The Secret Key is auto-generated value which can be taken from your API Settings page.
  • The Signature value will need to be generated on your end as SHA1 (request body + Secret Key).
    NOTE: The request body value is different for POST and GET methods:

    • If the POST method is used, the request body should include the entire content of the request.

    • If the GET method is used, the request body should include everything after the "?" symbol, excluding your Signature parameter.

Request formats

Requests can be made in either JSON or XML:

Requests: Requests sent using GET can use either JSON or XML formats. If you're using POST you'll need to specify the format of your requests using Content-Type. All answers to these requests will be in the same format as the format of request.
Answers: If you're using GET, the format of answers will need to be specified using the 'format' parameter. You can use either 'JSON' or 'XML' as the value - if omitted this will default to 'JSN'.

Creating and processing orders

What can you do with Order?

The API lets you do the following with the Order resource. More detailed versions of these general actions may be available:

Order Properties

id readonly
{"id": "23941"}
A unique numeric identifier for the order. This one is used by the shop owner and customer.
external_id writable
{"external_id": "TEST-234324"}
A unique numeric identifier for the internal customer order.
created_at readonly
{"created_at": "2016-10-17T15:07:08+01:00"}
By default, this auto-generated property is the date and time when the order was created in Snuggle.­Partners, in ISO 8601 format.
type readonly
{"type": "order"}
  • order - regular order
  • invoice - generate invoice for current account balance
  • credits - credit purchase
status readonly
{"status": "received"}
  • received
  • in progress
  • paid
  • stock allocation
  • printing
  • quality control
  • refunded
  • internal order query
deleted readonly
{"deleted": "false"}
If the order was cancelled, this value is "true."
brand writable
{"brand": "Snuggle.Partners"}
The name of one of the brands created on your profile page https://­www.­snuggle­par­tners.­co.­uk/­my-brands
billing_address readonly
{"billing_address": {
"firstName": "Simon",
"lastName": "Buckley",
"company": "Snuggle.Partners",
"address1": "Unit 2",
"address2": "Sabre Way",
"city": "Peterborough",
"county": "Cambridgeshire",
"postcode": "PE1 5EJ",
"country": "United Kingdom",
"phone1": "+44 (0)330 043 0219",
"phone2": "",
"phone3": "",
"vatNumber": "GB834373719"
}}
The billing address associated with the creator account. This auto-generated property based on your profile details https://­www.­snuggle­par­tners.­co.­uk/­profile. It has the following properties:
  • address1: The street address of the billing address.
  • address2: An optional additional field for the street address of the billing address.
  • city: The city of the billing address.
  • company: The company of the person associated with the billing address.
  • country: The name of the country of the billing address.
  • firstName: The first name of the person associated with the payment method.
  • lastName: The last name of the person associated with the payment method.
  • phone1: The phone number at the billing address.
  • phone2: The mobile number at the billing address.
  • phone3: The fax number at the billing address.
  • county: The name of the state or province of the billing address.
  • postcode: The zip or postal code of the billing address.
  • vatNumber: The VAT number of the billing address.
shipping_­address writable
{"shipping_address": {
"firstName": "Simon",
"lastName": "Buckley",
"company": "Snuggle.Partners",
"address1": "Unit 2",
"address2": "Sabre Way",
"city": "Peterborough",
"county": "Cambridgeshire",
"postcode": "PE1 5EJ",
"country": "United Kingdom",
"phone1": "+44 (0)330 043 0219",
"phone2": "",
"phone3": "",
"vatNumber": "GB834373719"
}}
The mailing address to where the order will be shipped. It has the following properties:
  • address1: The street address of the shipping address.
  • address2: An optional additional field for the street address of the shipping address.
  • city: The city of the shipping address.
  • company: The company of the person associated with the shipping address.
  • country: The name of the country of the shipping address.
  • firstName: The first name of the person associated with the payment method.
  • lastName: The last name of the person associated with the payment method.
  • phone1: The phone number at the shipping address.
  • phone2: The mobile number at the shipping address.
  • phone3: The fax number at the shipping address.
  • county: The name of the state or province of the shipping address.
  • postcode: The zip or postal code of the shipping address.
items writable
"items": [
{
"pn": "JH001",
"title": "AWDis Girlie College Hoodie",
"price": "23.25",
"retailPrice": "20.00",
"quantity": "4",
"description": "Special instructions",
"brandName": "Snuggle.Partners",
"label": {
"type": "printed",
"name": "max-label",
"price": 1.44,
}
"designs": [
"back": "url",
"front": "url",
...
],
"mockups":[
"back": "url",
"front": "url",
...
]
}
]
A list of line item objects, each one containing information about an item in the order. Each item object has the following properties:
  • pn: The product code of the product variant.
  • title: The title of the product.
  • (readonly) price: The price of the item with applied discounts.
  • retailPrice: The reail price of the item (printed on invoice that will be send to customer with order)
  • quantity: The number of products that were purchased.
  • description: Comments or instructions fot he product.
  • brandName: Brand name, if not defined - then used brandName from order
  • label: The label details.
  • designs: A list of designs for print, each one containing information about a side of printing and link to file for printing.
  • mockup: A list of mockups, each one containing information about a side name and link to mockup file.
  • the following positions are supported for the position for artwork on the item: (please check the product you want to use for the available placements)
    • front - 'front'
    • back - 'back'
    • left sleeve - 'left sleeve'
    • right sleeve - 'right sleeve'
    • nape - 'nape'
    • inside neck - 'inside neck'
summary readonly
"summary": {
"currency": "GBP",
"subtotalPrice": "93.00",
"shippingPrice": "7.20",
"total": "100.20",
"totalTax": "16.70"
}
A order summary information. It has the following properties:
  • currency: The three letter code (ISO 4217) for the currency.
  • subtotalPrice: Price of the order before shipping and taxes
  • shippingPrice: The price of this shipping method.
  • total: The sum of all the prices of all the items in the order, taxes and discounts included
  • totalTax: The amount of tax to be charged.
shipping writable
"shipping": {
"shippingMethod": "courier",
"trackingNumber": "TF345435",
"shiped_at": "2016-10-17T16:17:08+01:00"
}
The shipping details. It has the following properties:
  • shippingMethod: A reference to the carrier service that provided the rate. Can be on of those values:
    • regular: Standard delivery
    • recorded: Recorded delivery
    • courier: Courier delivery
    • collection: Collection From Factory
  • (readonly) trackingNumber: The shipping number, provided by the shipping company.
  • (readonly) shiped_at: The date and time when the fulfillment was created. The API returns this value in ISO 8601 format.
payment readonly
"payment": {
"methodMethod": "Pay by Credit or Debit Card",
"paid_at": "2016-10-17T16:14:08+01:00"
}
An object containing information about the payment status. It has the following properties:
  • methodMethod: The name of the gateway the transaction was issued through.
  • paid_at: The date and time when the transaction was created. The API returns this value in ISO 8601 format.

Endpoints

GET /api/orders.php
Retrieve a list of Orders
ids A comma-separated list of order ids
limit Amount of results
(default: 50) (maximum: 250)
page Page to show
(default: 1)
since_id Restrict results to after the specified ID
created_at_min Show orders created after date (format: 2014-04-25T16:15:47-04:00)
created_at_max Show orders created before date (format: 2014-04-25T16:15:47-04:00)
status
  • received
  • in progress
  • paid
  • refunded
  • stock allocation
  • printing
  • quality control
  • refunded
  • internal order query
List all orders

GET /api/orders.php?AppId=APP-xxxxxxxx&Signature=xxxxxxxx

List all orders after the specified ID

GET /api/orders.php?AppId=APP-xxxxxxxx&Signature=xxxxxxxx&since_id=123

List of specific orders in XML format

GET /api/orders.php?AppId=APP-xxxxxxxx&Signature=xxxxxxxx&ids=10734,1599,1067&format=xml

GET /api/order.php
Retrieve a specific order
Get a representation of a single order

GET /api/order.php?AppId=APP-xxxxxxxx&Signature=xxxxxxxx&id=10734

Get a representation of a single order in XML format

GET /api/order.php?AppId=APP-xxxxxxxx&Signature=xxxxxxxx&id=10734&format=xml

GET /­api/­orders/­count.­php
Receive a count of all Orders
since_id Count orders created after the specified ID
created_at_min Count orders created after date (format: 2014-04-25T16:15:47-04:00)
created_at_max Count orders created before date (format: 2014-04-25T16:15:47-04:00)
status Count orders with status:
  • received
  • in progress
  • paid
  • refunded
  • stock allocation
  • printing
  • quality control
  • refunded
  • internal order query
Count all orders

GET /api/orders/count.php?AppId=APP-xxxxxxxx&Signature=xxxxxxxx4

Count all paid orders

GET /api/order.php?AppId=APP-xxxxxxxx&Signature=xxxxxxxx&status=paid

POST /api/orders.php
Create a new order
order Order details - please see Order properties
Creating an order (JSON format)

POST /api/orders.php?AppId=APP-xxxxxxxx&Signature=xxxxxxxx

{
"brandName": "Snuggle.Partners",
"comment": "Test order.",
"shipping_address": {
"firstName": "Simon",
"lastName": "Buckley",
"company": "Snuggle.Partners",
"address1": "Unit 2",
"address2": "Sabre Way",
"city": "Peterborough",
"county": "Cambridgeshire",
"postcode": "PE1 5EJ",
"country": "United Kingdom",
"phone1": "+44 (0)330 043 0219",
},
"shipping": {
"shippingMethod": "courier"
},
"items": [
{
"pn": "JH001",
"quantity": 4,
"retailPrice": 20,
"description": "Please print as large as posible",
"label": {
"type": "printed",
"name": "ink-label"
},
"designs": {
"front": "https://www.brickweb.co.uk/images/pictures/brand-materials/tbf-the-brick-factory/images/00-design-logo-tbf.png",
"back": "https://www.brickweb.co.uk/images/pictures/brand-materials/tbf-the-brick-factory/images/tbf-logo-blog.png"
}
}
]
}

Creating an order (XML format)

POST /api/orders.php?AppId=APP-xxxxxxxx&Signature=xxxxxxxx

<?xml version="1.1" encoding="UTF-8" ?>
<order>
<brandName>Snuggle.Partners</brandName>
<comment>Test order.</comment>
<shipping_address>
<firstName>Simon</firstName>
<lastName>Buckley</lastName>
<company>Snuggle Ltd</company>
<address1>Unit 2</address1>
<address2>Sabre Way</address2>
<city>Fengate</city>
<county>Peterborough</county>
<country>United Kingdom</country>
<postcode>PE1 5EJ</postcode>
<phone1>+44 (0)330 043 0219</phone1>
</shipping_address>
<shipping>
<shippingMethod>courier</shippingMethod>
</shipping>
<items>
<item>
<pn>JH001</pn>
<quantity>4</quantity>
<retailPrice>25.00</retailPrice>
<description>Please print as large as posible</description>
<label>
<type>printed</type>
<name>ink-label</name>
</label>
<designs>
<front>https://www.brickweb.co.uk/images/pictures/brand-materials/tbf-the-brick-factory/images/00-design-logo-tbf.png</front>
<back>https://www.brickweb.co.uk/images/pictures/brand-materials/tbf-the-brick-factory/images/tbf-logo-blog.png</back>
</designs>
</item>
</items>
</order>

DELETE /api/orders.php
Delete an order. Only supported for non paid orders.
Delete an order

GET /api/orders.php?AppId=APP-xxxxxxxx&Signature=xxxxxxxx&id=10734