37
MOO API

MOO API Engineering Course

Embed Size (px)

DESCRIPTION

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

Citation preview

Page 1: MOO API Engineering Course

MOO API

Page 2: MOO API Engineering Course

WHO, MOO?

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

Page 3: MOO API Engineering Course

MOO CERTIFIED API ENGINEERING COURSE• course length: 4.25 minutes

Page 4: MOO API Engineering Course

(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)

Page 5: MOO API Engineering Course

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

Page 6: MOO API Engineering Course

HOW, MOO?

http://www.moo.com/api

need to register as a MOO user then get key.

REGISTRATION

Page 7: MOO API Engineering Course

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>

Page 8: MOO API Engineering Course

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>

Page 9: MOO API Engineering Course

STEP 3: Redirect user to MOO checkout

Page 10: MOO API Engineering Course

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

Page 11: MOO API Engineering Course

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!

Page 12: MOO API Engineering Course

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

Page 13: MOO API Engineering Course

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

Page 14: MOO API Engineering Course

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

Page 15: MOO API Engineering Course

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

Page 16: MOO API Engineering Course

Examples: variable text

Page 18: MOO API Engineering Course

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.

Page 19: MOO API Engineering Course

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

Page 20: MOO API Engineering Course

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

Page 21: MOO API Engineering Course

Perl

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

• (Aaron Straup from flickr)

Page 22: MOO API Engineering Course

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)

Page 25: MOO API Engineering Course

http://www.moolulu.com

Page 26: MOO API Engineering Course

http://www.theyworkforyou.com

Page 27: MOO API Engineering Course

http://www.theyworkforyou.com

Page 34: MOO API Engineering Course

Coming soon

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

•Business cards

•Fully variable text and imaging positioning

Page 35: MOO API Engineering Course

Competition

• Best API hacks this weekend

• Grand Prize: Flip.video

• post it online and email [email protected]

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

• Openstreetmap integration?

• Warcraft guild cards?

• some image/metadata thingamy

Page 36: MOO API Engineering Course

Questions?