Skip to content

Documents

Documents

The Document Object

{
"id": "1",
"display_name": "dummy.pdf",
"file_content_type": "application/pdf",
"owner": {
"id": "1"
}
}

Documents are Document objects.

You can view the full list of available fields here.

Listing Documents

query documents(
$offset: Int
$keywords: String
$folder_id: String
$file_types: [String]
$file_type: String
$sort_by: String
$private_user_id: String
$viewable_user_id: String
$consolidated_user_id: String
$filter: String
$should_paginate: Boolean
$for_template_use: Boolean
$provider_id: ID
) {
documents(
offset: $offset
keywords: $keywords
folder_id: $folder_id
file_types: $file_types
file_type: $file_type
sort_by: $sort_by
private_user_id: $private_user_id
viewable_user_id: $viewable_user_id
consolidated_user_id: $consolidated_user_id
filter: $filter
should_paginate: $should_paginate
for_template_use: $for_template_use
provider_id: $provider_id
) {
id
display_name
file_content_type
opens {
id
}
owner {
id
email
}
users {
id
email
}
}
}

Listing Documents is done via the documents query.

You can view a full list of potential arguments here.

InputInfo
sort_byOptional. Valid options are:
  • oldestfirst
  • newestfirst
  • namedesc
  • nameaesc (default
keywordsOptional. Keywords to search by. Documents can be searched by the name, description or file name.
file_typeOptional. Can be either: Valid options are:
  • all
  • other - this will return all files that are not: pdf, image, text, video, spreadsheet, presentation
folder_idOptional. ID of the Folder containing files to retrieve.

Returns a list of Document objects.

Retrieving a Document

query document($id: ID, $course_id: ID, $custom_module_id: ID, $care_plan_id: ID) {
document(id: $id, course_id: $course_id, custom_module_id: $custom_module_id, care_plan_id: $care_plan_id) {
id
display_name
file_content_type
opens {
id
}
owner {
id
email
}
users {
id
email
}
}
}

Retrieving a specific Document is done via the document query.

InputInfo
idID of the Document to query.
course_idOptional. Find Document by the Program it’s associated with.
custom_module_idOptional. Find Document by the specific Program Module it’s associated with.
care_plan_idOptional. Find Document by the Care Plan it’s associated with.

Returns a Document object.

Creating a Document

mutation createDocument($file: Upload, $display_name: String, $folder_id: String) {
createDocument(input: { file: $file, display_name: $display_name, folder_id: $folder_id }) {
document {
id
}
messages {
field
message
}
}
}

You can view a full list of potential inputs here.

InputInfo
fileRequired. This is the uploaded file as a multipart/form-data. Please refer to the File Uploads section for more information.
display_nameOptional. If not provided, will use the original file name as a display name.
folder_idOptional. ID of the Folder to place the new Document in.

Returns a createDocumentPayload object.

Updating a Document

mutation updateDocument($id: ID, $display_name: String, $folder_id: String) {
updateDocument(input: { id: $id, display_name: $display_name, folder_id: $folder_id }) {
document {
id
}
messages {
field
message
}
}
}

You can view a full list of potential inputs here.

The updateDocument mutation shares many common inputs with createDocument and those inputs (e.g display_name or folder_id work the same in both places).

InputInfo
idRequired. The ID of the Document to update.

Returns an updateDocumentPayload object.

Deleting a Document

Documents can be deleted by authorized providers and staff members via the deleteDocument mutation.

You can view a full list of potential inputs here.

mutation deleteDocument($id: ID) {
deleteDocument(input: { id: $id }) {
document {
id
}
messages {
field
message
}
}
}

The deleteDocument mutation is called from an authenticated provider/staff account.

InputInfo
idRequired. ID of the Document to delete.

Returns a deleteDocumentPayload object.