Requested URI does not represent any resource error in Scripted rest API

Anusha48
Tera Contributor

Hi,

Please can anyone help with how to handle this Error below.

Scripted Rest API :

Anusha48_1-1694994473329.png

 

When response is a single line string the functionality is working.

Anusha48_2-1694994584557.png

When response is a multiline line string then below error occurring.

Anusha48_3-1694994684845.pngAnusha48_4-1694994701975.png

Anusha48_5-1694994744087.png

 

1 ACCEPTED SOLUTION

Maik Skoddow
Tera Patron
Tera Patron

Hi @Anusha48 

 

due to REST API conventions "response" cannot be part of the URL because exactly then what happens as in your case: any critical chars like "\n" become part of the URL and break it.

The correct way is to send "response" within the body. In your Scripted REST API you can extract the value via 

 

var res = request.body.data

 

Maik 

View solution in original post

3 REPLIES 3

Maik Skoddow
Tera Patron
Tera Patron

Hi @Anusha48 

 

due to REST API conventions "response" cannot be part of the URL because exactly then what happens as in your case: any critical chars like "\n" become part of the URL and break it.

The correct way is to send "response" within the body. In your Scripted REST API you can extract the value via 

 

var res = request.body.data

 

Maik 

Thanks @Maik Skoddow 

 

Tony Chatfield1
Kilo Patron

Hi, unfortunately the screenshots don't really help clarify your issues. But I see in 'bad request' that the url seems to contain a new line char IE '\n' and I think you would need to use http special characters if you were creating\returning the value into a url.
HTML URL Encoding Reference (w3schools.com)