Transmitting line breaks in REST Calls
search cancel

Transmitting line breaks in REST Calls


Article ID: 249986


Updated On:


CA Service Management - Service Desk Manager CA Service Desk Manager


How to format text being sent in a Service Desk REST API call to include line breaks or new lines in the transmitted text.

Example Use Case:  User is trying to send the following text as an activity log description entry:

Created from REST
API Java Samples code

Compared to sending:

Created from REST API Java Samples code


Release : 17.3

Component : SDM - REST Web Services


in Postman, we send a REST call via JSON to indicate for a line break being separated by the "\n" character sequence.  The description field shows "Created from REST \n API Java Samples code" being passed to an activity log description field.

The resultant activity log display:


Additional Information

This test is using JSON via PostMan to demonstrate the line break and is a proof of concept of the correct text that needs to be included to introduce the line breaks.  If your REST platform does not allow the above text sample to format correctly, it will be due to how the given platform handles and interprets string text, if it is expecting an escape character like "\\n" an alternate representation of a newline such as "\r\n" or even a combination of both "\\r\\n".  There are also other representations of a new line, as described in this link which may be appropriate to your REST platform.   

It is outside the scope of Broadcom Support to assist in troubleshooting why a given REST platform may not be transmitting the same code correctly in its REST call.