How I can add custom REST paths for OpenMRS resources

I have created rest resource following https://wiki.openmrs.org/display/docs/Adding+a+Web+Service+Step+by+Step+Guide+for+Core+Developers documentation.

I am able to expose basic resource API extending DelegatingCrudResource and Override methods. But I also want to add some other custom API path. How can I do that?

Hi @mjsanish,

What do you mean by ‘some other custom API path’, could you give us an example of what you would like to do?

For example, I have admissionLocation in the OpenMRS API. With extending DelegatingCrudResource I can expose basic API like: [GET] /ws/rest/admissionlocation [GET] /ws/rest/admissionlocation/uuid [POST] /ws/rest/admissionlocation

But I also want to add some other custom API path like: [GET] /ws/rest/admissionlocation/ward [POST] /ws/rest/admissionlocation/ward [GET] /ws/rest/admissionlocation/room [POST] /ws/rest/admissionlocation/room

This would be a subresource. Here is an example with /personaddress (PersonAddressResource) being a subresource of /person (PersonResource).