I want to add an observation using the RESTful web service but I get HTTP error 500. This is my Java code:
public static void main(String[] args) throws Exception
{
ApiAuthRest.setUsername("user");
ApiAuthRest.setPassword("pass");
JSONObject jsonObj = new JSONObject();
jsonObj.put("person", "626bd0b6-13db-4cb3-a513-60eaba501e27");
jsonObj.put("obsDatetime", "2012-12-02T22:35:03");
jsonObj.put("concept", "be4f67b0-1691-11df-97a5-7038c432aabf");
//jsonObj.put("location", "8d6c993e-c2cc-11de-8d13-0010c6dffd0f");
//jsonObj.put("encounter", "48851");
//jsonObj.put("value", "98");
System.out.print(jsonObj.toString());
StringEntity inputAddPerson = new StringEntity(jsonObj.toString(), HTTP.UTF_8);
inputAddPerson.setContentType("application/json");
System.out.println("AddObs = " + ApiAuthRest.getRequestPost("obs",inputAddPerson));
System.out.println("########################");
}
I use the same code for adding person, patient and location. and it works.
BTW I think the format of the obsDatetime is not correct. Any suggestion?