415 Unsupport media type error


#1

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”
}`


#2

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


#3

of course ,

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


#4

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


#5

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


#6

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


#7

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


#8

are there anyone can guide ? @Teodor


#9

I checked again …


#10

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


#11

Hi Serhat,

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


#12

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 ?


#13

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


#14

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


#15

No this is not possible.


#16

what is your idea @George ?


#17

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

For dynamic urls


#18

thank you so much


#19

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.


#20

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