Rest API - query additional fields in document list

Hi.

Is it possible to add additional fields when querying from [GET] http://.../api/v4/documents/ to the Document model data? My usecase would be to include Tags or Metadata just the same way like it is done in Mayan’s GUI document list with one request.

As I understand for the moment the only option is to query my document search results first (page batches of 80) and then query all the details (Tags, Metadata, …) for each document with a single request. That does not feel right because of a large number of requests for one document batch. Is there a better way to add tag/metadata info to a document list?

Thanks, Torsten

Hi,

It is not possible and I don’t think it is something that would be implemented.

Like many other things in Mayan, the hardest obstacle might not be technical but the consequences it will lead to. Serialization is a heavy operation and is the reason we added the field reduction improvements (_fields_only, _fields_exclude). Allowing dynamic API serialization will destroy performance when used and will inevitably lead to open tickets and forum posts for a problem where the only solution is to not use the feature.

If your API changes are going to be used to feed another app that is going to be long lived, my recommendation is that your time and effort will be best invested and rewarded creating a bare bones custom app with just the custom API endpoints you need for your project.