API

WaffleImages is designed to support third-party uploaders. Uploading is currently available as a REST service using either XML or JSON.

To upload an image, send a multipart/form-data-encoded POST request to http://waffleimages.com/upload, with the following URL-encoded parameters:

XML mode can be invoked with an Accept: text/xml HTTP header or a tg_format=xml parameter. Similarly, JSON is specified with either Accept: text/javascript or tg_format=json. Uploaders should also include a customized User-Agent, or give the name and version of the code in a client= parameter.

A successful upload in XML will look something like:

<upload>
 <hash>92f2ea9b522bf3eb39e7b48d4504551ebb902fd0</hash>
 <filename>hello.jpg</filename>
 <imageurl>http://img.waffleimages.com/img/92f2ea9b522bf3eb39e7b48d4504551ebb902fd0/hello.jpg</imageurl>
 <thumburl>http://img.waffleimages.com/img/92f2ea9b522bf3eb39e7b48d4504551ebb902fd0/t/hello.jpg</thumburl>
</upload>

Note: The "thumburl" may be omitted if the image is too small to merit having a thumbnail. Clients must handle this appropriately.

A failed upload in XML:

<upload>
 <err type="toobig"/>
</upload>

A successful upload in JSON:

{
  "err": null,
  "hash": "92f2ea9b522bf3eb39e7b48d4504551ebb902fd0",
  "filename": "hello.jpg",
  "imageurl": "http://img.waffleimages.com/img/92f2ea9b522bf3eb39e7b48d4504551ebb902fd0/hello.jpg"
  "thumburl": "http://img.waffleimages.com/img/92f2ea9b522bf3eb39e7b48d4504551ebb902fd0/t/hello.jpg"
}

A failed upload in JSON:

{
  "err": "toobig"
}

© 2006-2007 WaffleImages and respective owners | About | Donate | Login
This site is not affiliated with Something Awful LLC. Terms | Contact | DMCA