Help to input array of strings variable through an API


I have been facing some issues with the input variables that I want to send to my robot through an API.

The input variables that I wish for are the following:

And this is what I have written in Postman. However, I am getting errors as you can see. Does anyone know the resolution to this? Is the input format perhaps wrong?

Any help is very appreciated. Many thanks!

Hi @kkiw ,

Can you please try something like this?

"InputArguments": "{"PartNumber":["2402427","2406405","1444777"],"PartQty":["2","3","6"]}"

or for Postman:

"InputArguments": "{\"PartNumber\":[\"2402427\",\"2406405\",\"1444777\"],\"PartQty\":[\"2\",\"3\",\"6\"]}"

I assume you can’t do complex datatypes with the API just like you can’t with queues. Convert it to String for input purposes and then in your automation deal with converting it back to an array.

we do serialize the object into a JSON String:

and do using the resulting string as it is string

getting back the array we do use DeserializeObject

1 Like

It didn’t seem to work, unfortunately

I think this is the best solution that I can find. I will check with the API team if this works… Thanks in the meantime!

If it didn’t work then you have something wrong in your code. Converting to JSON string and back is the correct way to do it. I’ve done the same.

My solution is the same as Peter’s. JSON is how you convert the array to string.

Ensure following:

1 Like

I think these are added when you install UiPath.WebAPI - I always just use that package. It has some activities that make things a little simpler for JSON beginners like me.

in general, there are there (let’s exclude some surprising stories from the past). But as it is needed so a quick check is done and will not harm

1 Like

What was the error? I tried this on my end and it worked.

"InputArguments": "{\"in_SampleStringArrayArgs\":[\"1\",\"2\"]}"