Application Name: Replace this text with one of: Platform, Reference Application, Bahmni, (Other – Please specify)
Version Number: Replace this text with the version number of the above application your question is about.
Question:
Replace the following text with your question or problem. If applicable, describe your problem in detail. If you are getting an error message, provide step-by-step instructions for others to reproduce the problem, if possible. Describe what steps you have taken to try to resolve the problem. Include version numbers of related add-on modules, any specific error messages, and if applicable, specific steps to reproduce your problem. Ask OpenMRS is for questions about installing, configuring, and using OpenMRS software products. If you have development problems, please use the “Development” category.
dkayiwa
(Daniel Kayiwa)
May 8, 2017, 7:06am
2
Can you add details like stack trace for the error you are getting? It would also help to share the exact rest call url that you are making and with what data.
{
“error”: {
“message”: “[startDatetime on class org.openmrs.Visit]”,
“code”: “org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource:748”,
“detail”: “org.openmrs.module.webservices.rest.web.response.ConversionException: startDatetime on class org.openmrs.Visit\r\n\tat org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource.setProperty(BaseDelegatingResource.java:748)\r\n\tat org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource.setConvertedProperties(BaseDelegatingResource.java:615)\r\n\tat org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource.create(DelegatingCrudResource.java:93)\r\n\tat org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_9.VisitResource1_9.create(VisitResource1_9.java:155)\r\n\tat org.openmrs.module.webservices.rest.web.v1_0.controller.MainResourceController.create(MainResourceController.java:91)\r\n\tat sun.reflect.GeneratedMethodAccessor970.invoke(Unknown Source)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)\r\n\tat java.lang.reflect.Method.invoke(Unknown Source)\r\n\tat org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:177)\r\n\tat org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446)\r\n\tat org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434)\r\n\tat org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)\r\n\tat org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)\r\n\tat org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)\r\n\tat org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:647)\r\n\tat org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:728)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)\r\n\tat org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:60)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)\r\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:72)\r\n\tat org.openmrs.web.filter.GZIPFilter.doFilterInternal(GZIPFilter.java:64)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)\r\n\tat org.openmrs.module.webservices.rest.web.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:108)\r\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)\r\n\tat org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:82)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)\r\n\tat org.openmrs.module.owa.filter.OwaFilter.doFilter(OwaFilter.java:57)\r\n\tat org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:70)\r\n\tat org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:54)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)\r\n\tat org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:108)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)\r\n\tat org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)\r\n\tat org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)\r\n\tat org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)\r\n\tat org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:105)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)\r\n\tat org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)\r\n\tat org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)\r\n\tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)\r\n\tat org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)\r\n\tat org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)\r\n\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)\r\n\tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)\r\n\tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)\r\n\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)\r\n\tat org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044)\r\n\tat org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)\r\n\tat org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)\r\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)\r\n\tat java.lang.Thread.run(Unknown Source)\r\nCaused by: org.openmrs.module.webservices.rest.web.response.ConversionException: Error converting date - correct format (ISO8601 Long): yyyy-MM-dd’T’HH:mm:ss.SSSZ\r\n\tat org.openmrs.module.webservices.rest.web.ConversionUtil.convert(ConversionUtil.java:254)\r\n\tat org.openmrs.module.webservices.rest.web.ConversionUtil.convert(ConversionUtil.java:158)\r\n\tat org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource.setProperty(BaseDelegatingResource.java:743)\r\n\t… 70 more\r\nCaused by: java.lang.IllegalArgumentException: Invalid format: “2017-04-05 11:41:00” is malformed at " 11:41:00”\r\n\tat org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:945)\r\n\tat org.joda.time.DateTime.parse(DateTime.java:160)\r\n\tat org.openmrs.module.webservices.rest.web.ConversionUtil.convert(ConversionUtil.java:247)\r\n\t… 72 more\r\n"
}
}
Here is the link of Rest Api
http://localhost:8091/openmrs-standalone/ws/rest/v1/visit
JSON Request
{
“startDatetime”:“2017-04-05 11:41”,
“patient”:“e902ae2c-8b9a-4675-8994-9e9b955e6efc”,
“visitType”:“428b0404-c99f-49cb-b0c3-c432ec3521ee”
}
Thanks for the reply I am trying to adding visit through Rest API.When I send request I get following error as I posted above.
dkayiwa
(Daniel Kayiwa)
May 8, 2017, 7:36am
4
These are the supported date formats:
IllegalArgumentException pex = null;
String[] supportedFormats = { DATE_FORMAT, "yyyy-MM-dd'T'HH:mm:ss.SSS", "yyyy-MM-dd'T'HH:mm:ssZ",
"yyyy-MM-dd'T'HH:mm:ssXXX", "yyyy-MM-dd'T'HH:mm:ss", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd" };
Can you try any of them and post again?
Yes ok thanks I am trying…
{
“error”: {
“message”: “Invalid Submission”,
“code”: “webservices.rest.error.invalid.submission”,
“globalErrors”: [],
“fieldErrors”: {
“activeAttributes”: [
{
“code”: “attribute.error.minOccurs”,
“message”: “The attribute {0} must occur at least {1} times”
},
{
“code”: “error.required”,
“message”: “{0} is required”
},
{
“code”: “error.required”,
“message”: “{0} is required”
}
]
}
}
}
Now I am getting when I am sending this request in JSON format.
{
“startDatetime”:“2017-04-08 12:53:53”,
"patient":"e902ae2c-8b9a-4675-8994-9e9b955e6efc",
"visitType":"9b836874-fead-4ff5-9f64-466b4ba00296"
}
dkayiwa
(Daniel Kayiwa)
May 8, 2017, 8:13am
7
Check your visit attribute types and either get rid of them if they were just for testing purposes, or submit a request that fulfils their requirements. https://demo.openmrs.org/openmrs/admin/visits/visitAttributeType.list
Ok sure I try to do this.
Daniel I am trying to learn Openmrs.I want to test the base line functionality API Is there any documentation or guide for begginer like me.I searched out openmrs wiki but there is just few example or sample.If you are aware please let me know.Again thanks for your help and time.
dkayiwa
(Daniel Kayiwa)
May 8, 2017, 9:42am
12
Ok I will check these all in depth.If in case I have some issue I will ask!
Thanks