HTTP POST Request - Problem with body JSON set as NULL on API endpoint

Hello !
For my automation I need to create HTTP POST request which send a JSON into the request body.
This method ‘GetDeliveryNumberSuggestions’, will receive the JSON, and will deserialize it into a C# class.

First, I’ve started my test with a REST Client integrated into firefox, with success.

But when I’m trying to do the same with UI Path, it’s not working. I’m reaching the endpoint but my string is always null. I’ve set double quote, simple quote, no quote… does ‘null’ also does to be quoted ?


And the config :

I do not understand the problem. Thanks for any help !

Sample in VB
"[{""Key1"":""ABC"", ""Key2"": 1234, ""Key3"": null}]"

C#
"[{\"Key\":\"ABC\", \"Key2\": 1234, \"Key3\": null}]"
or as verbatim string
@"[{""Key"":""ABC"", ""Key2"": 1234, ""Key3"": null}]"

Thanks but it’s not working

it is recommended to share with us what was done, and what was not working in detail.

For the VB sample we have the working result:
grafik

Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

I’ve set your example as value for my body


And the request before execution

The problem is when I reached my endpoint into GetDeliveryNumberSuggestions method ‘dataString’ value is always null.

Before going further: Is C# or VB.Net used?

Sorry VB.net

Okay, finally the solution was to use a simple JsonConvert.SerializeObject(jsonText)…
To obtain data string like that :
“[{"ReceipNoteId": 0, "ReceiptNoteNumber": null, "DeliveryDate": null, "SiteId": 0, "SiteName":"AC0001", "SupplierName":"JohnDoe", "SupplierId": 0, "DeliveryNumber": null}]”

Thanks for help !

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