The API Bunny Challenge

253 views
Skip to first unread message

Steven Willmott

unread,
Apr 18, 2014, 11:24:20 AM4/18/14
to api-...@googlegroups.com
Hi all, 

Happy holidays - we thought we’d have a little fun and put together this: http://apibunny.com - just launched. There’s a challenge there to solve and I’m betting someone from this group will be first. 

Made with fortune.js and jsonapi :).

Super simple but hopefully will get a few folks to figure out an API!

 steve.

Nick Floyd

unread,
Apr 18, 2014, 12:08:54 PM4/18/14
to api-...@googlegroups.com
Hey Steven,

Loads of fun, I'm still running it - just a quick note you have a typo in one of your results: "Next to rover the the family dog"

Thanks for this!  I love doing these types of things.

{
    "cells": [
        {
            "id": "NnA9WHQzvYlfkHho",
            "name": "Next to rover the the family dog",
            "readableId": 22,
            "abandon": "http://apibunny.com/abandon",
            "type": "cell",
            "links": {
                "north": "UH6vgxAdoj5GhCPM",
                "maze": "v7yJKuRMd4DTXJO9"
            }
        }
    ],
    "links": {
        "cells.north": {
            "href": "http://apibunny.com/cells/{cells.north}",
            "type": "cells"
        },
        "cells.east": {
            "href": "http://apibunny.com/cells/{cells.east}",
            "type": "cells"
        },
        "cells.south": {
            "href": "http://apibunny.com/cells/{cells.south}",
            "type": "cells"
        },
        "cells.west": {
            "href": "http://apibunny.com/cells/{cells.west}",
            "type": "cells"
        },
        "cells.maze": {
            "href": "http://apibunny.com/mazes/{cells.maze}",
            "type": "mazes"

Steve Klabnik

unread,
Apr 18, 2014, 12:32:18 PM4/18/14
to api-...@googlegroups.com
This is great!

Brian Mulloy

unread,
Apr 18, 2014, 1:37:03 PM4/18/14
to api-...@googlegroups.com
nice, Steve!

(there goes a bunch of free time)

-b

-- 
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft.
For more options, visit https://groups.google.com/d/optout.

Steven Willmott

unread,
Apr 18, 2014, 1:06:28 PM4/18/14
to api-...@googlegroups.com, Nick Floyd

Thanks Nick - will fix that!

 steve.
--

Ryan Hiebert

unread,
Apr 18, 2014, 2:55:41 PM4/18/14
to api-...@googlegroups.com
Blast! I need a hint on how to interpret that exit url. Doesn't look like there's anything in the JSON API spec about it, and I can't find an object format that works.

mehdi medjaoui

unread,
Apr 18, 2014, 9:58:50 PM4/18/14
to api-...@googlegroups.com
I give up! 

In attached file, I've put in pdf the paths I've been through...if it can help people... (collaborative browsing)
apibunny.pdf

MattM

unread,
Apr 19, 2014, 12:32:19 PM4/19/14
to api-...@googlegroups.com
Don't trust the API Bunny!  It's a trap!  ;-) m@
EvilBunny.jpg

steve

unread,
Apr 19, 2014, 1:29:01 PM4/19/14
to api-...@googlegroups.com

Lol - glad it was fun. Mehdi - I guess the post at the end was non intuitive. Were were going to use something with just links for get ( Mike Amundsen also pointed that out) but this was we could use fortune.js which made it super easy!

--

steve

unread,
Apr 19, 2014, 1:30:10 PM4/19/14
to api-...@googlegroups.com


Yes - don't know what we should use there we put submit as a hint for POST...

mehdi medjaoui

unread,
Apr 19, 2014, 2:15:14 PM4/19/14
to api-...@googlegroups.com

As feedback: Yes with my friend (@tiborvass on twitter ) we tried to explore/discover the maze it in an automated way (never  making 1 human-made logic call)
This is then what he has published on github https://github.com/tiborvass/apibunny
It publishes also a pdf at the end of the path record he made( for humans this time)

So the POST at the end was impossible to understand for our crawler (mainly because we did not understand it ourselves too ;) )
--
Sent from my mobile : so typos are not mistakes but features.

mca

unread,
Apr 19, 2014, 2:40:00 PM4/19/14
to api-...@googlegroups.com
was very interesting to watch people interact with this service.

<snip>
So the POST at the end was impossible to understand for our crawler (mainly because we did not understand it ourselves too ;) )
</snip>

