Hi Apurva,
On 03/26/2015 08:30 AM, Apurva Jalit wrote:
I am trying to provide annotation functionality through a chrome
extension and I wish to preserve these annotations. The documentation
suggests creating some REST APIs on a server to preserve these
annotations in a self hosted server. I am very new to web development
and don't understand in depth the REST API creation and have been
facing problem implementing those. I am using MVC .NET with C# as the
backend. Any help to create REST APIs is also welcome.
But currently, I am just wondering if instead of these APIs through
storage plugin can I make ajax calls to fetch and save annotations
through events like "annotation created"? Are there enough events for
all the operations that have to be performed through REST APIs? What
are these events? Are there in cons using this approach?
Forgive me if any of this is redundant, but I'll start from the top. You
have to create a backend database server+ store to store the annotations
created by the extension. It's ultimately up to you to determine what
server + data store you use to save this data. Combinations might
include ElasticSearch + Python (see
https://github.com/openannotation/annotator-store), Mongoose + Node (see
https://github.com/hyperstudio/MIT-Annotation-Data-Store), or even
PostgreSQL + Rails (I've done this in one app). I don't think you are
going to get much help on this forum for implementing a backend via C#,
but maybe someone can pipe in about .NET.
You'll need the server to handle a few types of responses:
/search (to list annotations)
POST to /create (create annotation)
DELETE to /annotations/:id (delete annotation)
PATCH/POST to /annotations/:id (update)
GET to /annotations/:id (retrieve)
The actual path names are configurable via Annotator's Store API, but
the ones I've listed are fairly standard in CRUD interfaces. You'll also
want to pay attention to which version of Annotator you are using,
because the Store API may change slightly across versions.
I don't understand the second paragraph, but hopefully I've provided
some help. All of these requests are made via AJAX, and you configure
the specific paths via the Store API as noted.
The best advice I can offer here in terms of debugging is to use Chrome
Developer tools or Firebug to observe AJAX calls as you manipulate
annotations. That will reveal the path being called, the data being
passed, and the response.
HTH,
Steph
_______________________________________________
annotator-dev mailing list
[email protected]
https://lists.okfn.org/mailman/listinfo/annotator-dev
Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev