eLife now supports content negotiation

eLife now supports content negotiation

Wednesday, May 29, 2013 - 14:42

With the very good folks at HighWire we have added experimental support for content negotiation on our Drupal hosted journal. We currently support content negotiation to return markdown versions of our articles, and to return images from articles. Support for XML will be added in the future.

OK, so, what is content negotiation, and why should I care?

Content negotiation at its heart is a way to ask a web server to send you back a specific version of a resource or document. If you are writing tools or applications on top of a corpus of content, being able to ask for specific formats for a document can be really handy. Ideally we should provide support for the XML versions of our articles, and at some point there might be a possibility to provide an RDF representation of the article via content negotiation, but for now we have support for returning a markdown version of the article, and the raw figures from the article.

Content negotiation for Markdown

Markdown is a convention for writing plain text documents that can be easily converted to HTML. It’s far more normal to think of using markdown in the process of writing, and not as an output format in and of itself. There is currently a lot of interest in improving the tools that are used for writing academic papers. Some people think that markdown might form a part of that future. PLOS will be holding a workshop in San Francisco on the 6th of June on Scholarly Markdown.

We have turned on markdown as a format for our articles that you can request by setting your header to text/plain. We are not exactly sure how this might be useful, but we think it’s pretty cool anyway, and we hope it can be of benefit to those looking at markdown as a potential tool for the future of scholarly communication.

Here is an example call:

curl --header "Accept:text/plain"  \
-L http://elife.elifesciences.org/content/2/e00334


Content negotiation for figures

Every figure published in an eLife article has it’s own DOI. When you resolve that DOI you get taken to a landing page specific to that figure. For example when you resolve http://dx.doi.org/10.7554/eLife.00631.016 you get taken to http://elife.elifesciences.org/content/2/e00631/F10. If you do a HTTP request against this page you will get back the full HTML for that page. Wouldn’t it be awesome if you could just get back the image? Well now you can with

curl --header "Accept:image/jpeg" \
-L http://elife.elifesciences.org/content/2/e00631/F10

We have updated our developer documentation.