Document API

Documents high-level API.

class document_api.DocumentAPI(sdk)

API for the Document entities.

For now, there are just two methods for getting one or many documents (as others were not yet required, but might be implemented in the future).

Example usage:

api = DocumentAPI(...)

# Get one document by UUID
doc = api.get_document('some-uuid-1234')

# Get all documents for a given questionnaire
docs = api.get_documents(questionnaire_uuid='q-uuid-5')

# Get page number 1 (each page having 10 documents) of documents
# containing the "foo" string, sorted by the UUID attribute in the
# ascending order
docs = api.get_documents(q='foo', page=1, size=10, sort='uuid,asc')
model_class

alias of dsw_sdk.high_level_api.models.document.Document

get_document(uuid)

Retrieves one document, identified by it’s UUID.

Parameters

uuid (str) – universally unique identifier of the document

Returns

object representing a document

Return type

dsw_sdk.high_level_api.models.document.Document

get_documents(questionnaire_uuid=None, **query_params)

Retrieves list of documents. Possibly identified by the questionnaire to which they belong to.

Parameters
  • questionnaire_uuid (Optional[str]) – UUID of the questionnaire whose documents we want to fetch

  • query_params – optional query params: q, size, page and sort

Returns

list of objects, each representing a document

Return type

List[dsw_sdk.high_level_api.models.document.Document]