API3
ben at July 12th, 2016 06:54 — #1
Hi there!
Basically - I could do with being able to put line breaks into the notes that we submit to the API. However, I can't find any kind of documentation on how to do this? I tried your search, and I found the BBcode options such as [b] and [i] but nothing on how to line break.
Any help would be greatly appreciated.
Cheers!
Ben
liam at July 12th, 2016 07:20 — #2
Hi Ben,
To add a line break in a note, use \r\n
.
I will see that this is added to the API documentation.
Kind regards, Liam
ben at July 12th, 2016 07:28 — #3
Thanks Liam For the record - the documentation is really well put together.
ben at July 12th, 2016 09:33 — #4
Hi Liam,
Sorry, but it's just adding the \r\n in as text, do I need to wrap them in anything?
Cheers!
Ben
liam at July 12th, 2016 10:02 — #5
Hi Ben, thanks for the good feedback about our documentation, it's always nice to here praise or our efforts!
So I just gave it a test and it works fine. But you have to be careful that you aren't escaping the backslashes in the string. Check the data being sent in the request body.
It needs to be
"line one.\r\nline two."
not
"line one.\\r\\nline two."
Some languages like escaping backslashes in strings. For instance, in ruby I had to use double quotes ("
) rather than single quotes ('
) to ensure the backslashes in the note text weren't escaped.
ben at July 12th, 2016 10:15 — #6
Oh wow, yep - my bad I hadn't thought about it escaping them!
Thanks again Liam.
Powered by Discourse, best viewed with JavaScript enabled