2014-04-02
Dr. Thomas Schank, ZHdK
→ next slide / uncover
← previous slide / cover
This presentation uses HTML5 and contains videos. It is known to work well with recent versions of Chrome.
get(type: 'media_entry',name: 'xy_diplomarbeit_2014')
Context: call history, objects in scope
GET /media_entries/xy_diplomarbeit_2014
POST /?action=get&type=media_entry&name=xy_diplomarbeit_2014
instead of
GET /media_entries/xy_diplomarbeit_2014
Only GET is used in the Madek API (for now)
e.g. use links to relate resources
{ owner_id: 15 }
vs
{ owner: 'http://medienarchiv.zhdk.ch/api/users/15' }
Defines structure of JSON-Response
{
"_links": {
"madek:": {
"href": "/api"
}
, "self": {
"href": "/api"
}
, "madek:media_resources": {
"href": "/api/media_resources"
}
, "curies": [
{
"name": "madek"
, "href": "/public/api_docs/{rel}"
, "templated": true
}
]
}
, "welcome_message": "Welcome to the MAdeK API!"
}
/api
/api
application/hal+json
application/json
/api
→ text/html
or application/json+hal
image/...
or application/pdf
or ... Remark: There is (almost everywhere) only one suitable content-type for a given resource in the Madek API. In those cases Madek will respond with that one no matter what the accept header says.
This can change at any time in the future.
API clients must authenticate to access the API.
Registered application
Secret
/public/api_docs
refercence
not necessarily the best way get acquainted with the API
…
/api-browser/browser.html
next
-linknext
-linkHAL specifies a next
-link to iterate through results.
An API-client should use the next
-link.
Do not meddle with the page
parameter.
Filtering → Query Parameters
Limited possibilities for now
Will become involved (arrays, nested structures)
Documentation (& Query-Builder?)
should it not be like
GET /api/media_entries/x accept: application/pdf
instead of
GET /api/media_entries/x/content_stream accept: application/pdf
Certainly! However, content negotiation with browsers, ….
Might change …
API clients should must send proper accept headers!
Concept:
GET /api/media_resources/madek-entities
302 → http://madek/api/media_resources/6e689070-a514-48a5-bbc3-d83babc66d72
GET /api/media_resources/6e689070-a514-48a5-bbc3-d83babc66d72
302 → http://madek/api/media_entries/6e689070-a514-48a5-bbc3-d83babc66d72
GET /api/media_entries/6e689070-a514-48a5-bbc3-d83babc66d72
API-Clients should handle redirects!
documentation and specification for existing features
forwarding auth for download
/api/media-resources/
more filters and parameters
/api/media-sets/
and /api/filter-sets/
meta-data all
non persistent data, only within ZHdK net
soon:
links to the old api documentation right now!