HTTP Request | Error 415 - Unsupported Media Type

Hi. I’m currently trying to request the following API, here’s how it looks like in Postman:

It’s supposed to respond with a “requestSent”: true, but it keeps on returning a 415 Error, kindly check last pic

And here’s how the request looks in the HTTP request wizard (UiPath Activity)

And this is the error I get:

Are my parameters modified incorrectly, how can I make this work?

Thanks,
Mc

Simple enough question, however, have you placed your parameter values in quotations in UiPath

Hi @UiP_Mc,

Instead of putting in your json variables as parameters, take the json exactly as you see in postman and put in the body of the request. See if that works.

Cheers.

Troy

I will try this, thanks.

How do I do this? There’s no body to input the request payload. Just a ‘add a parameter’ button

@UiP_Mc,

Once you close the wizard and look at the HttpClient properties, you’ll see Body under options. Put your payload here. I don’t see that option in the wizard.

image

1 Like

Hey @tmays, I tried this, but I don’t know how to debug this error:


I just copied and pasted the exact request body from postman to the properties.

Thanks,
Mc

Hi @ronanpeter, I tried to put double quotations but it prompted a different error, I don’t think quotations are needed when supplying the value of the parameters.

I also tried to add the parameters one by one in the properties editor and this is what I get as a response:


I tried looking it up, and it said that it might be because of an unsupported format.

Here’s my Body Format:
image

Hey @UiP_Mc. I think your BodyFormat is fine as application/json and @ronanpeter is correct about the double quotes (in places).

For the key value pair, the key is not quoted and the value, if string, requires a double quote. The start of your body should look like this:

" {
requesterName : ““engineer bob””,
phoneNumber: “”+639985782272"",

}"

The beginning single quote starts the string, no quotes around the key of the key/value pair (because they’re already included as part of the overall string), and double quotes around the value of the key/value pair. Those will be changed to single quotes when processed.

Let me know how this works out.

Cheers!

Troy

Hi. I found a solution to this from a similar case:

So the Body(String) shouldn’t have a single space, and everything should be double quoted e.g. “”“requisitionNumber”":"“123"”,"“requisitionDescription”":"“sample Description”""
Thanks Troy,
Mc

So the double quotes around the key worked?

Yup. It has to be enclosed like a string

Thank you sir.

1 Like

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