Hello all,
i wanto to use a Flow to upload a file via REST.
when sending the corresponding command as cURL it works fine.
However, when importing the cURL into Postman (which is my blueprint for the HTTP connector) and trying from there, it fails with "unsupported media type".
I worked the last 3 days through all results Google shows me when searching for this or related error.
p.s.
cURL command:
curl -v -u <user:pass> -X POST "https://<url>/service/rest/v1/components?repository=<name>" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "maven2.groupId=1" -F "maven2.artifactId=1" -F "maven2.version=1" -F "maven2.asset1=@D:<path>\<file>;type=application/pdf" -F "maven2.asset1.extension=pdf"
(yes, its a Maven2 Repo @ Sonatype Nexus)
--> this works fine
However, i'm unable to format the HTTP connector in a way to make it work also via PowerAutomate
Ideas ?
Got it !!!
1st, the reference:
And this is how the body snippet must look like to make it work with Sonatype (Nexus Repository Manager).
{
“$content-type”: “multipart/form-data”,
“$multipart”:
[
{
“headers”:
{
“Content-Disposition”: “form-data; name=“maven2.groupId””
},
“body”: “1”
},
{
“headers”:
{
“Content-Disposition”: “form-data; name=“maven2.artifactId””
},
“body”: “1”
},
{
“headers”:
{
“Content-Disposition”: “form-data; name=“maven2.version””
},
“body”: “12”
},
{
“headers”:
{
“Content-Disposition”: "form-data; name=“maven2.asset1”;filename=“test.txt”
},
“body”: “SGVsbG8gV29ybGQ=”
},
{
“headers”:
{
“Content-Disposition”: “form-data; name=“maven2.asset1.extension””
},
“body”: “txt”
}
]
}
You can edit the values for the IDs to whatever you want or, what i am doing, connect them with values coming from a MS Forms document.
In this example, the value for the asset is a base64 encoded text (“Hello World”).
This is also intended to be connected to a file uploaded via MS Forms.
Hi,
i was trying around a lot.
This is a screenshot from the last trial:
The error is alwas the same: "Unsupported Media Type"
Not sure what you mean with client request id.
Does this help:
From my understanding, this error comes from the destination-server / Sonatype Nexus.
Assuming their docu is correct they should be able to deal with JSON.
If so, i'm "simply" missing the right syntax.
Hi @artivo
Unsupported media type usually indicates the media you are sending or receiving thru the HTTP connector. Can you please post the screenshot of the connector configuration you are using and the client request id from the error?