Transmitting line breaks in REST Calls
search cancel

Transmitting line breaks in REST Calls

book

Article ID: 249986

calendar_today

Updated On:

Products

CA Service Management - Service Desk Manager CA Service Desk Manager

Issue/Introduction

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

Environment

Release : 17.3

Component : SDM - REST Web Services

Resolution

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.

https://api-broadcom-ca.wolkenservicedesk.com/attachment/get_attachment_content?uniqueFileId=iIgfap3UMz9gn7kVwHB0uw==

The resultant activity log display:

https://api-broadcom-ca.wolkenservicedesk.com/attachment/get_attachment_content?uniqueFileId=a+v/0scJGG/igqX14+oBEQ==

 

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.