# REST for subclasses of classes which already are resources

**URL:** <https://talk.openmrs.org/t/rest-for-subclasses-of-classes-which-already-are-resources/6930>\
**Category:** Development\
**Tags:** rest\
**Created:** [June 24, 2016, 12:23pm UTC](https://talk.openmrs.org/t/rest-for-subclasses-of-classes-which-already-are-resources/6930 "2016-06-24T12:23:09Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![teleivo](https://talk.openmrs.org/user_avatar/talk.openmrs.org/teleivo/32/2015_2.png) [@teleivo](https://talk.openmrs.org/u/teleivo)\
**Post date:** [August 9, 2016, 5:08pm UTC](https://talk.openmrs.org/t/rest-for-subclasses-of-classes-which-already-are-resources/6930/21 "2016-08-09T17:08:03Z")

</div>

Dear @jthomas

I would like to apply for slot

[https://wiki.openmrs.org/display/RES/2016-09-07+Design+Forum](https://wiki.openmrs.org/display/RES/2016-09-07+Design+Forum)

To discuss this topic here.

If the slot is also ok for (at least a few of, hopefully all 🙂 ) @wyclif @raff @pascal @darius ?

---

<div class="post-metadata">

**Author:** ![jthomas](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jthomas/32/21_2.png) [@jthomas](https://talk.openmrs.org/u/jthomas)\
**Post date:** [August 9, 2016, 6:16pm UTC](https://talk.openmrs.org/t/rest-for-subclasses-of-classes-which-already-are-resources/6930/22 "2016-08-09T18:16:56Z")

</div>

@wyclif @raff @pascal @darius will this work for you?

---

<div class="post-metadata">

**Author:** ![raff](https://talk.openmrs.org/user_avatar/talk.openmrs.org/raff/32/11894_2.png) [@raff](https://talk.openmrs.org/u/raff)\
**Post date:** [August 10, 2016, 10:44am UTC](https://talk.openmrs.org/t/rest-for-subclasses-of-classes-which-already-are-resources/6930/23 "2016-08-10T10:44:19Z")

</div>

The date works for me.

---

<div class="post-metadata">

**Author:** ![pascal](https://talk.openmrs.org/letter_avatar/pascal/32/5_5575768a8748004e209b776fc1b2916d.png) [@pascal](https://talk.openmrs.org/u/pascal)\
**Post date:** [August 10, 2016, 10:46am UTC](https://talk.openmrs.org/t/rest-for-subclasses-of-classes-which-already-are-resources/6930/24 "2016-08-10T10:46:18Z")

</div>

Should be okay, yeah. Thanks @jthomas.

---

<div class="post-metadata">

**Author:** ![wyclif](https://talk.openmrs.org/user_avatar/talk.openmrs.org/wyclif/32/19607_2.png) [@wyclif](https://talk.openmrs.org/u/wyclif)\
**Post date:** [August 10, 2016, 2:08pm UTC](https://talk.openmrs.org/t/rest-for-subclasses-of-classes-which-already-are-resources/6930/25 "2016-08-10T14:08:40Z")

</div>

Fine with me

---

<div class="post-metadata">

**Author:** ![wyclif](https://talk.openmrs.org/user_avatar/talk.openmrs.org/wyclif/32/19607_2.png) [@wyclif](https://talk.openmrs.org/u/wyclif)\
**Post date:** [September 7, 2016, 8:44pm UTC](https://talk.openmrs.org/t/rest-for-subclasses-of-classes-which-already-are-resources/6930/26 "2016-09-07T20:44:17Z")

</div>

From [this design call](https://notes.openmrs.org/2016-09-07-Design-Forum), the proposed approach is to tweak the rest framework to take into consideration the _ **t** _ request parameter when looking up an applicable search handler. _ **RestServiceImpl** _ should also maintain a cache of a given supported resource name along with the type and a list of the applicable SearchHandlers, this could be implemented with a nested class that encapsulates this data or a map where the subclass resource name and type value constitute the key and the value would be the list of SearchHandlers for that type. Then [this method](https://github.com/openmrs/openmrs-module-webservices.rest/blob/master/omod-common/src/main/java/org/openmrs/module/webservices/rest/web/api/impl/RestServiceImpl.java#L477) would have to be refactored to apply the same logic but restricting to only the handlers that match the type if a value is specified otherwise it looks through all search handlers that are applicable.

---

<div class="post-metadata">

**Author:** ![teleivo](https://talk.openmrs.org/user_avatar/talk.openmrs.org/teleivo/32/2015_2.png) [@teleivo](https://talk.openmrs.org/u/teleivo)\
**Post date:** [September 15, 2016, 2:50pm UTC](https://talk.openmrs.org/t/rest-for-subclasses-of-classes-which-already-are-resources/6930/27 "2016-09-15T14:50:24Z")

</div>

just for reference. Opened a ticket [https://issues.openmrs.org/browse/RESTWS-613](https://issues.openmrs.org/browse/RESTWS-613) and am working on it. will keep you up to date!

---

<div class="post-metadata">

**Author:** ![raff](https://talk.openmrs.org/user_avatar/talk.openmrs.org/raff/32/11894_2.png) [@raff](https://talk.openmrs.org/u/raff)\
**Post date:** [September 16, 2016, 8:41am UTC](https://talk.openmrs.org/t/rest-for-subclasses-of-classes-which-already-are-resources/6930/28 "2016-09-16T08:41:01Z")

</div>

@teleivo, thanks for creating the issue. I’ve commented on a possible implementation approach.

[Previous page](https://talk.openmrs.org/t/rest-for-subclasses-of-classes-which-already-are-resources/6930.md?page=1)
