Start Job with Input (string Array) using API

How can we pass Array as an input argument when we start a job using API?


I’m working on a react project and with a button click, I want to start a job with inputs.
I know that we can pass an argument as

“InputArguments”: “{\“message\” : \“hello\”}”

I’m populating an array in React and want to pass it to the process as an input argument.
Following is my uipath code

I’ve tried doing the following in React project

const messagesList = [“message1”, “message2”, “message3”, “message4”]
InputArguments: “{\“message\”: \” “+ messagesList + " \”}"

but when I click on the button and the job starts, it gives me the following error


When I set the argument in orchestrator and start a job through orchestrator, it works fine

Can someone please help me with it?

Hi @Maryum_Siddique

The array should be in {} braces format

@NIVED_NAMBIAR Can you please write the format here for me.

I figured out the solution. The list has to be in JSON format
In react it will be like

const msg = {
messages: [ “message1”, “message2”, “message3”, “message4”]

And the use JSON.Stringify to convert it to JSON

InputArguments: JSON.stringify(msg)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.