Send a new line in a comment to Conduit API


#1

Hello,

Conduit API allow to send a new comment to a Phabricator review with
https://secure.phabricator.com/conduit/method/differential.createcomment/
https://secure.phabricator.com/conduit/method/differential.revision.edit/
by sending the comment as a string.

How do I represent a new line in the message string?

EDIT:

I tried "\n", "\\n", "<br>" and "<\br>"

Nothing worked. They all appear like that in the output.


Wrongly closed question
Send a new line in a comment to Conduit API from Jenkins
#2

In JSON strings, newlines are represented as \n.


#3

I tried that (just edited the original question). Is there an easy was to test that in Conduit? (maybe some other thing in the pipeline is messing with it.


#4

What command(s) are you actually using to make the api call?


#5
curl https://localhost.com/api/differential.createcomment -d api.token="super-secret" -d revision_id=<id> -d message="No\nNo\\nNo\\\nNo\\\\nNo<br>No<\br>No"

Output:

No\nNo\nNo\nNo\nNo<br>No<\br>No


#6

That’s not json, that’s shell.

In shell, new lines are just newlines:

curl -d message='foo
bar'

#7

Ah! Obviously…
Missed that!
Thanks!


#8