The addScopeRoleAssignmentsForSharing mutation grants access to a specific resource (like a Story) by assigning roles to users. This allows you to share Stories with individual team members or groups.
Signature
addScopeRoleAssignmentsForSharing(
scopeId: ID!
scopeRoleAssignments: [ScopeRoleAssignmentInput!]!
scopeType: ScopeType!
message: String
): ResponseStatus!
Arguments
The unique identifier of the resource you want to share (e.g., a Story ID).
scopeRoleAssignments
[ScopeRoleAssignmentInput!]!
required
Array of user-role assignments defining who gets access and what level of access they receive. See ScopeRoleAssignmentInput for the input structure.
The type of resource being shared. For Stories, this should be DASHBOARD.
Optional personal message to include in the sharing notification email sent to recipients.
Response
Returns a ResponseStatus object indicating the success or failure of the operation:
{
"code": "OK",
"message": "Role added successfully"
}
Usage Example
The following example shows how to share a Story with a colleague:
mutation AddScopeRoleAssignments($scopeId: ID!, $scopeRoleAssignments: [ScopeRoleAssignmentInput!]!, $scopeType: ScopeType!, $message: String) {
addScopeRoleAssignmentsForSharing(
scopeId: $scopeId
scopeRoleAssignments: $scopeRoleAssignments
scopeType: $scopeType
message: $message
) {
code
message
}
}
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <jwt_token>" \
-d '{
"query": "mutation AddScopeRoleAssignments($scopeId: ID!, $scopeRoleAssignments: [ScopeRoleAssignmentInput!]!, $scopeType: ScopeType!, $message: String) { addScopeRoleAssignmentsForSharing(scopeId: $scopeId, scopeRoleAssignments: $scopeRoleAssignments, scopeType: $scopeType, message: $message) { code message } }",
"variables": {
"scopeId": "story_123456789",
"scopeRoleAssignments": [
{
"roleId": "00000000-0000-0000-0000-000000000009",
"principalId": "user_987654321"
}
],
"scopeType": "DASHBOARD",
"message": "Please review and edit this sales dashboard"
}
}' \
https://{ACCOUNT}.askwisdom.ai/graphql
{
"data": {
"addScopeRoleAssignmentsForSharing": {
"code": "OK",
"message": "Role added successfully"
}
}
}