RESTWS: REST endpoint for getting AutoGenerationOptions of an IdentifierType

Extending discussion from RESTWS: REST endpoint for primary and extra patient identifier types (Thanks to @dkayiwa that pointed us to the working solution)

I’m working on MF-218. A brief summary of what it’s about:- Using identifier sources(if any) for auto generation of identifiers.

I’m looking for an endpoint close to this if any exists:

/ws/rest/v1/idgen/autogenerationoption?identifierType=identifierType

Or even like:

/ws/rest/v1/idgen/autogenerationoption?identifierSource=sourceUuid

Looking at the autogenerationoption resource, there is no search handler implemented meaning the endpoints are less likely to exist. But I’m asking here since there is a wider audience. If none, I think we can file a ticket in idgen module to add this.

/cc: @dkayiwa, @mksd

All of a sudden I have a doubt as to what triggers a GET request to go through doGetAll(RequestContext) or doSearch(RequestContext) (see here in BaseDelegatingReadableResource.)

I actually don’t really understand why doGetAll(RequestContext) needs a request context… @dkayiwa?

I see here that AutoGenerationOptionResource only implements doGetAll(RequestContext).

This means that you may need to implement doSearch(RequestContext), with either or both of those parameters (so "identifierType" and "identifierSource") that could be provided as part of the request context. Example here in AttachmentResource.

1 Like

This triggers a doGetAll: /openmrs/ws/rest/v1/form

While this triggers a doSearch: /openmrs/ws/rest/v1/form?q=admission

You may want to exclude voided or retired items: /openmrs/ws/rest/v1/form?includeAll=false

3 Likes