This is a new thread for discussing GSoD2020 REST API documentation.
- REST API Project Ideas
- Current REST API Docs
- OpenMRS Data Model v 1.9 (Is there a newer version?)
- recent REST API questions in Ask category
This is a new thread for discussing GSoD2020 REST API documentation.
Great we can continue here
@ayesh can you help me some starting points to research more on how to make examples of work, modifying the current documentation that we have.
Also the examples that are to be added in the documentation in different languages, they will just be an addition on the console right?? where currently only the curl examples are there .
@saurabh exactly they will be new tabs in the console.
Whag do you mean by work examples you can try out things with the demo server .And make sure it works
yess @ayesh like I can test the examples with the demo server and make sure it works but do we need something in the live documentation from where we can run those APIs ,
or we just need practical examples which can simply work and not the generic ones which we have in some examples now ?
So I would say first add the new samples from Java and Javascript
then we can think about having a live playground
@ayesh can you help me, whether I lookup on this for some insight on what resources might have been left out from the current documentation here
but the version mentioned in the psbrandt.io
swagger based documentation is 1.11.6,
(I dont know if that version corresponds to the APIs version or the document version itself) which is itself old since the github repo of openMRS webServices latest released version is 2.28.0.
thanks
Hi @saurabh
Please refer the swagger doc here https://demo.openmrs.org/openmrs/module/webservices/rest/apiDocs.html
I think that one is little bit outdated
thanks @ayesh
yess @ayesh while searching through a bit of history on this project I got his extremely precise posts like these , which are really helpful in understanding a bit of buildup to this project !!
of course he is the project champion and my mentor as well as @batbrain7’s mentor last year
@ayesh I found this doc here what was it really used for ??
because it has the required tabs for other language examples but misses out on some resources that the current documentation has
Oh, it was my playground prior to moving things to the openmrs repo. It just has the tabs nothing more.
I would prefer you to go through the slate docs to see how we can have tabs. Don’t refer to this one.
@ayesh ohkk I will do that thanks
and a request @ayesh can you please review my PR here so that I can make suitable changes as suggested by @sanjula in addition to your suggestions. thanks
@saurabh I would like to suggest you now to work on the only missing resource we didn’t work on last time Forms resource. You can talk with developers refer the swagger documentation and other resources to get an idea.
yes @ayesh , I will start working on forms next up surely !!
@ayesh as you requested on the github repo I started looking for resources on adding examples to in addition to the current cURL examples but I dint get a few things,
do we need examples of this format or we need plain http request examples which dont use annotations and rather simply create and http request to the OpenMRS webServices.
//generic example for uploading a resource
@RequestMapping(value = "/{resource}", method = RequestMethod.POST, headers = "Content-Type=multipart/form-data")
@ResponseBody
public Object upload(@PathVariable("resource") String resource, @RequestParam("file") MultipartFile file,
HttpServletRequest request, HttpServletResponse response) throws IOException, ResponseException {
baseUriSetup.setup(request);
RequestContext context = RestUtil.getRequestContext(request, response);
Resource res = restService.getResourceByName(buildResourceName(resource));
if (res instanceof Uploadable) {
Object updated = ((Uploadable) res).upload(file, context);
return RestUtil.created(response, updated);
} else {
throw new ResourceDoesNotSupportOperationException(res.getClass().getSimpleName() + "is not uploadable");
}
}
Hi @saurabh
So am talking about Forms in openMRS context if you refer https://demo.openmrs.org/openmrs/module/webservices/rest/apiDocs.htm You will be able to identify the forms resource. It has 2 subresources mentioned below.
You have to first document this as we have done for other resources(patients, locations etc). as I mentioned previously then we can move to other types of examples like javascript, node.js.
Please remember this is all about finding things by engaging with the community you have all the required documents and resources. Please refer and come up with proper documentation for Forms
ohkk @ayesh I thought I had to do examples before this one
okay then I do forms before examples then!!.