How i can get or post data to note table by Rest API?

I want to add note to encounter by rest. How i can do it? I find only these parameters in rest api:

{ “auditInfo”: “string”, “display”: “string”, “name”: “string”, “description”: “string”, “retired”: “string”, “uuid”: “string” }

Unfortunately I don’t think there is a REST API for posting note yet. However most people record notes as comments in the obs table and I think you could use this method when waiting for the implementation to happen.

Also what you have posted as a payload (with fields display, auditInfo, uuid) is normally a rest resource returned by a GET request. You don’t use that to post stuff back to the server instead there is a different format for that which you can easily find in the REST API documentation (location included at the bottom) unless that has changed already (this was a discussion on enabling exactly this behavior sometime back).

See below how you would do it using combination of obs & encounter

[POST] /ws/rest/v1/encounter
  "patient": {
    "person": "uuid",
  "encounterType": {
    "name": "string",
    "description": "string"
  "encounterDatetime": "date string",
  "provider": "uuid of the provider",
  "obs": [
      "person": "uuid",
      "obsDatetime": "2018-03-05T13:35:42.712Z",
      "concept": "uuid",
      "comment": "The notes you want include",

I got this information from the REST API documentation which you can find by going Rest API documentation

I hope this helps.

To expand on what Willa says, the OpenMRS model does not yet support real Notes. The (dormant) ticket for addressing this is TRUNK-4106.

There is a note table in the database, but it is not used, and will be removed at some point.

In the Reference Application, we have a “Visit Note” form that looks like this:

This is actually implemented as an encounter (captured via an html form), with the various data points as observations. The “Clinical Note” observation is CIEL:126169.

After I clicked Save, the resulting encounter looks like this JSON: (though the actual submitted format is different because this uses HTML Form Entry).

@ibacher Do we have now the actual post json format for the Note. Am implementing the diagnosis Note in 3.x. What was used before in 2.x runs on custom Rest coreapps module resource

CC: @zacbutko @dkayiwa @burke


We haven’t implemented a note domain.

What is a “diagnosis note”? There are designs for a Visit Note with attached diagnoses and I think an issue to change how we handle the diagnoses in the note, but none of that changes the underlying data structures—notes are still encounters with observations.

1 Like

So these would go as array of Obs Eg).


No, not exactly. But this is already all handled by esm-patient-notes-app… See here.

Could you look at my Post data structure and see what’s making it not succeed { "encounterDatetime": "2022-06-01T20:03:32+03:00", "patient": "27236d -

Do you have an error message or something?

Oh, Yes I do have

Server responded with 400 (Bad Request) for url /openmrs/ws/rest/v1/encounter. Check err.responseBody or network tab in dev tools for more info

Here is the error from the network tab

Seems like you’re referencing a concept that doesn’t exist in the system you’re trying to send it to. I.e., the exception is being thrown here. At a guess it’s this one: “42201BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB”, which looks like the UUID of CIEL concept name rather than a concept.

1 Like

Okay let me look through it in the morning, It’s 1am this side :smiley:

Thanks @ibacher

Thank you @ibacher, Yeah the previous issue was the none existing concept ID, The Form is submitting successfully. But the expected output is totally different Eg) Diagnosis Note(Data structure)

Submitted Data structure:


Expected output:

CC: @dkayiwa @burke @zacbutko


Guess I lead you a bit astray. To get those to show up as diagnoses on 2.2, you’d probably need to POST them as diagnoses rather than obs, with a similar structure to what you get in the “expected” output (without all the links).

Assuming this works, could we add “diagnoses” to the list of properties for creating an encounter in our REST API docs?

Definitely should do that!

This is the new formatted JSON { "encounterDatetime": "2022-06-08T13:37:30+03:00", "patient": "27236d - just receiving this error { "error": { "message": "[diagnoses on class org.openmrs.Encounter - on POST request

Change from this: "coded": { "uuid": "138291AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" }


Thanks @dkayiwa and @ibacher the form now submits the data, Just one more issue with the diagnosis it doesn’t insert to the table which the issue I think its not picking the encounter id(Diagnosis data Model). Here is data structure