Create a Repository object
default_repository = nuxeo.documents # 'default' repository
nuxeo.client.set(repository='test')
test_repository = nuxeo.documents # 'test' repository
Fetch the Root document
nuxeo.documents.get(path='/')
Create a new workspace
new_ws = Document(
name='ws',
type='Workspace',
properties={
'dc:title': 'ws',
})
ws = nuxeo.documents.create(new_ws, parent_path='/')
Create a new folder
new_folder = Document(
name='a-folder',
type='Folder',
properties={
'dc:title': 'foo',
})
folder = nuxeo.documents.create(new_folder, parent_path='/ws')
Modify a document
doc = nuxeo.documents.get(path='/a-folder')
doc.properties['dc:title'] = 'bar'
doc.save()
Delete a document
nuxeo.documents.delete(new_folder.uid)
Get a document property
doc.get('dc:title')
Fetch the main Blob of a document
doc.fetch_blob()
Add a comment to the document
doc.comment('This is a comment')
Retrieve comments related to the document
doc.comments()
# Partial list of comments
doc.comments(pageSize=5, currentPageIndex=0)
Convert a document main Blob to PDF
doc.convert({'format': 'pdf'})
Fetch the ‘thumbnail’ rendition
doc.fetch_rendition('thumbnail')
Fetch the ACLs
doc.fetch_acls()
Start a workflow on a document
nuxeo.workflows.start('SerialDocumentReview', document=doc)
Complete a workflow task
task = nuxeo.tasks.of(workflow)
variables = {
'participants': ['user:Administrator'],
'assignees': ['user:Administrator'],
'end_date':'2011-10-23T12:00:00.00Z'
}
task.complete('start_review', variables, comment='a comment')
Add a permission
doc.add_permission({'username': 'test', 'permission': 'Write'})
Remove a permission
doc.remove_permission({'id': 'members:Write:true:Administrator::'})
Check for a permission
doc.has_permission('Write')
Lock document
doc.lock()
Unlock document
doc.unlock()
Fetch Lock Status
doc.fetch_lock_status()