Rally Software

Expand all | Collapse all

How can I create a newline in a Rally testCaseResult notes string using JSON with the API?

Jump to Best Answer
  • 1.  How can I create a newline in a Rally testCaseResult notes string using JSON with the API?

    Posted 01-26-2015 02:30 PM
    When I put a valid \r\n into the notes string in JSON, it just shows up in the notes as an ASCII \r\n, instead of a carriage return/line feed pair.


  • 2.  Re: How can I create a newline in a Rally testCaseResult notes string using JSON with the API?
    Best Answer

    Posted 01-27-2015 05:38 PM
    Bill,

    I think your issue is that the Notes field is a rich text/html field. As such, you'll want to use <br/> instead of \r\n.

    Thanks,

    David
     


  • 3.  Re: How can I create a newline in a Rally testCaseResult notes string using JSON with the API?

    Posted 01-27-2015 05:51 PM
    That makes sense to me, too.  Let us know if that works better, Bill!


  • 4.  Re: How can I create a newline in a Rally testCaseResult notes string using JSON with the API?

    Posted 01-27-2015 07:28 PM
    David is correct. Here is a curl command that creates a test case result with a new line in the Notes field:
     
    curl --header "zsessionid:_abc123" -H "Content-Type: application/json" -d"{\"TestCaseResult\":{\"Build\":\"1.0\",\"TestCase\":\"/testcase/1234\",\"Workspace\":\"/workspace/1111\",\"Verdict\":\"Pass\",\"Date\":\"2015-01-27\",\"Tester\":\"/user/777\",\"Notes\":\"line one <br /> line2\"}}" https://rally1.rallydev.com/slm/webservice/v2.0/testcaseresult/create

    0EM140000004iLx


  • 5.  Re: How can I create a newline in a Rally testCaseResult notes string using JSON with the API?

    Posted 01-29-2015 09:18 AM
    Thanks David.  That worked just fine.
    Bill