pelagios / recogito2

Semantic Annotation Without the Pointy Brackets
Apache License 2.0
153 stars 30 forks source link

[question] how can I export annotations programmatically? #599

Closed mromanello closed 5 years ago

mromanello commented 5 years ago

Assume I have a document with id mtxabgqcgnbxj9 and I want to download its annotations as JSON-LD. Via the GUI I just go to the download link https://recogito.pelagios.org/document/mtxabgqcgnbxj9/downloads/annotations/jsonld. But I cannot figure out what's the right syntax to do this programmatically (e.g. via Curl).

rsimon commented 5 years ago

The URL is the correct one, and you will be able to fetch that normally via curl or WGET, too (it's just a GET request). However the problem I assume you are running into is that the document is not open to the public. You can only fetch it if you are logged in.

In your case, I guess you'll either need to open (temporarily?) the document for public access; or you'll need to replicate the login mechanism in a programmatic client. (I haven't tried this yet. But I'm pretty sure there will be libraries in any language that would handle this for you, since it's a standard procedure [1].)

In the veeery long run, I'd love to have a pure API-based solution, with API key and all. But that's currently not in the budget I'm afraid.


[1] Recogito uses a standard Cookie-based login mechanism (every request needs to have an auth cookie, and a new Cookie is returned from the server with every request).

mromanello commented 5 years ago

thanks for your helpful reply @rsimon ! I went for the shortcut, this time, by making the document public (there was no reason not to do it), but I may have eventually to come back to cookie-based authentication in cUrl and the like in the future. cheers