[annotator-dev] What goes in the Store - Create, Update and Search links?

Randall Leeds tilgovi at hypothes.is
Mon Mar 24 21:40:55 UTC 2014

On Sun, Mar 23, 2014 at 10:22 PM, Francis <donshakespeare at gmail.com> wrote:

> Okay great folks. Six months later, I was hoping some maturity might
> enable me to understand your documentation on using annotator. So I have
> come back.
> I am now able to set up my users to annotate, while storing the entries on
> my annotate account. I have a token generator nicely in place, that works
> great.
> But now I wish to store the annotations on my server.... If you assist me,
> I'll be most appreciative...
> Questions:
> 1. I am using the huge JWT file that you have in the annotate demo, is
> there a smaller version than http://annotatorjs.org/demo/jwt.js ? Do I
> even need all that's inside of it?
> 2.    I can not figure out what  the  Store Plugin wants me to do...
>    Store: {
>                      prefix: '/anno',
>                      annotationData: {
>                       'uri': 'http://localhost/anno/an.php'},
>                      loadFromSearch: {
>                       'limit': 20,
>                       'uri': 'http://localhost/anno/an.php'},
>                      showViewPermissionsCheckbox: false,
>                      showEditPermissionsCheckbox: false,
>                      urls: {
>                         create:  '/annotations',
>                         read:    '/annotations/:id',
>                         update:  '/annotations/:id',
>                         destroy: '/annotations/:id',
>                         search:  '/annotations'
>                       }
>                   }
> The create, read objects, have links, I have figured as much, but I don't
> know what to put in the files they are supposed to link to or even what
> extension they are supposed to be.
> I am sure these files run the POST and GET commands and whatnot.
> This page
> http://docs.annotatorjs.org/en/latest/storage.html#storage-implementations has left curly brackets in my eyes for the past 5 hours.
> How do I read this?
> create
> method: POST
> path: /annotations
> receives: an annotation object, sent with Content-Type: application/json
> returns: 303 SEE OTHER redirect to the appropriate read endpoint
> Example:
> $ curl -i -X POST \
>        -H 'Content-Type: application/json' \
>        -d '{"text": "Annotation text"}' \
>        http://example.com/api/annotations
> HTTP/1.0 303 SEE OTHER
> Location:
> http://example.com/api/annotations/d41d8cd98f00b204e9800998ecf8427e

This example shows the form of the generated request, and the expected
response received, by a Store plugin configured with prefix / and the
create URI as /annotations.

The example itself is intending to show, using the curl command, what the
request and response look like.
The request method is POST.
The request has the application/json content type and {"text": "Annotation
text"} is the body of the request.
The request URL is http://example.com/api/annotations (that's prefix +
The response is 303 SEE OTHER with a Location header.
You'll notice the Location header points to the same place as (prefix +
read) where the new annotation id substitutes for the :id placeholder.

So if you configure your store plugin similarly, you will have to implement
a route in your PHP code to handle a request like this and generate a
similar response.

Does that clarify?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20140324/eadc531f/attachment-0004.html>

More information about the annotator-dev mailing list