Issue when using REST to submit to multi line text field | Optional


Using a carriage return in a string field, such as description field when submitting a REST message it returns an "Invalid Request" response. 

This is experienced if using a REST message to insert or update a field of type string, having a the contents separated by a carriage return.

To avoid the "Invalid Request" response, substitute the carriage return with a "\n" in the REST message.




Getting "Bad Request" when using REST message to insert or update a table in ServiceNow and the error message is:

error: {
message: "Exception while reading request"
detail: "Verify Request body and Content-type headers. Not able to parse request"
status: "failure"





 Using the carriage return breaks the message and results in that the text message is not terminated correctly




The text submitted in the REST message must be correctly terminated.

Use a "\n" in place of the actual carriage return. 


Bad Request will contain the following:

{"short_description":"SN-REST Test", "description":"This is a line with
a second line"}

When processed the following response is received:

Please refer to "REST Message Bad Request response.png" attached
Successful request will contain the following:
{"short_description":"SN-REST Test", "description":"This is a line with \n a second line"}


The response will contain the details of the created record

Please refer to "REST Message - Successful.png" attached.




Article Information

Last Updated:2015-06-15 08:49:49