You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Jacques Le Roux <ja...@les7arts.com> on 2021/07/11 12:30:26 UTC

Re: Upload image from postman

Hi Daors,

What is the type of the uploaded file? Are all types failing?

Jacques


Le 08/07/2021 à 13:30, Daors a écrit :
> Hello community of OFBiz hope you're doing good,
>
> There was a issue that I would like to address and that is uploading images/document from Postman,
> I'm using the ofbiz-rest-impl plugin for exposing current ofbiz services as rest, I exposed one of the services for uploading content (documents,images) I encoded the url and then trying to send a request from Postman. F.E:
>
> {{localhost}}/rest/services/uploadContentService
>
> with a POST method and have two attributes inParams=
> where there are encoded parameters and the other is
> uploadedFile which is a file, but when I send the request I get this error:
>
> {
>      "statusCode": 415,
>      "statusDescription": "Unsupported Media Type",
>      "errorMessage": "HTTP 415 Unsupported Media Type"
> }
>
> I researched about this problem and saw that there are some cases where people said that you have to put jersey mediapart dependency to project in order to work but I checked it and is already there.
>
> Thank you for your time,
> Have a great day,
> Daors
>
>
>

Re: Upload image from postman

Posted by Daors Islami <da...@gmail.com>.
Hi Jacques,

Thank you for your response I managed to find a solution and used
ServletFileUpload class for retrieving any type of files and then converted
it into byte arrays and was able to send it to the service,

Best regards,
Daors

On Sun, Jul 11, 2021 at 2:32 PM Jacques Le Roux <
jacques.le.roux@les7arts.com> wrote:

> Hi Daors,
>
> What is the type of the uploaded file? Are all types failing?
>
> Jacques
>
>
> Le 08/07/2021 à 13:30, Daors a écrit :
> > Hello community of OFBiz hope you're doing good,
> >
> > There was a issue that I would like to address and that is uploading
> images/document from Postman,
> > I'm using the ofbiz-rest-impl plugin for exposing current ofbiz services
> as rest, I exposed one of the services for uploading content
> (documents,images) I encoded the url and then trying to send a request from
> Postman. F.E:
> >
> > {{localhost}}/rest/services/uploadContentService
> >
> > with a POST method and have two attributes inParams=
> > where there are encoded parameters and the other is
> > uploadedFile which is a file, but when I send the request I get this
> error:
> >
> > {
> >      "statusCode": 415,
> >      "statusDescription": "Unsupported Media Type",
> >      "errorMessage": "HTTP 415 Unsupported Media Type"
> > }
> >
> > I researched about this problem and saw that there are some cases where
> people said that you have to put jersey mediapart dependency to project in
> order to work but I checked it and is already there.
> >
> > Thank you for your time,
> > Have a great day,
> > Daors
> >
> >
> >
>