Open jmiranda opened 9 years ago
Steps to reproduce:
Update annotation via cURL:
$ curl -i -X POST -H "Content-Type: application/json" -H "x-annotator-auth-token: (AUTHTOKEN REDACTED)" -d "{\"tags\":[\"\"],\"citation\":\"None\",\"text\":\"Nine edited\",\"totalComments\":0,\"collectionId\":\"9c2e3171-9e8c-41f3-b49a-70284f1b28b9\",\"ranges\":[{\"endOffset\":27,\"start\":\"/span[9]\",\"end\":\"/span[9]\",\"startOffset\":0}],\"deleted\":false,\"uri\":2,\"id\":121023,\"contextId\":\"a6bdb8d488f1b096a4b19e68e31afb88c2268b3c\",\"archived\":false,\"created\":\"2015-08-10T14:59:22 UTC\",\"updated\":\"2015-08-10T14:59:22 UTC\",\"quote\":\"Now he'll never come again.\",\"permissions\":{\"update\":[\"2c2faf9d71aa37e974c72c098cf9466b45d319ae\"],\"admin\":[\"2c2faf9d71aa37e974c72c098cf9466b45d319ae\"],\"delete\":[\"2c2faf9d71aa37e974c72c098cf9466b45d319ae\"],\"read\":[]},\"media\":\"text\",\"user\":{\"id\":\"2c2faf9d71aa37e974c72c098cf9466b45d319ae\",\"name\":\"Luis Duarte\"}}" https://catch-dev.harvardx.harvard.edu/catch/annotator/update/121023
HTTP/1.1 200 OK
Date: Mon, 17 Aug 2015 17:06:02 GMT
Server: Apache-Coyote/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 702
{"tags":[""],"citation":"None","text":"Nine edited","totalComments":0,"collectionId":"9c2e3171-9e8c-41f3-b49a-70284f1b28b9","ranges":[{"endOffset":27,"start":"/span[9]","end":"/span[9]","startOffset":0}],"deleted":false,"uri":2,"id":121023,"contextId":"a6bdb8d488f1b096a4b19e68e31afb88c2268b3c","archived":false,"created":"2015-08-10T14:59:22 UTC","updated":"2015-08-10T14:59:22 UTC","quote":"Now he'll never come again.","permissions":{"update":["2c2faf9d71aa37e974c72c098cf9466b45d319ae"],"admin":["2c2faf9d71aa37e974c72c098cf9466b45d319ae"],"delete":["2c2faf9d71aa37e974c72c098cf9466b45d319ae"],"read":[]},"media":"text","user":{"id":"2c2faf9d71aa37e974c72c098cf9466b45d319ae","name":"Luis Duarte"}}
Read latest version of annotation
$ curl -i -X GET -H "Content-Type: application/json" -H "x-annotator-auth-token: (AUTHTOKEN REDACTED)" https://catch-dev.harvardx.harvard.edu/catch/annotator/read/121023
HTTP/1.1 200 OK
Date: Mon, 17 Aug 2015 17:06:49 GMT
Server: Apache-Coyote/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 695
{"tags":[""],"citation":"None","text":"Nine","totalComments":0,"collectionId":"9c2e3171-9e8c-41f3-b49a-70284f1b28b9","ranges":[{"endOffset":27,"start":"/span[9]","end":"/span[9]","startOffset":0}],"deleted":false,"uri":2,"id":121023,"contextId":"a6bdb8d488f1b096a4b19e68e31afb88c2268b3c","archived":false,"created":"2015-08-10T14:59:22 UTC","updated":"2015-08-10T14:59:22 UTC","quote":"Now he'll never come again.","permissions":{"update":["2c2faf9d71aa37e974c72c098cf9466b45d319ae"],"admin":["2c2faf9d71aa37e974c72c098cf9466b45d319ae"],"delete":["2c2faf9d71aa37e974c72c098cf9466b45d319ae"],"read":[]},"media":"text","user":{"id":"2c2faf9d71aa37e974c72c098cf9466b45d319ae","name":"Luis Duarte"}}
Turns out the API fails silently when the tags attribute contains an array with an empty string. Luis has fixed this within the client (by settings the tags attribute to an empty array or null), but the API should not fail silently in the case that tags is an array with an empty string. I think the proper behavior should be an exception, but I'm open to ignoring the empty string as well.
Email from Luis: