annotation controller - SWEZenith/Living-History-API GitHub Wiki
Create Annotation
Request:
POST /api/v1/annotations/ HTTP/1.1
Host: example.org
Accept: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld"
Content-Type: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld"
Content-Length: 202
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"type": "Annotation",
"creator": "http://example.org/user1",
"created": "2015-01-28T12:00:00Z",
"modified": "2015-01-29T09:00:00Z",
"body": {
"type": "TextualBody",
"value": "<p>Paragraf!</p>",
"format": "text/html",
"language": "tr",
"creator": "http://example.net/user2",
"created": "2014-06-02T17:00:00Z"
},
"target": {
"id": "http://example.com/image1.jpg#xywh=100,100,300,300",
"type": "Image",
"format": "image/jpeg"
}
}
Response:
HTTP/1.1 201 CREATED
Allow: PUT,GET,OPTIONS,HEAD,DELETE,PATCH
Location: http://example.org/annotations/anno1
Content-Type: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld"
Content-Length: 287
ETag: "_87e52ce126126"
{
"id": "http://localhost:8080/api/v1/annotations/1",
"context": null,
"type": "Annotation",
"body": {
"type": "TextualBody",
"value": "This is my first annotation!"
},
"target": "http://www.example.com/index.html"
}
Retrive all Annotations
Request:
GET /api/v1/annotations/ HTTP/1.1
Host: example.org
Accept: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld"
Retrieve an Annotation by ID
Request:
GET /api/v1/annotations/{id}/ HTTP/1.1
Host: example.org
Accept: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld"
Response:
HTTP/1.1 200 OK
Content-Type: application/ld+json; profile="http://www.w3.org/ns/anno.jsonld"
Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
ETag: "_87e52ce126126"
Allow: PUT,GET,OPTIONS,HEAD,DELETE,PATCH
Vary: Accept
Content-Length: 287
{
"id": "59ece60f6661b0ea70e3d601",
"type": "Annotation",
"creator": "http://example.org/gokce",
"created": "2015-01-28T12:00:00Z",
"modified": "2015-01-28T12:00:00Z",
"body": {
"type": "TextualBody",
"value": "<p>Bir paragraf daha!</p>",
"format": "text/html",
"language": "tr",
"creator": "http://example.net/gokce",
"created": "2015-01-28T12:00:00Z"
},
"target": {
"id": "http://example.com/image2.jpg#xywh=200,200,400,500",
"type": "Image",
"format": "image/jpeg"
},
"@context": "http://www.w3.org/ns/anno.jsonld"
}