kkiw
(Henry Wang)
October 28, 2021, 9:57am
1
Hi,
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\"]}"
postwick
(Paul)
October 28, 2021, 12:24pm
3
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.
ppr
(Peter)
October 28, 2021, 12:28pm
4
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
kkiw
(Henry Wang)
October 28, 2021, 12:41pm
5
It didn’t seem to work, unfortunately
kkiw
(Henry Wang)
October 28, 2021, 12:41pm
6
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!
postwick
(Paul)
October 28, 2021, 12:45pm
7
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.
postwick
(Paul)
October 28, 2021, 12:45pm
8
My solution is the same as Peter’s. JSON is how you convert the array to string.
postwick
(Paul)
October 28, 2021, 12:49pm
10
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.
ppr
(Peter)
October 28, 2021, 12:59pm
11
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\"]}"