The 4theFile API
- Perl Client Library reference implementation
The 4theFile API is a REST-style API that uses simple standard technologies: HTTP requests with Basic auth, and XML or JSON response content. The API is designed primarily to allow developers and maintainers of web applications to easily provide an email interface to their applications and integrate the list of submitted emails into their application's interface – without all the hassles involved in running an email server and parsing complex multi-part email messages, possibly with inline images, html, and attachments. 4theFile takes care of all the messy stuff for you.
For more information, see the 4theFile API Overview
Example: to GET the list of 4theFile Resources in Collection HJf56 that have “tag” 99 in XML format, the API resource is /collections/HJf56/resources and the whole request would look like:
In all resource URLs below, segments that begin with : such as :collectionkey are placeholders, and you should substitute a valid Collection key or Resource key.
In each resource description we've provided a Curl command line which may be useful for exploring or testing the API. For actual integration with your application you'll probably want to use a language-specific HTTP library (such as libCurl, or LWP for perl). For more info on Curl and libCurl http://en.wikipedia.org/wiki/CURL
We've shown most example responses in XML, but currently all responses are also available as JSON. An example .json response is shown on the first example page for ( GET /collections)
GET /collections.format returns the list of Collections owned by authenticated account
GET /collections/:collectionkey.format returns the Collection details
GET /collections/:collectionkey/resources.format returns the list of Resources in Collection :collectionkey
GET /resources.format returns the list of Resources owned by the authenticated account
GET /resources/:resourcekey.format returns the details for Resource :resourcekey, including the public http and https urls that can be used to make clickable links in a web interface
GET /resources/:resourcekey/attachments.format returns a list of direct links to any attachments in the top-level message for :resource, plus some meta data. this could be useful in a specialized collection where, for example, the 1st attachment is known to always include a scanned image of a purchase receipt.
GET /collections/:collectionkey/resources/:resourcekey.format returns resource :resourcekey in format identical to /resources/:resourcekey but ONLY if Resource is in Collection :collectionkey
PUT or POST /collections/:collectionkey/resources/:resourcekey.format assigns Resource :resourcekey to Collection :collectionkey and/or updates the Resource tags.
DELETE /collections/:collectionkey/resources/:resourcekey.format removes the Resource from the Collection provided that you own the Resource. It does not delete the Resource from 4theFile.