# Rest Webservices Api Docs.

**URL:** <https://talk.openmrs.org/t/rest-webservices-api-docs/28532>\
**Category:** Development\
**Tags:** restws\
**Created:** [May 18, 2020, 9:09am UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532 "2020-05-18T09:09:11Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![reagan](https://talk.openmrs.org/user_avatar/talk.openmrs.org/reagan/32/10652_2.png) [@reagan](https://talk.openmrs.org/u/reagan)\
**Post date:** [May 18, 2020, 9:09am UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532/1 "2020-05-18T09:09:11Z")

</div>

Hello devs, It appears that some of the Rest End Points configured in modules don’t appear in the webservice RestApi docs via the legacy ui for example this [ActiveVisit EndPoint in EMR-API](https://github.com/openmrs/openmrs-module-emrapi/blob/master/omod/src/main/java/org/openmrs/module/emrapi/web/controller/ActiveVisitController.java) but yet [personImage End point in EMR-API](https://github.com/openmrs/openmrs-module-emrapi/blob/master/omod/src/main/java/org/openmrs/module/emrapi/rest/resource/PersonImageResource.java) does. My question: what is the criteria for an end point to make it to the docs. Is it when it is configured as a resource which would mean you have that bean for that resource that is persisted to the db? @dkayiwa @mksd @ssmusoke

---

<div class="post-metadata">

**Author:** ![gcliff](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gcliff/32/8783_2.png) [@gcliff](https://talk.openmrs.org/u/gcliff)\
**Post date:** [May 18, 2020, 9:20am UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532/2 "2020-05-18T09:20:34Z")

</div>

> [@reagan](#):
>
> My question: what is the criteria for an end point to make it to the docs. Is it when it is configured as a resource which would mean you have that bean for that resource that is persisted to the db

@reagan for an end point to appear in the openmrs swagger spec then it has to implement the **Model getGETModel(Representation)** , **Model getCREATEModel(Representation)**, **Model getUPDATEModel(Representation)** methods depending on what CRUD operations its supporting.

Kindly have a look at this to [Documenting REST Resources - Documentation - OpenMRS Wiki](https://wiki.openmrs.org/display/docs/Documenting+REST+Resources)

---

<div class="post-metadata">

**Author:** ![reagan](https://talk.openmrs.org/user_avatar/talk.openmrs.org/reagan/32/10652_2.png) [@reagan](https://talk.openmrs.org/u/reagan)\
**Post date:** [May 18, 2020, 9:24am UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532/3 "2020-05-18T09:24:12Z")

</div>

Spot on …Thanks @gcliff

---

<div class="post-metadata">

**Author:** ![sharif](https://talk.openmrs.org/user_avatar/talk.openmrs.org/sharif/32/11982_2.png) [@sharif](https://talk.openmrs.org/u/sharif)\
**Post date:** [May 18, 2020, 12:55pm UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532/4 "2020-05-18T12:55:14Z")

</div>

Thanks for bringing this up @reagan , i have been researching about this error [ticket](https://issues.openmrs.org/browse/RESTWS-720), which i have not yet figured out where these error comes from. it has been there since 2017.I would think , while they were creating [swaggerspecificationCreator.java](https://github.com/openmrs/openmrs-module-webservices.rest/blob/master/omod-common/src/main/java/org/openmrs/module/webservices/docs/swagger/SwaggerSpecificationCreator.java) in webservices.rest could have arose this error definition,@reagan @gcliff ,have you taken a look at that error

---

<div class="post-metadata">

**Author:** ![reagan](https://talk.openmrs.org/user_avatar/talk.openmrs.org/reagan/32/10652_2.png) [@reagan](https://talk.openmrs.org/u/reagan)\
**Post date:** [May 18, 2020, 2:13pm UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532/5 "2020-05-18T14:13:44Z")

</div>

@sharif those errors are usually generated when an expected method is not defined in your resource…Havent looked deep into the code to see how the module scans them and handles the NPE which I think is the TO DO of the ticket…Nice coding and u continue researching it

---

<div class="post-metadata">

**Author:** ![sharif](https://talk.openmrs.org/user_avatar/talk.openmrs.org/sharif/32/11982_2.png) [@sharif](https://talk.openmrs.org/u/sharif)\
**Post date:** [May 18, 2020, 2:15pm UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532/6 "2020-05-18T14:15:19Z")

</div>

@reagan Thanks , You are right this was defined in webservices.rest, however am still looking through it

---

<div class="post-metadata">

**Author:** ![gcliff](https://talk.openmrs.org/user_avatar/talk.openmrs.org/gcliff/32/8783_2.png) [@gcliff](https://talk.openmrs.org/u/gcliff)\
**Post date:** [May 18, 2020, 2:23pm UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532/7 "2020-05-18T14:23:18Z")

</div>

> [@sharif](#):
>
> which i have not yet figured out where these error comes from

hello @sharif i would suggest that you have a deeper look in to the comments that @tomtom5152 made about his initial findings on the source of the errors …

Also have a look at this [thread](https://talk.openmrs.org/t/rest-web-services-documentation-not-being-generated-called/19699) and this [commit](https://github.com/openmrs/openmrs-module-webservices.rest/commit/685bd777c2854d10482272c1f5648ec6fd59a81c)

---

<div class="post-metadata">

**Author:** ![sharif](https://talk.openmrs.org/user_avatar/talk.openmrs.org/sharif/32/11982_2.png) [@sharif](https://talk.openmrs.org/u/sharif)\
**Post date:** [May 18, 2020, 2:26pm UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532/8 "2020-05-18T14:26:16Z")

</div>

> [@gcliff](#):
>
> Also have a look at this [thread](https://talk.openmrs.org/t/rest-web-services-documentation-not-being-generated-called/19699) and this [commit](https://github.com/openmrs/openmrs-module-webservices.rest/commit/685bd777c2854d10482272c1f5648ec6fd59a81c)

Thanks @gcliff that was my initial links i followed though still researching where the problem could be.

---

<div class="post-metadata">

**Author:** ![reagan](https://talk.openmrs.org/user_avatar/talk.openmrs.org/reagan/32/10652_2.png) [@reagan](https://talk.openmrs.org/u/reagan)\
**Post date:** [May 21, 2020, 11:27am UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532/9 "2020-05-21T11:27:33Z")

</div>

Turning back to this: I seem to be able to archieve this pattern pretty well when creating a REST end point of a core Object, However I have a followup question. Is this still possible to reflect my endpoint in live docs when am writing an endpoint that is not based entirely on one core Object.such as [this end point](https://github.com/METS-Programme/openmrs-module-aijar/pull/487/files#diff-c21952d28dd2fa48dcfede5f2077cf68R27)? @dkayiwa @ibacher @ssmusoke

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [May 21, 2020, 1:56pm UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532/10 "2020-05-21T13:56:40Z")

</div>

Did you try it out?

---

<div class="post-metadata">

**Author:** ![reagan](https://talk.openmrs.org/user_avatar/talk.openmrs.org/reagan/32/10652_2.png) [@reagan](https://talk.openmrs.org/u/reagan)\
**Post date:** [May 21, 2020, 3:03pm UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532/11 "2020-05-21T15:03:50Z")

</div>

@dkayiwa I couldnt think of a way to do it…So am wondering if it is possible anyway…

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [May 21, 2020, 3:16pm UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532/12 "2020-05-21T15:16:12Z")

</div>

[https://wiki.openmrs.org/display/docs/Adding+a+Web+Service+Step+by+Step+Guide+for+Module+Developers](https://wiki.openmrs.org/display/docs/Adding+a+Web+Service+Step+by+Step+Guide+for+Module+Developers)

---

<div class="post-metadata">

**Author:** ![ssmusoke](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ssmusoke/32/8020_2.png) [@ssmusoke](https://talk.openmrs.org/u/ssmusoke)\
**Post date:** [May 26, 2020, 7:11am UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532/13 "2020-05-26T07:11:37Z")

</div>

@dkayiwa The problem here is that we have a custom end-point which we would like to add to the swagger documentation. The underlying resource is concepts, and is a query, however we do not want to use the concept list as that will bring a performance penalty.

We just want to return the count of obs that contain the specified obs value.

On additional thoughts is there a performant way of returning the count of results for a GET call for a list of resources?

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [May 27, 2020, 2:14pm UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532/14 "2020-05-27T14:14:27Z")

</div>

What is the url of the custom end point?

---

<div class="post-metadata">

**Author:** ![reagan](https://talk.openmrs.org/user_avatar/talk.openmrs.org/reagan/32/10652_2.png) [@reagan](https://talk.openmrs.org/u/reagan)\
**Post date:** [May 27, 2020, 2:28pm UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532/15 "2020-05-27T14:28:19Z")

</div>

something similar to [this](https://github.com/METS-Programme/openmrs-module-aijar/pull/487/files#diff-c21952d28dd2fa48dcfede5f2077cf68R27)

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [May 27, 2020, 8:02pm UTC](https://talk.openmrs.org/t/rest-webservices-api-docs/28532/16 "2020-05-27T20:02:13Z")

</div>

Oh i see! That would require some work on our swagger documentation generator.
