-
Notifications
You must be signed in to change notification settings - Fork 9
REST API documentation
Justin Miranda edited this page Apr 10, 2015
·
4 revisions
Request
curl -i -X GET -H "Content-Type: application/json" -H "x-annotator-auth-token:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJqbWlyYW5kYSIsImNvbnN1bWVyS2V5IjoiNWE1YjU5NzEtMWJmYy00ZTliLTg5NDItMDlhYzQzOTIyYTQ0IiwidHRsIjo4NjQwMCwiaXNzdWVkQXQiOiIyMDE0LTA5LTA4VDE3OjI4OjMwKzAwOjAwIiwidHlwIjoiSldUIn0.bUPKYZdt4lHBsnR-8glGEPqWsMwKwAhupl9Q_OHvzdE" http://localhost:8080/catch/annotator/search
Response (abbreviated)
{"total":54224,"limit":10,"offset":0,"rows":[ ... ]}
Request
curl -i -X GET -H "Content-Type: application/json" -H "x-annotator-auth-token:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJqbWlyYW5kYSIsImNvbnN1bWVyS2V5IjoiNWE1YjU5NzEtMWJmYy00ZTliLTg5NDItMDlhYzQzOTIyYTQ0IiwidHRsIjo4NjQwMCwiaXNzdWVkQXQiOiIyMDE0LTA5LTA4VDE3OjI4OjMwKzAwOjAwIiwidHlwIjoiSldUIn0.bUPKYZdt4lHBsnR-8glGEPqWsMwKwAhupl9Q_OHvzdE" http://localhost:8080/catch/annotator/search?limit=1&offset=0
Response
{"total":54224,"limit":"1","offset":0,"rows":[{"tags":["official"],"text":"","totalComments":0,"ranges":[],"parent":"0","deleted":false,"uri":"https://courses.edx.org/courses/HarvardX/SW12.6x/2T2014/courseware/f9ec9c0c7bb8498d814684358b6e8b0f/6d93c4e3a32e4558bb38c3183d9044d9/2","id":57455,"bounds":{"height":0.023854961832061067,"width":0.03125,"y":-9.107690444175708E-4,"x":0.4794449745547035},"rangePosition":{"height":0.0012325063613231532,"width":0.0011927480916030242,"left":0.49638199745546685,"top":0.008631215688406857},"archived":false,"updated":"2014-07-11T12:11:52.0-0400","created":"2014-07-11T12:11:52.0-0400","permissions":{"update":["justin.miranda@gmail.com"],"admin":["justin.miranda@gmail.com"],"delete":["justin.miranda@gmail.com"],"read":["justin.miranda@gmail.com"]},"target":"","media":"image","user":{"id":"justin.miranda@gmail.com","name":"jmiranda"}}]}
Request
curl -i -X GET -H "Content-Type: application/json" -H "x-annotator-auth-token:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJqbWlyYW5kYSIsImNvbnN1bWVyS2V5IjoiNWE1YjU5NzEtMWJmYy00ZTliLTg5NDItMDlhYzQzOTIyYTQ0IiwidHRsIjo4NjQwMCwiaXNzdWVkQXQiOiIyMDE0LTA5LTA4VDE3OjI4OjMwKzAwOjAwIiwidHlwIjoiSldUIn0.bUPKYZdt4lHBsnR-8glGEPqWsMwKwAhupl9Q_OHvzdE" http://localhost:8080/catch/annotator/read/57455
Response
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 2096
Date: Mon, 08 Sep 2014 22:05:54 GMT
{"tags":["official"],"text":"","totalComments":0,"ranges":[],"parent":"0","deleted":false,"uri":"https://courses.edx.org/courses/HarvardX/SW12.6x/2T2014/courseware/f9ec9c0c7bb8498d814684358b6e8b0f/6d93c4e3a32e4558bb38c3183d9044d9/2","id":57455,"bounds":{"height":0.023854961832061067,"width":0.03125,"y":-9.107690444175708E-4,"x":0.4794449745547035},"rangePosition":{"height":0.0012325063613231532,"width":0.0011927480916030242,"left":0.49638199745546685,"top":0.008631215688406857},"archived":false,"updated":"2014-07-11T12:11:52.0-0400","created":"2014-07-11T12:11:52.0-0400","permissions":{"update":["justin.miranda@gmail.com"],"admin":["justin.miranda@gmail.com"],"delete":["justin.miranda@gmail.com"],"read":["justin.miranda@gmail.com"]},"target":{"container":"imageHolder","src":"function (level, x, y) { //# constants var IIIF_ROTATION = '0', IIIF_QUALITY = 'native.jpg', //## get the scale (level as a decimal) scale = Math.pow( 0.5, this.maxLevel - level ), //# image dimensions at this level level_width = Math.ceil( this.width * scale ), level_height = Math.ceil( this.height * scale ), //## iiif region iiif_tile_size_width = Math.ceil( this.tileSize / scale ), iiif_tile_size_height = Math.ceil( this.tileSize / scale ), iiif_region, iiif_tile_x, iiif_tile_y, iiif_tile_w, iiif_tile_h, iiif_size, uri; if ( level_width < this.tile_width && level_height < this.tile_height ){ iiif_size = level_width + \",\"; iiif_region = 'full'; } else { iiif_tile_x = x * iiif_tile_size_width; iiif_tile_y = y * iiif_tile_size_height; iiif_tile_w = Math.min( iiif_tile_size_width, this.width - iiif_tile_x ); iiif_tile_h = Math.min( iiif_tile_size_height, this.height - iiif_tile_y ); iiif_size = Math.ceil(iiif_tile_w * scale) + \",\"; iiif_region = [ iiif_tile_x, iiif_tile_y, iiif_tile_w, iiif_tile_h ].join(','); } uri = [ this['@id'], iiif_region, iiif_size, IIIF_ROTATION, IIIF_QUALITY ].join('/'); return uri; }","thumb":"http://images.harvardx.harvard.edu/ids/iiif/400098039/57074,992,137,142/full/0/native.jpg","ext":""},"media":"image","user":{"id":"justin.miranda@gmail.com","name":"jmiranda"}}
Request
curl -i -X DELETE -H "Content-Type: application/json" -H "x-annotator-auth-token:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJqbWlyYW5kYSIsImNvbnN1bWVyS2V5IjoiNWE1YjU5NzEtMWJmYy00ZTliLTg5NDItMDlhYzQzOTIyYTQ0IiwidHRsIjo4NjQwMCwiaXNzdWVkQXQiOiIyMDE0LTA5LTA4VDE3OjI4OjMwKzAwOjAwIiwidHlwIjoiSldUIn0.bUPKYZdt4lHBsnR-8glGEPqWsMwKwAhupl9Q_OHvzdE" http://localhost:8080/catch/annotator/destroy/57455
Response
HTTP/1.1 204 No Content
Server: Apache-Coyote/1.1
Date: Mon, 08 Sep 2014 22:06:29 GMT
Request
curl -i -X GET -H "Content-Type: application/json" -H "x-annotator-auth-token:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiJqbWlyYW5kYSIsImNvbnN1bWVyS2V5IjoiNWE1YjU5NzEtMWJmYy00ZTliLTg5NDItMDlhYzQzOTIyYTQ0IiwidHRsIjo4NjQwMCwiaXNzdWVkQXQiOiIyMDE0LTA5LTA4VDE3OjI4OjMwKzAwOjAwIiwidHlwIjoiSldUIn0.bUPKYZdt4lHBsnR-8glGEPqWsMwKwAhupl9Q_OHvzdE" http://localhost:8080/catch/annotator/read/57455
Response
HTTP/1.1 404 Not Found
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Content-Length: 21
Date: Mon, 08 Sep 2014 22:06:50 GMT
Annotation not found!