Python client for the Mayan EDMS REST API.
Project description
Mayan API Client
Python client for the Mayan EDMS REST API.
Free software: ISC license
Installation
Install from PyPI:
pip install mayan-api_client
Usage
This is a thin wrapper of the slumber API client. Use the <app>.<resource>.<verb> nomeclature.
Examples:
from mayan_api_client import API api = API(host='http://127.0.0.1:8000', username='admin', password='password')
Show general information of the connected Mayan EDMS server:
api._info {u'contact': u'roberto.rosario@mayan-edms.com', u'description': u'Free Open Source Document Management System.', u'license': u'Apache 2.0', u'licenseUrl': u'http://www.apache.org/licenses/LICENSE-2.0.html', u'title': u'Mayan EDMS API Documentation'}
Show a list of all available apps:
api._apps [u'checkouts', u'document_indexing', u'documents', u'dynamic_search', u'folders', u'metadata', u'ocr', u'permissions', u'rest', u'sources', u'tags', u'user_management']
Create a document type:
api.documents.document_types.post({'label': 'new document type'}) {u'delete_time_period': 30, u'delete_time_unit': u'days', u'documents': u'http://127.0.0.1:8000/api/documents/document_types/2/documents/', u'documents_count': 0, u'id': 2, u'label': u'new document type', u'trash_time_period': None, u'trash_time_unit': None, u'url': u'http://127.0.0.1:8000/api/documents/document_types/2/'}
Upload a new document:
with open('/tmp/test_document.pdf') as file_object: response = api.documents.documents.post({'document_type': 2}, files={'file': file_object}) print response {u'label': u'test_document.pdf', u'document_type': 2, u'description': u'', u'language': u'eng', u'id': 2}
Get a list of all documents:
api.documents.documents.get() {u'count': 1, u'next': u'http://127.0.0.1:8000/api/documents/documents/?page=2', u'previous': None, u'results': [{u'date_added': u'2016-02-02T23:06:44.880732Z', u'description': u'', u'document_type': u'http://127.0.0.1:8000/api/documents/document_types/2/', u'document_type_label': u'Default', u'id': 2, u'label': u'test_document.pdf', u'language': u'eng', u'latest_version': {u'checksum': u'452a6e59f3320f99bfe88b5f7efb0b9323df20457c19c320efce2b9404b96d82', u'comment': u'', u'document': u'http://127.0.0.1:8000/api/documents/documents/2/', u'encoding': u'binary', u'file': u'1a8b87de-bca9-416a-beb2-49d817625d56', u'mimetype': u'application/pdf', u'pages': [{u'document_version': u'http://127.0.0.1:8000/api/documents/document_version/2/', u'image': u'http://127.0.0.1:8000/api/documents/document_page/2/image/', u'page_number': 1, u'url': u'http://127.0.0.1:8000/api/documents/document_page/2/'}], u'revert': u'http://127.0.0.1:8000/api/documents/document_version/2/revert/', u'timestamp': u'2016-02-02T23:06:45.318494Z', u'url': u'http://127.0.0.1:8000/api/documents/document_version/2/'}, u'url': u'http://127.0.0.1:8000/api/documents/documents/2/', u'uuid': u'b1973f42-41f2-41e7-b812-07fa929689ec', u'versions': u'http://127.0.0.1:8000/api/documents/documents/19/versions/'},] }
Get second page of a list of all documents:
api.documents.documents.get(page=2)
Get documents by id:
api.documents.documents(2).get()
Add a document to a folder:
api.folders.folders(1).documents.post({'document': 2}) {u'document': 2}
Credits
Roberto Rosario
History
0.5.0 (2016-1-22)
Initial release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mayan-api_client-0.5.0.tar.gz
.
File metadata
- Download URL: mayan-api_client-0.5.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58d12a4260e860bcb9a92318a531f9b45ebb2adb64f30f5f598ab4d1935e47f0 |
|
MD5 | d458b9992f406295af59505147afbd94 |
|
BLAKE2b-256 | b1f0a7db473eaceaf42ad8f437e18f274001abfe99ca6d751a973297c490e2c8 |
File details
Details for the file mayan_api_client-0.5.0-py2.py3-none-any.whl
.
File metadata
- Download URL: mayan_api_client-0.5.0-py2.py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8a4d2ea9c39bf35706ee322434c9ebb1a269ab6d5a809f3eaea002d19690f52 |
|
MD5 | 0eb91abd58fc60ba1939b376691a76ee |
|
BLAKE2b-256 | 3eb591565306d33614c476f3fc8fe08c995c6694ebfe09b1de86a07d9c23ce4e |