-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Content creation in Treatment Notes failing #362
Comments
Hi there!
I think the problem is you have the body being sent with the
x-www-form-urlencoded option, but it needs to be JSON. On our side, it
looks like your content is coming through as one big string instead of a
JSON object.
Hope that helps!
John
…On Wed, Apr 6, 2022 at 12:06 PM staverton ***@***.***> wrote:
Hi there,
I'm struggling to get the treatment_notes endpoint to accept treatment
notes content. I can create the notes ok, but am struggling to actually
update the notes - example of the data I'm feeding into 'content' below:
{"sections": [{"name": "Section 1", "questions": [{"name": "Patient
progress report", "type": "paragraph", "answer": "hello world"} ] } ] }
...and getting a 500 error:
[image: image]
<https://user-images.githubusercontent.com/100085262/162017948-1e51667f-c54c-47b5-823d-022a1a162e98.png>
Any help gratefully received.
—
Reply to this email directly, view it on GitHub
<#362>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACL3M7JVP55VXR5W2V7Q7DVDWY7JANCNFSM5SWRA2EQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Thanks for getting back so quickly John! I'm now up against a validation failure... (please be patient!). Message body as follows: And a response of: ...which is kinda odd because I couldn't see 'title' or 'patient' in the api docs?! Thanks again for your help on this. |
Almost there! You're posting to treatment notes, to create the treatment note: Your JSON will be: {
"patient_id": "xxx",
"treatment_note_template_id": "xxx",
"draft": true,
"content": {
"sections": [
{
"name": "Section 1",
"questions": [
{
"name": "Patient progress report",
"type": "paragraph",
"answer": "Hello world"
}
]
}
]
}
} To update a treatment note, you make a
Your JSON will be same as above, with the changes you require. For example, your update may just be finalising the treatment note with: {
"draft": false
} |
PS - this worked using Postman, but I got the above error using Power Automate. |
I don't use Power Automate, sorry! |
I don't blame you! 😂 |
The above was what I got with a stringified version - the below is what I get with a JSON body:
|
It looks like you're missing the Content-Type header, so I think your body
is not getting processed correctly. It should be set to application/json.
I wonder if you're able to 'fix' the date the note was taken as well?
Cliniko does not allow dates of treatment notes to be changed.
…On Thu, Apr 7, 2022 at 9:31 AM staverton ***@***.***> wrote:
The above was what I got with a stringified version - the below is what I
get with a JSON body:
{ "errors": { "patient": "can’t be blank" }, "message": "Validation
Failed" }
—
Reply to this email directly, view it on GitHub
<#362 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACL3M4ER2XUX6LEDUOHSRTVD3PTJANCNFSM5SWRA2EQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I’m afraid I tried that – I also tried “application/json; charset=utf-8”
Annoying!
From: John Colvin ***@***.***>
Sent: 07 April 2022 15:53
To: redguava/cliniko-api ***@***.***>
Cc: Ben Deacon ***@***.***>; Author ***@***.***>
Subject: [EXTERNAL] Re: [redguava/cliniko-api] Content creation in Treatment Notes failing (Issue #362)
It looks like you're missing the Content-Type header, so I think your body
is not getting processed correctly. It should be set to application/json.
I wonder if you're able to 'fix' the date the note was taken as well?
Cliniko does not allow dates of treatment notes to be changed.
On Thu, Apr 7, 2022 at 9:31 AM staverton ***@***.***> wrote:
The above was what I got with a stringified version - the below is what I
get with a JSON body:
{ "errors": { "patient": "can’t be blank" }, "message": "Validation
Failed" }
—
Reply to this email directly, view it on GitHub
<#362 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACL3M4ER2XUX6LEDUOHSRTVD3PTJANCNFSM5SWRA2EQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
—
Reply to this email directly, view it on GitHub<#362 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AX3S4DUC7DFZIAG2BYKJV6LVD3ZFZANCNFSM5SWRA2EQ>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
This message is confidential and may be covered by legal professional privilege. If you are not the intended recipient, you must not disclose or use the information contained in it. If you have received this email in error, please notify us immediately by return email or by calling us on +44 (0)7980 621088 and delete the email. Further information is available from www.stavertonpartners.co.uk.
|
EDIT: Didn't realize this was a github issue, I was emailing thinking it was the google group 🤦 I remade my comment below to use github formatting.
|
I think for us to be able to help, we'll need to be using the same tool. Which unfortunately means CURL. Below is the simplest POST that will work for a treatment note. Once that's working with your params, add your content to make sure it's working. If CURL works then we'll know there's a problem somewhere in the other tool you're using. curl https://api.au1.cliniko.com/v1/treatment_notes \
-u YOURAPIKEY-au1: \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'User-Agent: CURL ***@***.***)' \
-d '{ "draft": true, "patient_id": 835505263451571861, "title": "Test" }' \
-X POST |
Hi there,
I'm struggling to get the treatment_notes endpoint to accept treatment notes content. I can create the notes ok, but am struggling to actually update the notes - example of the data I'm feeding into 'content' below:
{"sections": [{"name": "Section 1", "questions": [{"name": "Patient progress report", "type": "paragraph", "answer": "hello world"} ] } ] }
...and getting a 500 error:
Any help gratefully received.
The text was updated successfully, but these errors were encountered: