MOO API Engineering Course

Preview:

DESCRIPTION

slides from a talk I gave on 27th September 2008 at BarCampLondon5

Citation preview

MOO API

WHO, MOO?

(cc) http://www.flickr.com/photos/laughingsquid

MOO CERTIFIED API ENGINEERING COURSE• course length: 4.25 minutes

(UN)DESIGN GOALS

1. write-only API is for MOO Pack creation

2. Allow 100% flexibility in text and image layout on a pack of cards (eventually)

3. But make simple templates the default (now)

4. Be as easy to use as the Flickr API (or nearly so)

5. Provide decent preview tools for developers

6. Share revenue with API keyholders (after 1.0)

HOW MOO WORKS

1.Register for an API key

2.POST XML document to moo.com/api/api.php

3.Redirect users to MOO for checkout

4. Can specify return_path to bring user back to your site at the end

HOW, MOO?

http://www.moo.com/api

need to register as a MOO user then get key.

REGISTRATION

STEP 2: Boilerplate crap

1 <?xml version="1.0" encoding="UTF-8"?> 2 <moo xsi:noNamespaceSchemaLocation="http://www.moo.com/xsd/api_0.6.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 3 <request> <version>0.6</version> 4 <api_key> 88888888-4444-88888888-88888888-4444</api_key> 5 <call>build</call> 6 </request>

STEP 2: Payload

1 <?xml version="1.0" encoding="UTF-8"?> 2 <moo xsi:noNamespaceSchemaLocation="http://www.moo.com/xsd/api_0.6.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 3 <request> <version>0.6</version> 4 <api_key> 88888888-4444-88888888-88888888-4444</api_key> 5 <call>build</call> 6 </request> 7 8 <payload> <chooser> 9 <product_type>minicard</product_type> 10 <images> 11 <url>http://whitelabel.org/barcamplondon5.png</url> 12 </images> 13 </chooser> </payload> </moo>

STEP 3: Redirect user to MOO checkout

Details: images

1.Simplest format: drop upto 200 images, user chooses from within those.

2. Preselected images

3. Preselected images with specified crop, zoom data

4. Variable text, text colours, bold, etc

Details: Bleed

WIN ! FAIL FAIL

Bleed

* minicard - 6%

* notecard - 3%

* sticker - 4%

* postcard - 2%

* greetingcard - 2%

• We have to cut the cards

• Stay out of the green area!

Details: Cropping

1 <crop> <manual> 2 <x>161</x> 3 <y>203</y> 4 <width>572</width> 5 <height>572</height> 6 </manual> </crop>

1.You can specify the exact crop on an image

2. Will be stretched to fit the aspect ratio of the cards

Restrictions and gotchas

• Will reject images under 300px by 300px

• going to refine and revise this -should be variable by product

• and allow override

• no buddy icon support on minicards yet

• GIF, JPEG and PNG

Details: text

• can specify all text fields on all cards individually

• 3 fonts (serif, sans serif, fixed)

• bold

• alignment (depending on product)

• fully variable colour per text line

• 600 different colours in a 100 pack of minicards

• avoid pale colors for text lines, especially yellows

10 <product> 11 <product_type>minicard</product_type> 12 <designs> 13 <design> 14 <image> 15 <url> http://whitelabel.com/barcamplondon5.jpg </url> 16 <type>variable</type> 17 <crop> 18 <auto>true</auto> 19 </crop> 20 </image> 21 <text_collection> 22 <minicard> 23 <text_line> 24 <id>1</id> 25 <string>This is line 1</string> 26 <bold>true</bold> 27 <align>left</align> 28 <font>modern</font> 29 <colour>#ff0000</colour> 30 </text_line>

Examples: variable text

Examples: variable text

http://dancoulter.com/projects/moo-builder/

• Dan Coulter’s MOO-Builder library for PHP

• http://dancoulter.com/projects/moo-builder/

• supports all features of the API

• totally easy to use.

http://dancoulter.com/projects/moo-builder/

http://dancoulter.com/projects/moo-builder/

Perl

• http://search.cpan.org/dist/Net-Moo/

• (Aaron Straup from flickr)

Ruby

1 require 'moo' 2 moo = Moo::Order.new :api_key => "blahblahblah" 3 card = Moo::MiniCard.new 4 card.url = "http://whitelabel.org/barcamplondon5.jpg" 5 card.text = "I like tatoos\n Oh yes I do" 6 moo.designs << card 7 moo.to_xml

• Ruminant 0.9.5: http://gems.github.com/list.html(James Darling)

http://www.moolulu.com

http://www.theyworkforyou.com

http://www.theyworkforyou.com

Coming soon

•15% Revenue Share to API key holders(we will pay retroactively!)

•Business cards

•Fully variable text and imaging positioning

Competition

• Best API hacks this weekend

• Grand Prize: Flip.video

• post it online and email stefan@moo.com

• the most complex (dynamic text, other API integration)

• Openstreetmap integration?

• Warcraft guild cards?

• some image/metadata thingamy

Questions?

stef@moo.com http://www.moo.com/api

© Adam 'Apelad' Koford http://www.moo.com/designs/designers/adamkoford/