esp. for machine-driven experience, you need to find a way to express *all* the protocol details (URI, method, arguments) inline in the response. HTML Forms. Cj templates, Siren actions, UBER data elements. these all express the full set of protocol details - no additional human-readable docs needed.

Atom, HAL, JSONAPI, Mason all rely on additional human-readable docs to explain how to actually change state (write data) on the server.

Jørn Wildt

unread,
Apr 19, 2014, 3:10:00 PM4/19/14
to api-...@googlegroups.com
Atom, HAL, JSONAPI, Mason all rely on additional human-readable docs to explain how to actually change state (write data) on the server.

Sorry, but I have to correct you here. Mason *does* indeed have actions. These are JSON based and depends on JSON schema and prefilled JSON templates to describe the payload. If you take a look at the issue tracker demo you will see that Mason describes each and every possible state transition needed to create, search, change, delete etc. and even upload files (which none of the other formats you mentioned handles btw). There is even a Mason browser to illustrate how a generic client could visualize and interact with the format.

/Jørn


--
/Jørn

mca

unread,
Apr 19, 2014, 4:16:02 PM4/19/14
to api-...@googlegroups.com
Jorn:

thanks for stepping in to help me better understand Mason.

i've read through the docs a couple times and here is what i can determine:

link[1] and link-template[2] always use GET
actions[3] always use POST unless the "method" argument appears and then that action uses the method supplied (PUT or DELETE).

is it legal to use GET for an action method value? PATCH?

thanks.


Steve Klabnik

unread,
Apr 19, 2014, 5:02:47 PM4/19/14
to api-...@googlegroups.com
This is also where profiles come in...

Sent from my iPhone

Jørn Wildt

unread,
Apr 19, 2014, 7:59:23 PM4/19/14
to api-...@googlegroups.com
Mike, since you obviously have read and understood the spec what is it then that makes you say that Mason needs human readable documentation to describe how to change state? I fail to see what is missing - especially if you say Sirene doesn't need human readable specs (I would say that Mason is more expressive in this area).

Yes, actions defaults to POST unless you specify another method (similar to HTML forms which defaults to GET). There are no restrictions on the choice of method (unlike HTML forms).

Yes, GET is valid for an action of type "void" (meaning an action with no payload). Same goes for DELETE which has no payload - as well as empty POST or PUT operations.

You can furthermore have inline action descriptions targeted at the client developer to help understating the API when exploring it manually.

PATCH is in principle possible for an action of type "json" since JSON-patch is JSON, but that would be to stretch the semantics a bit. PATCH is in my opinion (these days) way too document oriented for the kind of business operations that Mason was designed for so it has been left out by purpose. 

Neither is Mason prepared to handle other HTTP methods that requires something else than JSON in the payload (except for multi part used for file uploads) - just like HTML forms is restricted to either key/value forms or multi part forms.

/Jørn

mca

unread,
Apr 19, 2014, 8:53:52 PM4/19/14
to api-...@googlegroups.com
Jorn:

I think I misunderstood the spec and it wasn't until I re-read it that I was able to see the the description of POST as default for actions. It was this failure on my part to understand the spec that led me to include Mason in the list of formats that rely on human-readable docs to understand protocol-level information.

I agree (based on my re-read) that Mason offers the oppty to describe protocol-level details.

I *apologize* for this mistake, ok?

Jørn Wildt

unread,
Apr 19, 2014, 9:53:10 PM4/19/14
to api-...@googlegroups.com
Mike, thanks for trying to understand me :-)

/Jørn
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft.
For more options, visit https://groups.google.com/d/optout.


--
/Jørn

mca

unread,
Apr 19, 2014, 9:55:25 PM4/19/14
to api-...@googlegroups.com
no problem.

thanks for offering up the design and for taking the time to help me learn how it works.

cheers.

Steven Willmott

unread,
Apr 19, 2014, 10:52:03 PM4/19/14
to api-...@googlegroups.com, mca
Hi all, 

Thanks for discussion here - yes, it turned out into an unexpected interesting experiment. I’ll take a look at the data and try to summarize it back for here. 

The POST action definitely hit people and indeed there wasn’t a machine readable definition. We also did obfuscate that. A lot of people tried to navigate manually and a couple wrote scripts. I’m going to try to see if I can get a couple of them.

 steve.

mca

unread,
Apr 19, 2014, 11:08:29 PM4/19/14
to Steven Willmott, api-...@googlegroups.com
would be really cool if you could turn this into an open source project. post the server and then allow folks to post their clients.

