Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While creating a new annotation permissions are not set correctly #9

Open
MihailGorceagEndava opened this issue May 11, 2021 · 3 comments

Comments

@MihailGorceagEndava
Copy link

Using endpoint https://h.readthedocs.io/en/latest/api-reference/v1/#tag/annotations I want to create a new annotation.
I'm using API key as Bearer Token.
Request body looks like this:
Screen Shot 2021-05-11 at 10 43 07

Response data of registered annotation looks like this:
Screen Shot 2021-05-11 at 10 44 17

Permissions from response looks like this:
Screen Shot 2021-05-11 at 10 33 50

I want that annotation should be available for anyone, but instead it's private. Setting permissions explicitly in request body does not work.

@robertknight
Copy link
Member

robertknight commented May 11, 2021

The permissions array is unfortunately misleading with respect to the flexibility of permissions that is currently supported. The only supported permissions are "shared with the group" or "private to the user who created the annotation". The API is structured this way rather than having just an is_shared property for historical reasons.

The allowed values for the read permission are either the userid that is creating the annotation, in which case the annotation is private, or group:{group} (Edit: Corrected to group:) where group is the ID of the group in which the annotation is being created. In your case, you need to set read to group:q5X6RWJ6.

To make an annotation accessible to everyone, whether they are a member of the group or not, the permissions for the whole group need to be set. The group in question (https://hypothes.is/groups/q5X6RWJ6/elife) is world-readable, so everyone can read annotations that are shared with the group.

Please let me know if this helps resolve your issue.

@MihailGorceagEndava
Copy link
Author

@robertknight Thank you ! But instead of groupid:{group} it should be group:{group}. Have just created new annotation and it works as expected. Thank you very much

@robertknight
Copy link
Member

Ah, indeed! - Thanks for the correction and confirmation. I'm going to close this issue as resolved, but we need to do a better job of documenting the allowed permissions, or simply exposing the supported values in a more natural way (eg. an is_shared property).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants