-
Notifications
You must be signed in to change notification settings - Fork 1
Annotation API with Permissions
paolociccarese edited this page Oct 3, 2014
·
6 revisions
In order to add permissions to new annotation (see: Model Permissions)), we just need to add the permission polices to the annotation message.
For instance, if the annotation is private we would add the following section (where the user identified by the URI http://orcid.org/0000-0002-5156-2703 is the same user that created the annotation):
"permissions": {
"read": ["user:http://orcid.org/0000-0002-5156-2703"],
"admin": ["user:http://orcid.org/0000-0002-5156-2703"],
"update": ["user:http://orcid.org/0000-0002-5156-2703"],
"delete": ["user:http://orcid.org/0000-0002-5156-2703"],
"comment": ["user:http://orcid.org/0000-0002-5156-2703"]
}
The complete POST message (using the testing credentials) would be:
curl -i -X POST http://localhost:8090/s/annotation \
-H "Content-Type: application/json" \
-H 'Authorization: Bearer caeb2990-248f-11e4-8c21-0800200c9a66' \
-d'{"apiKey":"164bb0e0-248f-11e4-8c21-0800200c9a66","validate":"ON","flavor":"OA","item":{"@context":"https://raw2.github.com/Annotopia/AtSmartStorage/master/web-app/data/OAContext.json","@id":"urn:temp:001","@type":"http://www.w3.org/ns/oa#Annotation","motivatedBy":"oa:commenting","annotatedBy":{"@id":"http://orcid.org/0000-0002-5156-2703","@type":"foaf:Person","foaf:name":"Paolo Ciccarese"},"annotatedAt":"2014-02-17T09:46:11EST","serializedBy":"urn:application:domeo","serializedAt":"2014-02-17T09:46:51EST","hasBody":{"@type":["cnt:ContentAsText","dctypes:Text"],"cnt:chars":"This is Paolo Ciccarese''s CV","dc:format":"text/plain"},"hasTarget":"http://paolociccarese.info","permissions":{"read":["user:http://orcid.org/0000-0002-5156-2703"],"admin":["user:http://orcid.org/0000-0002-5156-2703"],"update":["user:http://orcid.org/0000-0002-5156-2703"],"delete":["user:http://orcid.org/0000-0002-5156-2703"],"comment":["user:http://orcid.org/0000-0002-5156-2703"]}}}'