Skip to main content

Mayan API Client

https://img.shields.io/pypi/v/mayan_api_client.svg

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.

Metadata

Release files for mayan-api_client 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mayan-api_client 0.5.0
File Size Uploaded Provenance Actions
mayan-api_client-0.5.0.tar.gz 6.2 kB Without provenance Details for mayan-api_client-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mayan-api_client 0.5.0
File Interpreter ABI Platform Actions
mayan_api_client-0.5.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for mayan_api_client-0.5.0-py2.py3-none-any.whl

Total release size: 12.6 kB

Release files / mayan-api_client-0.5.0.tar.gz

Download URL mayan-api_client-0.5.0.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
58d12a4260e860bcb9a92318a531f9b45ebb2adb64f30f5f598ab4d1935e47f0
BLAKE2b-256 checksum
How to use checksums
b1f0a7db473eaceaf42ad8f437e18f274001abfe99ca6d751a973297c490e2c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / mayan_api_client-0.5.0-py2.py3-none-any.whl

Download URL mayan_api_client-0.5.0-py2.py3-none-any.whl
Size 6.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
b8a4d2ea9c39bf35706ee322434c9ebb1a269ab6d5a809f3eaea002d19690f52
BLAKE2b-256 checksum
How to use checksums
3eb591565306d33614c476f3fc8fe08c995c6694ebfe09b1de86a07d9c23ce4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for mayan-api_client 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page