Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

HTTP POST BadRequest: The character set provided in ContentType is invalid

Hope someone can help I've been banging my head against this for days now.



Uploading a document to an API using HTTP.


The API requires the following information:








The API will throw a 307 redirect and come back with



<?xml version="1.0" encoding="UTF-8"?>
    <message>userfile is not specified</message>



So I take the URL passed back and resubmit.

Postman takes the response URI and can successfully upload a file to that endpoint. However the same trick in Power Automate fails on the second POST request with: 

BadRequest. Http request failed: 'The character set provided in ContentType is invalid. Cannot read content as string using an invalid character set.'.


Here's the body of the second request:



    "inputs": {
        "method": "POST",
        "uri": "@variables('RegionalURL')",
        "body": {
            "$content-type": "multipart/form-data",
            "$multipart": [
                    "headers": {
                        "Content-Disposition": "form-data; name=\"api_key\""
                    "body": "@binary(variables('pAPIKey'))"
                    "headers": {
                        "Content-Disposition": "form-data; name=\"workflow_id\""
                    "body": "@binary(variables('pWorkflowID'))"
                    "headers": {
                        "Content-Disposition": "form-data; name=\"userfile\"; filename=\"Test.pdf\""
                    "body": {
                        "$content-type": "application/pdf",
                        "$content": "@base64(outputs('Get_file_content_using_path')?['body'])"




I created a Flow that is triggered by a HTTP request to catch the outputs of Postman and the flow I'm trying to create. When the URI is set to the HTTP request test flow no problem and the output is duly received. When I set the URI to the URL returned from the 203 redirect, it gives the BadRequest content-type error before even sending.


What am I doing wrong?


Any help appreciated.


Frequent Visitor

Going to report this as a bug. The request is in fact successful. However the response cannot be read due the runtime bad request error.

Helpful resources

Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Users online (47,388)