Skip to main content

REST Expanders FAQ

What are the requirements for my functional key?

A functional key (defined with the functionalKey option) must consist out of exactly one field of type String, which has at least the options isUnique and exposeRestField.

Is nameNotWanted supported?

Yes, the option nameNotWanted is supported by rest-expanders. When this option is enabled on a DataElement for which REST endpoints are expanded, the name field will be omitted from all models used in the API, as well as references to that element.

Why does the SortFieldMapper class just map fields to the same name?

It doesn't always do that. We want the name of the fields listed for sorting in the API to be the same as the name in the resource objects that are handled by the API, not the same as they are in the model of the DataElement. When the option exposeRestField is used, the name of the field will almost always be the same in the DataElement as it is when exposed through the API, as it is a one-to-one mapping. The only exceptions are fields marked with the options audit.create.timestamp and audit.modify.timestamp, which are translated by the expanders to created and lastModified respectively, which will therefore be mapped differently by the SortFieldMapper class.