415 Unsupport media type error

Hello @Teodor , @George I need your help,

I have created server side API with API CONNECTOR for image upload . and I have create sample page . (if you want to show demo page I can share url with you )
I have one file field
method = post
enctype = Multipart / form data

windows IIS

I’ve tried every way but I always get the same error. “415 Unsupported media type”… I’ve tried every way but I always get the same error. I found many documents on the internet, many of them say that there is content-type error. Can you help me solve this problem?

API documentation :

Mandatory Fields
file

The form should contain a required named body part with the name “file”.

If you are using a HTML form, a snippet like <input type=“file” name=“file”></input>can be used for uploading the image file

`POST https://DomainName/api/v1/clients/{clientId}/images

POST clients/1/images
Content-Type: multipart/form-data
Request Body: Not shown
{
“resourceId”: 1,
“changes”: {},
“resourceIdentifier”: “1”
}`

Hi. Have you checked the actual request parameters being sent in run time - using the Network tab in Chrome’s dev tools?

of course ,

I think problem wrong “content type” . whe tried to add new content-type in header I get an error .

Sharing the screenshot of values set in Wappler and values shown in request would help resolve the issue faster.

you can test /check it from this link ; http://ginbo.net/test_form.aspx

The content-type is multipart/form-data. There is probably some configuration issue with Client_identifiers_IMAGE_UPLOAD.aspx.

I tried all ways … result same ::slight_smile: maybe @Teodor or @George can help

are there anyone can guide ? @Teodor

I checked again …

I have tested too many times in server side with API CONNECTOR but I cant get any successful result . But when using client side API connecttor it is working very well …

Maybe @patrick or @George can check this issue …
I think server side API Connector send wrong API headers and I cant change it

Windows IIS

Hi Serhat,

Server API connections post just form data, and fetch results, they can’t upload files from the server side

ok I want to GET userimage and I am using GET request (server side ) its return ;

`GET https://DomainName/api/v1/clients/{clientId}/images
Accept: text/plain

				` `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJ

bWFnZVJlYWR5ccllPAAAAJ1JREFUeNpi+P//PwMIA4E9EG8E4idQDGLbw+WhiiqA+D8OXAFVAzbp
DxBvB2JLIGaGYkuoGEjOhhFIHAbij0BdPgxYACMj42ogJQpifwBiXSDeC8JIbt4LxSC5DyxQjTeB
+BeaYb+Q5EBOAVutCzMJHUNNPADzzDokiYdAfAmJvwLkGeTgWQfyKZICS6hYBTwc0QL8ORSjBDhA
gAEAOg13B6R/SAgAAAAASUVORK5CYII=`

can you this Server Side ?
or If I cant do this server side What should I do for security on client side ? what is your suggestion.

and I need to dynamic url inside API CONNECTOR like this ;

https://abc.com/api/DYNAMICXXX/ABC/DYNAMICABC

How to do ?

You want to make a server action that downloads a file from remote API?

yeap, becuase its returns user image (base 64 text format )

No this is not possible.

what is your idea @George ?

Well just use someurl/{{expression}}/etc

For dynamic urls

1 Like

thank you so much

so how can we upload a file to API via server connect?

if this is not supported currently, will request for it - this is going to be useful. like when a file is uploaded via form, we can directly send it to google drive or other storage provider.

1 Like

yes - make a feature request if there isn’t any yet, as we don’t have Server API File upload to other servers yet.