Explore Courses Blog Tutorials Interview Questions
0 votes
in RPA by (5.3k points)

I am trying to use file name path (Ex: C:\Document\Report.txt) as a parameter through uipath orchastrator api. I tried different approach and In each approach I am getting Bad request error "{"message":"Argument Values validation failed.","errorCode":2003,"resourceIds":null}"

Below is my Example code

FileListUploaded ="C\\Documents\\report.txt"; string parameter1 = "{\"startInfo\": {\"ReleaseKey\": \"xxxxx-xxx-xxx-xxx-xxxxxx\"," + "\"RobotIds\": [xxxxx]," + "\"JobsCount\": 0," + "\"InputArguments\": \"{ "+ "\\\"reports_or_other_files\\\": \\\" + FileListUploaded + \\\"}\"}}"; request_startRobot.AddParameter("application/json; charset=utf-16", parameter, ParameterType.RequestBody); IRestResponse response_startRobot = client_startRobot.Execute(request_st

1 Answer

0 votes
by (9.5k points)

quoting and escaping your JSON correctly, is a imporatnt step and looks like you are missing it.

I might suggest building an array and serializing it into JSON to make it easier to read, or using a HEREDOC or string formatting. If you do continue to concatenate your JSON body string together, dump out the results to see how it is coming together.

The final results of the JSON should look something like

{ "startInfo": { "ReleaseKey":"{{uipath_releaseKey}}", "Strategy":"JobsCount", "JobsCount":1, "InputArguments":"{\"reports_or_other_files\":\"C:\\\\Documents\\\\report.txt\"}" } }

With the InputArguments:

  • Looks like you are missing some quotes

  • Might need to double escape your backslashes in the FileListUploaded variable

  • Missing a colon after the C in the path

Browse Categories