we could all learn alot from this very cool project. thanks.

Daniel Yokomizo

unread,
Apr 20, 2014, 11:42:27 AM4/20/14
to api-...@googlegroups.com
I wrote a quick and dirt bash client (https://github.com/dyokomizo/apibunny) to explore the maze, using wget and jq, but it missed the exit link too.

Also I never managed to correctly POST to the exit, I got 412s and 400s. Is there a hint on what kind of JSON it expects?
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+unsubscribe@googlegroups.com.


--
Sent from my mobile : so typos are not mistakes but features.

--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft.
For more options, visit https://groups.google.com/d/optout.

Ryan Hiebert

unread,
Apr 20, 2014, 2:30:04 PM4/20/14
to api-...@googlegroups.com
> On Apr 20, 2014, at 10:42 AM, Daniel Yokomizo <daniel....@gmail.com> wrote:
>
> Also I never managed to correctly POST to the exit, I got 412s and 400s. Is there a hint on what kind of JSON it expects?

JSON-API JSON.

Sent from my iPhone

Steven Willmott

unread,
Apr 20, 2014, 3:49:40 PM4/20/14
to mca, api-...@googlegroups.com
Hi Mike, 

Yes, this is a good idea, we’ll try to get that done as soon as we can & gather up links to the scripts that people had. Will post here when done!

 steve.

mca

unread,
Apr 20, 2014, 4:29:19 PM4/20/14
to Steven Willmott, api-...@googlegroups.com

Markus Lanthaler

unread,
Apr 21, 2014, 3:43:12 PM4/21/14
to api-...@googlegroups.com
On Friday, April 18, 2014 5:24 PM, Steven Willmott wrote:
> Hi all,
>
> Happy holidays - we thought we’d have a little fun and put together this:
> http://apibunny.com - just launched. There’s a challenge there to solve and I’m
> betting someone from this group will be first.

This is great, thanks a lot Steve for creating this. I used this opportunity to test your APItools [1] and converted it to a JSON-LD + Hydra powered Web API [2]. The result is accessible at:

http://apibunny-3d64859981c5.my.apitools.com/mazes/

Unfortunately APItools' JSON library doesn't allow pretty-printing (at least I haven't found it) so the responses look quite ugly if you use curl. You can use the Hydra console to access and navigate this API:

http://bit.ly/apibunny

Hold down the shift key when you click on a link to avoid that modal to pop up.

Please note that submitting your twitter handle doesn't work as I was too lazy to convert the JSON-LD that the console sends to the API to JSONAPI but you see that it renders the form etc.


Cheers,
Markus


[1] https://www.apitools.com/
[2] http://hydra-cg.com/spec/latest/core


--
Markus Lanthaler
@markuslanthaler



Steven Willmott

unread,
Apr 21, 2014, 4:05:06 PM4/21/14
to api-...@googlegroups.com, Markus Lanthaler

Ho Ho - wow, this is super cool! I’ll check on the pretty printing, 
Like the console a lot too.

 steve,

Evan Stoner

unread,
Apr 23, 2014, 5:56:11 PM4/23/14
to api-...@googlegroups.com
Any hint on what the keys should be?  I think this is valid JSON API from eyeballing it, but it doesn't seem to work.

{
  "twitter_handles": [{
    "twitter_handle": "estoner"
  }]

Ryan Hiebert

unread,
Apr 23, 2014, 6:02:43 PM4/23/14
to api-...@googlegroups.com
It's been a minute since I figured it out, but I think that you don't need the list to contain objects, just strings. I hope my memory isn't failing me ;-) 

Nicolas Grenié

unread,
Apr 24, 2014, 2:06:03 PM4/24/14
to api-...@googlegroups.com
Hi Evan,

We just post a blog post to explain how we did create APIbunny and giving the last hint to do the POST request.
Hope it helps :)

http://www.3scale.net/2014/04/building-apibunny-using-fortune-js-jsonapi/

Thank y'all for playing with it,
Nicolas

On Friday, April 18, 2014 8:24:20 AM UTC-7, Steven Willmott wrote:
Hi all, 

Happy holidays - we thought we’d have a little fun and put together this: http://apibunny.com - just launched. There’s a challenge there to solve and I’m betting someone from this group will be first. 

Ryan Hiebert

unread,
Apr 24, 2014, 2:19:19 PM4/24/14
to api-...@googlegroups.com
Ah, yes. My memory was failing ;-)


--
Reply all
Reply to author
Forward
0 new messages