Documentum API Class — pynexusic 2.4.0 documentation

# Documentum API Class

Documentum API class allows the user to communicate with Documentum REST API using python

Prerequisites:

- Python > 3.7

- Documentum access

class DOCUMENTUM_API.DOCUMENTUM_API(base_uri, authentication_type='Basic', username=None, password=None, max_attempts=1, timeout=None, verbose=False, verify=True, logger=None)

  Documentum API class allows the user to communicate with Documentum API using python

  > - Python > 3.7

  > - Documentum access

  authenticate(verbose=False)

    Authenticate with Documentum using the defined authentication type used in the class constructor.

    Parameters

      verbose – (`bool` - optional) - Print internal messages if True (default value False).

    Returns

      (`tuple` - dict or string, string) - response (json, raw or error string) and response status code.

  generate_base64(value)

    Generate base64 string

    Parameters

      value – (`string`) - String value to be converted to base64.

    Returns

      (`String`) - base64 string.

  get_cabinet(base_url, cabinet_name, cabinets=None, verbose=False)

    Execute get request to get a specific cabinet.

    Parameters

      - base_url – (`string`) - URL to be executed in the get request.

      - cabinet_name – (`string`) - Cabinet name.

      - cabinets – (`list` - optional) - List of all cabinets (default value None).

      - verbose – (`bool` - optional) - Print internal messages if True (default value False).

    Returns

      (`dict`) - Cabinet found.

  get_cabinets(base_url, verbose=False)

    Execute get request to get all cabinets.

    Parameters

      - base_url – (`string`) - URL to be executed in the get request.

      - verbose – (`bool` - optional) - Print internal messages if True (default value False).

    Returns

      (`list`) - Repositories found.

  get_document(base_url, doc_name, documents=None, verbose=False)

    Execute get request to get a specific document.

    Parameters

      - base_url – (`string`) - URL to be executed in the get request.

      - doc_name – (`string`) - Document name.

      - documents – (`list` - optional) - List of all documents (default value None).

      - verbose – (`bool` - optional) - Print internal messages if True (default value False).

    Returns

      (`dict`) - Document found.

  get_document_content(document_obj, verbose=False)

    Execute get request to get the content of a specific document.

    Parameters

      - document_obj – (`dict`) - Document object.

      - verbose – (`bool` - optional) - Print internal messages if True (default value False).

    Returns

      (`dict` - dict, bytes) - Document content (properties and data).

  get_documents(base_url, verbose=False)

    Execute get request to get all documents.

    Parameters

      - base_url – (`string`) - URL to be executed in the get request.

      - verbose – (`bool` - optional) - Print internal messages if True (default value False).

    Returns

      (`list`) - Repositories found.

  get_folder(base_url, folder_name, folders=None, verbose=False)

    Execute get request to get a specific folder.

    Parameters

      - base_url – (`string`) - URL to be executed in the get request.

      - folder_name – (`string`) - Folder name.

      - folders – (`list` - optional) - List of all folders (default value None).

      - verbose – (`bool` - optional) - Print internal messages if True (default value False).

    Returns

      (`dict`) - Folder found.

  get_folders(base_url, verbose=False)

    Execute get request to get all folders.

    Parameters

      - base_url – (`string`) - URL to be executed in the get request.

      - verbose – (`bool` - optional) - Print internal messages if True (default value False).

    Returns

      (`list`) - Repositories found.

  get_repositories(verbose=False)

    Execute get request to get all repositories.

    Parameters

      verbose – (`bool` - optional) - Print internal messages if True (default value False).

    Returns

      (`list`) - Repositories found.

  get_repository(repo_name, repos=None, verbose=False)

    Execute get request to get a specific repository.

    Parameters

      - repo_name – (`string`) - Repository name.

      - repos – (`list` - optional) - List of all repositories (default value None).

      - verbose – (`bool` - optional) - Print internal messages if True (default value False).

    Returns

      (`dict`) - Repository found.

  get_request(url, accept=None, content_type=None, errormsg='', raw=False, content=False)

    Execute get request.

    Parameters

      - url – (`string`) - URL to be executed in the get request.

      - accept – (`string` - optional) - Request accept string (default value None).

      - content_type – (`string` - optional) - Request content_type string (default value None).

      - raw – (`bool` - optional) - Defines whether to return response raw format or json (default value False).

      - content – (`bool` - optional) - Defines whether to return response content or json (default value False).

    Returns

      (`tuple` - dict or string, string) - response (json, raw or error string) and response status code.

  get_resource(base_url, resource_type, resource_name, resources=None, verbose=False)

    Execute get request to get a specific resource.

    Parameters

      - base_url – (`string`) - URL to be executed in the get request.

      - resource_type – (`string`) - Resource type (e.g. cabinets, folders…etc.).

      - resource_name – (`string`) - Resource name.

      - resources – (`list` - optional) - List of all resources (default value None).

      - verbose – (`bool` - optional) - Print internal messages if True (default value False).

    Returns

      (`dict`) - Resource found.

  get_resources(base_url, resource_type, verbose=False)

    Execute get request to get all resources.

    Parameters

      - base_url – (`string`) - URL to be executed in the get request.

      - resource_type – (`string`) - Resource type (e.g. cabinets, folders…etc.).

      - verbose – (`bool` - optional) - Print internal messages if True (default value False).

    Returns

      (`list`) - Resources found.

  validate_and_return_response(response, message, raw=False, content=False)

    Validate response by comparing it against the acceptable status codes. Returns response and status code.

    Parameters

      - response – (`requests.response`) - The response from the query.

      - message – (`string` - optional) - Desired custom error message.

      - raw – (`bool` - optional) - Defines whether to return response raw format or json (default value False).

      - content – (`bool` - optional) - Defines whether to return response content or json (default value False).

    Returns

      (`tuple` - dict or string, string) - response (json, raw or error string) and response status code.