Developer API Blog

Wednesday
Jun242009

Featured Developer: Matt Muresan

One of our great partners, Matt Muresan, the proprietor of OncePressed.com let us know today about some of his experiences working with the Printfection API.

Its great to hear from folks in the trenches and Matt has done a great job of putting together some thoughts and feedback on his blog at http://www.oncepressed.com/blog/2009/06/my-printfection-api-t-shirt-store.html.

Matt has built himself a great way to bring much of his store onto his own domain (a great way to build a brand) and have it live alongside his blog and other parts of the OncePressed.com empire.

Well done Matt, and thanks for sharing.

Friday
Apr172009

Featured Developer: Taltopia.com

Taltopia is a media distribution and social networking site designed to allow people to show off their talents. From music to acting, design and photography, Taltopia gives people a fantastic platform to showcase what they can do.

Taltopia has recently integrated with the Printfection Platform to give users of their service the ability to not just showcase their talents but also sell their designs, artwork and photography on custom printed on demand merchandise. Taltopia has used AddMerch to provide the interface and have done some clever creative development in their backend to handle the rewarding of their talent when things are purchased.

Another great example of dynamic Print on Demand in action. Check them out at http://www.taltopia.com

Monday
Jan122009

Introducing Printfection Quick Merch

Last week, we finished the development of our own Printfection API based application, Printfection Quick Merch. It is a practical application designed specifically for webcomic producers, however the technology and techniques used are applicable to all sorts of industries.

What is it?

Quick Merch was designed as a kind of bulk product create tool, where a user can select an image, choose a few options and hit go. Quick Merch goes off and uploads the image, creates a section and then creates all the selected products in one single step. It then returns some code and other marketing tools to help people market their creations. View the below video for a better understanding.

How does it work?

Printfection Quick Merch is built using PHP and the standard Printfection API. It use many of the methods to create things as well as PFQL to set up the input form and process the request. It is another practical example of what can be done with the Printfection API. We made no modifications or changes to the API, so you can build something similar as well.

Who can use it?

Even though we built it specifically for webcomic producers, Quick Merch can be used by anyone, especially, anyone who is producing a lot of new content on a regular basis and wants to create their product inventory fast. Feel free to try it out yourself, no matter what your background.

 

 

Thursday
Dec042008

Building Your First Application: Part 6 - Creating Products

The final step towards actually having a product to sell, is to use the Printfection API to create a product.

Creating a basic product is simple using the Printfection.Products.create method. This method has only four required parameters that must be sent in the request:

  • rootid - The root product for your new item
  • sectionid - where you want the product created
  • rootcolorids - a list of colors that you want available
  • specs - an array of design options to use to create your product

There are however some important concepts to understand to make the process smooth.

Root Products

Every product created at Printfection is based on a root product. A root product is the blank item that you want to base your custom product on. You can see the current range of root products in our catalog.

Each item has a unique ID to identify it to the API. Take the following root products as an example:

T-Shirt - Rootid 7Mens Ringer T - Rootid 20Jumbo Tote Bag - Rootid 18

 

 

You can retrieve a full list of root products using the following PFQL:

SELECT rootid, title FROM root_products WHERE 1 ORDER BY title

Root Colors

Each root product has its own unique set of root colors that are used to add color selections to your root products. You can send a single color, or a comma separated list with your request.

You can retrieve a full list of root products using the following PFQL ($rootID must be a valid root product):

SELECT rootcolorid FROM root_product_colors WHERE rootid= $rootID

Product Specs

The final parameter that we need to use when creating a basic product, is the specs. The specs tell the api how you actually want your design set upon the root product. The specs are sent as a serialized JSON array and contain the following items:

  • side - 0 (front) or 1 (back)
  • imageid - the image that you want on your product
  • position - (optional) The position on the root product to use.
  • center_percent_x - (optional) The percent from the top of the position to the center of the image.
  • center_percent_y - (optional) The percent from the left of the position to the center of the image.
  • rotation - (optional) Possible Values: 0,90,180,270 The rotation of the image.
  • height - The height in inches of the image

In PHP, a sample specs variable would like like this:

$specs = '
{
"SPECS": {
"side": 0,
"imageid": "'.$imageID.'",
}
}';

Putting it all together

So now, to create our product, it is simply a matter of sending our request with all the parameters attached. As a sample, the following PHP code will use cURL to send the request:

$api_sig_tmp2 = "api_key=".$api_key."method=".$method."rootcolorids=".$rcid."rootid=".$rootid."sectionid=".$sectionid."session_key=".$sessionID."specs=".$specs."version=1.0".$secret;
$api_sig2 = md5($api_sig_tmp2);

$post_data = array();
$post_data['api_key'] = $api_key;
$post_data['api_sig'] = $api_sig2;
$post_data['method'] = $method;
$post_data['rootcolorids'] = $rcid;
$post_data['rootid'] = $rootid;
$post_data['sectionid'] = $sectionid;
$post_data['session_key'] = $sessionID;
$post_data['specs'] = $specs;
$post_data['version'] = "1.0";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://api.printfection.com/restserver.php" );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$postResult = curl_exec($ch);
if (curl_errno($ch)) {
print curl_error($ch);
}
curl_close($ch);

That will return an XML document that contains the productid for the product that you have just created.  You should store this in a variable for use in the next part, where we add some more information, as well as set our commision for the product.

 

 

Wednesday
Dec032008

Developer Ideas Notebook - Dynamic Product Creation

The Printfection API gives you, the developer, access to just about every part of the Printfection Platform, which means that you can create a wide range of applications. From customization tools to store management applications, by leveraging the power of the Printfection Platform, you can help build the future of Print-On-Demand apparel and merchandise.

Click to read more ...