Add an API to retrieve NameTemplate by id

Description

At present there exists an API to get the currently configured global name template via GET /openmrs/ws/rest/v1/nametemplate, as implemented by

However, in order to support i18n layout in the O3 Patient Registration form, it would be better if we could retrieve an arbitrary NameTemplate by id. (In the case of NameTemplates, the codename is the unique identifier.)

In order to avoid breaking changes with the existing api, new API endpoints should be added, resulting in:

  • GET /openmrs/ws/rest/v1/nametemplate - (unchanged) get the currently configured global name template.

  • GET /openmrs/ws/rest/v1/nametemplates - (new) list all known name templates

  • GET /openmrs/ws/rest/v1/nametemplate/{codename} - (new) get a specific name template

  • GET /openmrs/ws/rest/v1/nametemplate/layout.name.format- (new) get the currently configured global name template. (duplication of existing functionality, but may allow the existing endpoint to be deprecated/retired in future)

It is inconvenient needing to use ‘nametemplates’ for listing all known templates, as opposed to the more conventional ‘nametemplate’, but it is more important to avoid breaking the existing API.

Activity

Show:

xprlgjf April 9, 2025 at 12:04 AM

Oops. See follow-on issue

xprlgjf March 27, 2025 at 1:33 PM
Edited

All done, . This issue can now be closed.

Daniel Kayiwa March 26, 2025 at 9:57 AM

for global did you mean to say layout.name.format?

Daniel Kayiwa March 23, 2025 at 7:53 PM

The refactoring pull request has been merged at

Thanks

Details

Assignee

Reporter

Complexity

Components

Fix versions

Priority

Created May 24, 2024 at 6:15 PM
Updated April 9, 2025 at 12:04 AM