Not able to create Visit attribute using Rest Api

Tags: #<Tag:0x00007fddeb5cd4d0>

I am having an issue creating visit attribute using the Rest API

visit_attribute_type has datatype as varchar.

@wyclif @darius @dkayiwa

@kundansinha are you posting a resource for the first time ?If yes then i’d encourage you to use /ws/rest/v1/visit instead of /ws/rest/v1/visit/{uuid} …

When you post with uuid appended on request ,you’re trying to edit … Did you chance to look at https://wiki.openmrs.org/display/docs/REST+Web+Service+Resources+in+OpenMRS+1.9#RESTWebServiceResourcesinOpenMRS1.9-Visit

Sorry, but I think ‘/ws/rest/v1/visit’ is used to post visit. I am trying to post visit attribute.

And this is the way i used to post provider attribute and person attribute and also encounter attribute.

Can you paste the error log or stack trace at? pastebin.com

https://pastebin.com/N76rEazA

This is a bug in the rest webservices module. Can you create a ticket for it and share the ticket link here? I will immediately make a commit because it is an easy fix.

Thanks @dkayiwa! I have created an issue for the same.

  1. RESTWS-731

In the meantime, to work around it, put a maxOccurs value for the visit attribute type. Then all should be well.

I got the resource url from your diagram.Did i see it well ?

Sure. I will try

I think you missed the part attribute after visit uuid => ‘visit+/uuid+/attribute’

Alright ,good you’ve been unblocked

Can anyone tell me how to reproduce this bug as the UI has changed.

Thanks :smile:

CC: @dkayiwa @kundansinha @tendomart

The recommended way would be to reproduce in a unit test: https://github.com/openmrs/openmrs-module-webservices.rest/blob/e5e4c7d67cb0026d7ea99514fbad3e602f8a1f68/omod-1.9/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_9/VisitAttributeController1_9Test.java

1 Like