REST API Call returns 404

Application Name: webeservices.rest Version Number: 2.29.0

Question: Hello, I followed this page, and have set up penmrs sdk platform 2.3.0, and webservices.rest 2.29.0. I was able to run the server successfully at port 8080. But when I tried to use Postman to send request “localhost:8080/openmrs/module/webservices/rest/apiDocs.html” , it returned 404. I’ve set authorization as user: admin, password: Admin123. Please help. Thanks.

Share the full logs , you can paste them in pastebin.com

@rainbow in addition to the logs in pastebin ,share the json payload that you sent or you can attach a postman screen sort

1 Like

console output is here: https://pastebin.com/gqm1eRzx

openmrs.log is here: https://pastebin.com/HVFXvmMw

There is no payload.

@rainbow from your logs i see consistently see java.lang.NoClassDefFoundError: org/openmrs/module/web/extension/AdministrationSectionExt , this means your classpath doesn’t include the required classes that need to be dynamically loaded during compilation or it can also mean to indicate that you’re missing a transitive dependency of a .jar file that you’ve compiled against and you’re trying to use.

Thanks for your help. It seems related to the REST package. Will using a different version of webservices.rest solve this problem? I apologize for needing more instructions. As I am not a developer.

Usually this error code means that you were able to reach the server however the resource was not found which can be from so many reason However in your case I think the issue is with your url which does not point to any resource.

The question I would as is what were you expecting to receive using this url since it doesn’t point to any resource. Checkout this page for sample rest calls thus your calls will be something like http://ipaddress/openmrs/ws/rest/v1/obs

So to better understand the constructs of these look at this but from the browser to understand how to format the urls

I was able to get the REST API swagger out put by going to: https://demo.openmrs.org/openmrs/module/webservices/rest/apiDocs.htm

I was expecting the same from localhost.

@rainbow could this be of help Getting HTTP Status 404 when trying to access apiDocs.htm

Thanks. I will try that.

One more question when I send localhost:8080/openmrs/ws/rest/v1/session

I was able to get a json response.

So when do we use localhost:8080/openmrs/module/webservices/rest/… and when to use localhost:8080/openmrs/ws/rest/v1/…

this is standard way https://wiki.openmrs.org/display/docs/REST+Web+Service+Resources+in+OpenMRS+1.9 :slightly_smiling_face:

Thank you so much! I really appreciate your help!

your welcome

1 Like