Wyn Enterprise Developer Documentation
Wyn Enterprise: Using GraphQL to Manage Documents and Resources
Wyn Enterprise uses GraphQL to send query to your API and obtain the data required. This page discusses about using GraphQL to manage various resources.
Get the list of resources
You may want to obtain the list of all the resources available to you. The following query returns the list of all resources along with the ID and file name of all the resources.
query
{
documents {
id
filename
}
}
Get details of all resources
Along with the resource ID and file name, you can also obtain other details such as title, file type, and extension, created date, created by, modified date, modified by information; and operations allowed on the resource, using additional attributes available in the API. The following table elaborates the attributes available in documents object in the previous query:
Attributes | Description |
---|---|
id | Gets the resource ID or document ID |
filename | Gets the name of the file (eg. Auto Insurance.dbd) |
title | Gets the name of the document (eg. Auto Insurance) |
type | Gets the type of the document (eg. dbd) |
ext | Gets the extension of the document (eg. .dbd) |
created | Gets the date and time when the document was created (eg. 2020-01-22T10:54:33.451178Z) |
created_by{} | Obtains information on user who created the document. Some of the attributes available are:
|
modified | Gets the date and time when the document was modified |
modified_by{} | Obtains information on user who modified the document. The attributes available are same as listed in created_by{} |
effective_ops | Lists the operations allowed on document (eg. Create, Read) |
security{} | Obtains information on owner and access control for document. The following attributes are available:
|
Get details of a specific resource
If you want to obtain details of a specific resource, replace the "key" in the following query by the one specified in the following table.
{
query: documenttypes(key: "key") {
documents {
id
filename
}
}
}
Resource Type | Key |
---|---|
Report | rdl |
Dashboard | dbd |
Semantic Model | smdsc |
Dataset | dataset |
Data Source | dsc |
Image | image/jpeg, image/bmp, image/gif, image/png |
Theme | theme |
Update a resource
Update Permissions
To update permissions, obtain the ID of the resource and put it in the following mutation.
mutation
{
updatePermissions( documentId: "documentID" ,
grant: [ { role:"TestRole",
ops: [ Read, Update ]}] ,
revoke: [ { role:"Everyone", ops: [ Read ]}] )
}
Update the Category of a resource
You need to have the category ID of the resource you want to modify. See Using GraphQL to manage Categories topic on how to obtain a category ID.
Assign a Category to a resource
Obtain the ID of the resource and the tag ID (or category ID) and put it in the following mutation to add a tag to the resource.
mutation
{
tagDocument(
tagId: "tagid",
documentId: "documentID")
}
Delete Category from a resource
Obtain the ID of the resource and the tag ID (or category ID) and put it in the following mutation to delete the tag from the resource.
mutation
{
untagDocument(
tagId: "tagid",
documentId: "documentID")
}
Delete a resource
You need to first obtain the ID of the resource and put it in the following mutation to delete the resource.
mutation
{
deleteDocument(documentId: "documentID")
{
deleted_id
}
}