Get Addons End point

Hi everyone. For the Addon manager we search for addons on the endpoint https://addons.openmrs.org/api/v1//addon?&q=[Search term]. The response provided does not have info such as downloadUri, versions, developers/maintainers for the matching OWAs. In order to get this information we have to make further api calls to the endpoint https://addons.openmrs.org/api/v1//addon/[uuid] for each of the OWAs returned with the search response in order to get the additional information. e.g If 5 OWAs match the search term this would mean an additional 5 API calls to get the details. This is not optimal and creates laggy behavior in the UI. Is there a way of having the downloadUri and developer/maintainer names of an OWA returned with the search response?

@mkiterian The reason we haven’t added that info along with the search query is probably because the search result is just supposed to fetch the module details. The download URI and the developer names can be considered to be part of the attributes of a particular version of the module. This is the reason we haven’t added it to the search results.

As far as the UI lag is concerned, I guess we can : a) Create a new rest end point for that purpose alone i.e. one that will return the module name along with the details of the latest version of the module with it

b) Modify the existing endpoint to accomodate your needs as well.

What do you feel @darius?

@reubenv for the rest webservices module, we have a parameter for default, ref, and full representation. Would this fit in your design goals?

@dkayiwa, alternatively, we could have the table only list the search results. Then when one clicks on a specific result, a new component is loaded which will display the details of the specific module. So this: https://addons.openmrs.org/api/v1//addon/[uuid] will only be fire once for that specific owa/module. The details component will display the additional info(developers/maintainers, versions) and have buttons to download/install the owa/owa. Just like in the addon index.

1 Like

@mkiterian i like your proposal. :slight_smile:

Yup, this would be more efficient in terms of loading speed.

@reubenv, @dkayiwa, thanks. We’ll work on this.

1 Like

I faced this situation while working with SysAdmin-OWA. I used some another type of proposal to achieve this tasks.

  1. In the search page, Just displayed the module name, description details with “view” button
    Addon API : https://addons.openmrs.org/api/v1//addon?&q=searchValue
  2. If the user clicks the view button, then it will redirect to a new page which will contain the download button for the modules.
    Addon API : https://addons.openmrs.org/api/v1/addon/[moduleUuid]

You can refer this code for more info : openmrs-owa-sysadmin/app/js/moduleSearch at master · suthagar23/openmrs-owa-sysadmin · GitHub

Thank you @suthagar23, this should work. We could use a component on the same page or a new page to display the details.