I created a custom script for an API call and it works when I run it in code perspective as a bot task. Here is the code:
@CustomScriptAction(
input = ['input_v'],
output = 'output_v'
)
def customScript(){
def url = "https://api.aylien.com/api/v1/sentiment?text=" + URLEncoder.encode(input_v, "utf-8")
def connection = new URL(url).openConnection() as HttpURLConnection
connection.setRequestProperty('X-AYLIEN-TextAPI-Application-Key', '//mykey')
connection.setRequestProperty('X-AYLIEN-TextAPI-Application-ID', '//mykey')
output_v = connection.inputStream.text
}
I created the recorder variables input_v and output_v as type string. However when I run the recording I get the following error. error.txt (4.0 KB)
It seems like the recorder string variable is not compatible with the string format of the code. (No signature of method: “static java.net.URLEncoder.encode() is applicable for argument types: (com.workfusion.studio.rpa.recorder.api.types.RString, String)”.
Function operating with string therefore doesn’t seem to work. How could I fix this?