Inscription REST API
Fixes Partially addresses #126 (closed)
Description
- Adds a redirect from artifacts to latest inscription (when one of the below formats is requested)
- ATF and CDLI-CoNLL output, and a base for CoNLL-U*
* CDLI-CoNLL is in the database, to convert to CoNLL-U we need the Python converter.
Type of PR This PR is a feature.
Technicalities
- Adds a Inscription controller to handle inscription output (HTML output may be removed later)
- Defines custom, unregistered MIME types to describe inscription formats
- Uses a component to recognize inscription formats across the Artifact and Inscription controllers
- Uses separate views for every format to leverage CakePHP's built-in
SerializedView
- Goes down the list of acceptable response type to find one that is available for an inscription (not all have CoNLL)
- Returns 406 NOT ACCEPTABLE if no type is fullfillable
Tests
- Run
curl -LH 'Accept: text/x-c-atf' http://127.0.0.1:2354/inscriptions/2309985
- Run
curl -LH 'Accept: text/x-cdli-conll' http://127.0.0.1:2354/inscriptions/2309985
→ HTTP 406 - Run
curl -LH 'Accept: text/x-cdli-conll' http://127.0.0.1:2354/inscriptions/2341997
- Redirect does not work yet since
is_latest
is not filled in the database yet. Change the value to1
for any artifact (say P000001) and
runcurl -LH 'Accept: text/x-c-atf' http://127.0.0.1:2354/artifacts/1
Checklist:
-
My pull request has a descriptive title (not a vague title like "Update index.md
"). -
My pull request targets the phoenix/develop
branch of the repository. -
My commit messages follow best practices. -
My code follows the established code style of the repository. -
I added tests for the changes I made (if applicable). -
I added or updated documentation (if applicable). -
I tried running the project locally and verified that there are no visible errors.
Edited by Lars Willighagen