glenrobson / SimpleAnnotationServer

A simple IIIF and Mirador compatible Annotation Server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Delete Annotation

thanneken opened this issue · comments

Mirador is not successfully deleting annotations. I might consider this a feature, but I do need some way to delete annotations. Is there a curl-based approach to this? Something like this?
curl -v -iX "DELETE" -H 'If-Match: "1527260370078"' http://35.155.241.146:8888/simpleAnnotationStore/annotation/

Found the answer to my own question... here it is for anyone searching in the future:
curl -v -X DELETE http://35.155.241.146:8888/simpleAnnotationStore/annotation/destroy?uri=http%3A%2F%2F35.162.52.109%3A8888%2Fannotation%2F1527260370078
It still doesn't work in Mirador with a CORS related message in console, but like I said, I kind of prefer deletes not be too easy.

Glad you managed to work out the curl command. Which version of Mirador is delete broken in?

Thanks

Glen

Mirador doesn't delete on the live server, which is CentOS AWS, Mirador 2.6.1 built 20180112, SAS mirador-2.1.4 branch (tomcat, jena) built March 23.
Mirador does delete on the test server, which is Ubuntu 18.04, Mirador 2.6.1 built 20180612, SAS mirador-2.1.4 branch (tomcat, solr) built June 12.
I also tested the Mirador 2.6.0 release on the test server, which worked for Firefox but wouldn't show annotations in Chrome and Chromium.
I also tested the Mirador 2.6.1 release on the test server with jetty and jena, which did not affect the success for annotations.

When annotation delete in Mirador fails the console shows "No 'Access-Control-Allow-Origin' header is present on the requested resource."

It has the access control allow origin header when the method is GET, but not when the method is DELETE.

curl -H "Origin: http://jubilees.stmarytx.edu" -X GET --head http://35.155.241.146:8888/simpleAnnotationStore/annotation/destroy
curl -H "Origin: http://jubilees.stmarytx.edu" -X DELETE --head http://35.155.241.146:8888/simpleAnnotationStore/annotation/destroy

A delete with curl failed with an origin header set but succeeded without.

curl -v -H "Origin: http://jubilees.stmarytx.edu" -X DELETE http://35.155.241.146:8888/simpleAnnotationStore/annotation/destroy?uri=http%3A%2F%2F35.155.241.146%3A8888%2FsimpleAnnotationStore%2Fannotation%2F1529071651609

(failed 403)

curl -v -X DELETE http://35.155.241.146:8888/simpleAnnotationStore/annotation/destroy?uri=http%3A%2F%2F35.155.241.146%3A8888%2FsimpleAnnotationStore%2Fannotation%2F1529071651609

(succeeded 204)

On the test server it succeeded even with the origin header.

curl -H "Origin: http://jubilees.stmarytx.edu" -X DELETE http://december16:8888/simpleAnnotationStore/annotation/destroy?uri=http%3A%2F%2Fdecember16%3A8888%2FsimpleAnnotationStore%2Fannotation%2F1528845872579

In each of the tested configurations on the test server "search" gave the same error in console: "cannot read property 'total' of undefined"

I'm going to reopen this if thats OK to see if we can find the delete error. Is there anything in the live server logs? I think there are CORS issues when tomcat returns an error.

By all means... It would be nice to overcome this and other CORS issues. (Although I'm personally more interested in the search error.)

I checked the logs in apache (access and error) and tomcat (all files in the folder called "logs" modified today, namely localhost_access_log.2018-06-15.txt, catalina-daemon.out, catalina.2018-06-15.log, localhost.2018-06-15.log, catalina.out). I could see what I already knew (requests received and responses given), but nothing further.

Hopefully the CORS fix will fix this too but let me know if not and I can re-open.