I’m currently working with the HTTP Request activity in UiPath to send a POST request to an API endpoint. The request includes a raw JSON body containing a Base64-encoded PDF file.
Here’s the JSON payload I’m trying to send:
[
{
“fileName”: “test.pdf”,
“fileContent”: “JVBERi0xLjUKJb662+4KOCAwIG9iago…base64…==”,
“mimeType”: “application/pdf”
}
]
Despite the fileContent being correctly encoded, I’m receiving the following response:
{
“Errors”: [
“Failed to parse JSON request content.”
],
“StatusCode”: 400
}
I’ve ensured that:
The Content-Type header is set to application/json
The Statuscode 400 indicates Bad Request so I think you are right looking at ajusting the content being sent.
I have attached an example of a Post request with a JSON body that you could check for reference.
I used my Endpoint and run this worflow. Getting response as:
{
“Errors”: [
“The ‘useCaseId’ HTTP Header is missing in the request.”,
“The request body is missing.”,
“The ‘api-key’ HTTP Header is missing in the request.”
],
“StatusCode”: 400
}
I gave ‘useCaseId’ & ‘api-key’ in Header.
Getting response as:
{
“Errors”: [
“The request body is missing.”
],
“StatusCode”: 400
}
Is it working fine while checking from Post man. I would recommend to test the API in post man and fix from there if there are any issues. Post successful response in post man - you can try the same using UiPath