OpenTreeOfLife/opentree — pull request #116 by jimallman (2013-11-03 23:16:45+00:00)
Title: Attempting study creation via OTOL API

@leto, @mtholder: NOTE that the required "upstream" functionality is not yet provided in the OTOL API or in treemachine, but this should be enough information to jump-start implementation there. We should talk more about details of implementation, but here's roughly what I have in mind.

I'm following the RESTful API convention of using POST to create a new resource, like so:
http://dev.opentreeoflife.org/api/api/study

This passes the creation form data. I'm hoping that the OTOL API can provide study creation by passing this along to treemachine, which populates a new study based on the import choices (if any) made here. The "manual" option would simply create a study using the "empty" Nexson template.

If creation/import is successful, this response will redirect the curation tool to the edit page for this new study. If the import fails for some reason, OTOL API could still create the study as an a "empty" Nexson template with explanatory annotations (returning its URL and status 201).

Or it could return an error message (status 500) that we can show on the creation page, if it's something the user can fix, or something so serious that a resource couldn't be created.