Question:
Each document has different Sharing Settings that are configured. Is there a way to retrieve the Sharing Settings for each document?
Answer:
The request can be achieved using the following VQL query in Vault REST API.
SELECT id, name__v, (SELECT id, role_name__sys, user__sysr.email__sys, user__sys, user__sysr.username__sys FROM doc_roles__sysr) FROM documents
A sample response is shown below:
{
"responseStatus": "SUCCESS",
"responseDetails": {
"pagesize": 1000,
"pageoffset": 0,
"size": 1,
"total": 1
},
"data": [
{
"id": 727,
"name__v": "0072-",
"doc_roles__sysr": {
"responseDetails": {
"pagesize": 250,
"pageoffset": 0,
"size": 3,
"total": 3
},
"data": [
{
"id": 1652,
"role_name__sys": "owner__v",
"user__sysr.email__sys": "test1@test.com",
"user__sys": 4075477,
"user__sysr.username__sys": "test1@testvaults.com"
},
{
"id": 1744,
"role_name__sys": "approver__v",
"user__sysr.email__sys": "test2@test.com",
"user__sys": 4075477,
"user__sysr.username__sys": "test2@testvaults.com"
},
{
"id": 2527,
"role_name__sys": "editor__v",
"user__sysr.email__sys": "test3@test.com",
"user__sys": 4075477,
"user__sysr.username__sys": "test3@testvaults.com"
}
]
}
}
]
}
Related Documentation:
- Vault Help Documentation: API - Submitting a VQL Query
- Vault Help Documentation: VQL - Querying Document Roles