Rafaeloneil
(Rafael Souza)
September 1, 2021, 10:21pm
1
good afternoon guys,
I have been working for some time with Http Requests in UiPath but I came across a problem that I am not able to solve by myself.
I need to make a POST request to an API to populate some data in the target table:
my problem is that the API requires me to point to the Request Body also the Table Name (Table ), item that I’m not able to assemble from the request.
If I try to run the request without the table name I get an error:
Can anyone give me guidance on how to accomplish this?
Just need to know how to pass this Table name in the Request Body via UiPath
I’ve attached an example of the code I’m using to the Topic.
HttpRequesPOST.zip (40.0 KB)
JesusFontalvoGomez
(Jesús David Fontalvo Gómez - Ceiba Software)
September 2, 2021, 12:10am
2
As I understand, you want to build the body as the sample image. However, in the code you posted, you only do the construction of the Table content, but not the Table object.
This is what you did
This is what you want to achieve
If so, you would only have to add an additional object of type JObject containing the name you want (Table) and the content you have built.
Attached modified code
HttpRequesPOST_mod.zip (10.9 KB)
I also include an additional optional to build in a simpler way, in a single line
Additional Advice
By the way, remember to initialize the objects, before trying to use a method on them
Because your code generates
System.ArgumentNullException
Invoke Method VALUE: Value cannot be null. Parameter name: TargetObject
Additional Recommendation
You could have one input dictionary instead of having 8 arguments.
And when it comes to construction, it would be just a ForEach through the dictionary, which adds every property
ForEach Properties
And the parameters of the Add JObject
Thank you very much, I understand the concept and solved the problem!
1 Like
system
(system)
Closed
September 5, 2021, 3:00pm
4
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.