In the HTTP Request (Web API) activity using the POST method, I’m unable to pass values in the body (key-value pair). It keeps throwing an error in my UiPath Studio Community version. However, the same configuration works perfectly on my colleague’s system (Enterprise trail edition).
I’ve tried some basic troubleshooting steps, including reinstalling the Web API package, updating the package, testing the activity in a different project, and restarting UiPath Studio—but the issue still persists.
The HTTP Request activity’s key-value pair UI (FormData field) in Community version has a parsing/escaping bug when handling complex JSON strings with nested quotes. The doubled quotes ("") for escaping aren’t being processed correctly by the UI, causing the JSON to get truncated (that’s why you only see {").
Fix (use this approach):
Instead of entering JSON in the key-value pair UI:
Personally I think it is easier to build up the JSON-body using JObjects and JArrays, and then use .ToString when sending the HTTP Request body.
Of course it can be a bit of a hassle to keep track of the hierarchy of the object, but with some practice it gets easier.
@sanjay_sudarsan You can resolve this by passing the request body as a serialized JSON string instead of adding key-value pairs directly in the value field.
Use the below format in the value field:
Newtonsoft.Json.JsonConvert.SerializeObject(New With {Key .requester = New With {Key .first_name = “Test User”, Key .email_id = “testuser13@gmail.com”}})
This converts the data into a valid JSON payload and works correctly with the POST method.
Also make sure:
This approach should work in Community edition as well.
If this resolved your issue, please mark it as a solution.