YouTrack Standalone 2018.3 Help

Visibility Settings

To set visibility of an issue, a comment, or an attachment, you need to use visibility attribute of the respective entity. However, by default this attribute has a common ancestor type for the both actual limited and unlimited types of visibility. Because of this, to update the visibility of an entity, you must provide explicitly the actual $type of the visibility attribute that you need in the body of a POST request.

To limit visibility for an entity, you must specify "$type": "jetbrains.charisma.persistent.visibility.LimitedVisibility" and then permittedGroups and/or permittedUsers attributes. permittedGroups and permittedUsers attributes should contain collections of entity ID's for groups and users, respectively, that should be able to view the target entity.

For example, the following json will limit visibility of an entity to a group and two particular users:

{ "visibility": { "$type": "jetbrains.charisma.persistent.visibility.LimitedVisibility", "permittedGroups":[{"id":"3-2"}], "permittedUsers":[{"id":"1-2"},{"id":"1-35"}] } }

To remove visibility restrictions, you must specify "$type": "jetbrains.charisma.persistent.visibility.UnlimitedVisibility". For example:

{ "visibility": { "$type": "jetbrains.charisma.persistent.visibility.UnlimitedVisibility" } }

Restrict Visibility Sample

This sample request restricts visibility for an issue comment to a user group:

Sample request:

curl -X POST \ 'https://example.myjetbrains.com/youtrack/api/issues/2-31/comments/4-2?fields=id,author%28login,name,id%29,deleted,text,updated,visibility%28permittedGroups%28name,id%29,permittedUsers%28id,name,login%29%29' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer perm:cm9vdA==.QWRtaW4gUmVzdCBBUEkgRG9jcw==.OcsxZrnZnBZhyWaGE0Uz1OiA5bRVNt' \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json' \ -d '{ "visibility": { "$type": "jetbrains.charisma.persistent.visibility.LimitedVisibility", "permittedGroups":[{"id":"3-2"}] } }'

Sample response body:

{ "deleted": false, "author": { "login": "john.doe", "name": "John Doe", "id": "1-2", "$type": "jetbrains.charisma.persistence.user.User" }, "visibility": { "permittedUsers": [], "permittedGroups": [ { "name": "Sample Project Team", "id": "3-2", "$type": "jetbrains.charisma.persistent.security.UserGroup" } ], "$type": "jetbrains.charisma.persistent.visibility.LimitedVisibility" }, "text": "okay, let's do it, @jane.doe. And check that - I am updating this using REST API!", "updated": 1534175928566, "id": "4-2", "$type": "jetbrains.charisma.persistent.IssueComment" }
Last modified: 7 March 2019