Hello,
I am trying to create HTML notes containing HTML tags via the API.
Using Command Prompt, I am able to create notes with the markup_language set to HTML "2" but I am not able create a note with a body (or body_html) containing HTML tags.
So in brief, this is working:
curl -X POST --data "{\"title\": \"html note without HTML tags\", \"body_html\": \"Some text\", \"markup_language\":\"2\"}" http://localhost:41184/notes?token=75a512287ffc64100a4d7e988d33a2ffae539f6bec07c4dbdb460f1ccb4f3323ebe006027dc544e6c1e87eed0910c62dea43eed324ccb6dd41cdc1020160442e
But if I add a simple <br>
in the body_html, it's not working anymore:
curl -X POST --data "{\"title\": \"html note without HTML tags\", \"body_html\": \"Some <br> text\", \"markup_language\":\"2\"}" http://localhost:41184/notes?token=75a512287ffc64100a4d7e988d33a2ffae539f6bec07c4dbdb460f1ccb4f3323ebe006027dc544e6c1e87eed0910c62dea43eed324ccb6dd41cdc1020160442e
I have tried different things* like changing body_html
to body
, escaping the \<
and \>
, using --data-urlencode
, adding a header with -H Content-Type
set to json or utf-8, using Python/request with and without using json.dumps()
for the data.
The errors I get are:
- for most of the requests I tried:
The system cannot find the file specified.
- when using
--data-encode
: Internal Server Error: Unexpected token % in JSON at position` - in Python request:
error 500
What should I do to make this request work?
Joplin 2.8.8 (prod, win32)
Client ID: f493c04dd4c2456593b807a1a1a6d505
Sync Version: 3
Profile Version: 41
Keychain Supported: Yes
Revision: c2a6a13
Window 10 version 21H1
I can't use the single quotes around the data as described in the REST API reference page because I get these errors: URL using bad/illegal format or missing URL
and unmatched close brace/bracket in URL position 20: markup_language:2}'
. I was able to solve these errors by using the double quotes around the data and by escaping them inside.
*)