Basically this works in Postman but can’t make it work in UiPath:
Similar to this: how-to-send-a-body-type-form-data-using-post-in-a-http-request . However, answer was for a file and string, not for JSON. I keep on getting this error in the response:
{
"error": {
"code": "NRC_INVALID_PARAM",
"code_message": "Invalid parameter for request",
"details": "No JSON object could be decoded",
"message": "Invalid parameter for request"
}
}
ppr
(Peter Preuss)
February 24, 2022, 10:24am
2
maybethe discussion below will help:
I gave myself a good chuckle as I intended to reply back a few days ago but kept getting busy and then I got hung up the PUT API call as I decided to try External Applications for the first time and wasn’t paying attention when I kept passing the authentication in both my Python and Postman PUT request when I shouldn’t have been … something silly for far too long… I blame it on me not having written Python…
ANYWAYS
Don’t mind the spaghetti code and lack of parametrization and formatting.
The …
Hi @ticsrobo.au ,
Have you tried writing the payload in a notepad file and then using it as a string input to the activity?
Thanks
From my point of view the code should be like this:
String varstr = JObject.FromObject(
New With {
key .name = "Jeff",
key .id = 1,
key .car = "BMW"
}
).ToString
request.Add(New StringContent(“profile”), varstr)
request.Add(New StreamContent(File.OpenRead(“C:\8A.docx”)), “file”, (New FileInfo(“C:\8A.docx”).Name))
The logic is like this you build JSON separately and then you provide it as a string.
Here you have a movie with code on how to build JSON
Thanks,
Cristian
The API had special requirement. I had to invoke custom c# code to comply.
system
(system)
Closed
January 7, 2023, 10:38pm
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.