2

I want to use mayan edms as a storage backend for documents where I can retrieve documents based on 2 metadata keys. I know this is possible with the index capability, but I fail to understand how to do this in the rest api. So I need an example how to define an index and how to retrieve documents using this index with the rest-api.

Roberto Rosario
  • 1,818
  • 1
  • 17
  • 31
Dick Kniep
  • 518
  • 4
  • 11

1 Answers1

1

You need to create both indexes filtering rules to on your metadata keys: https://docs.mayan-edms.com/chapters/indexes/examples.html#index-document-by-department-taken-from-the-first-character-of-the-invoice-number-metadata

example:

    {% if document.metadata_value_of.invoice_number.0 == "H" %}Human Resources
    {% endif %}

When this is working you can do a rest API call:

as example: request.get('http://localhost/api/v4/index_instances/1/nodes/61/documents/')

https://docs.mayan-edms.com/chapters/rest_api.html#examples together with the swagger api/swagger/ui/ and redoc api/redoc/ui and the django API api/v4 in your Mayan EDMS installation website should help you in the right direction.

Bastiaan Wakkie
  • 303
  • 3
  • 9