Makoto
Posts: 0
Joined: Fri Oct 10, 2014 8:15 am

Retrieving image from DB

Hello,

when I try to retrieve an image file from DB, I receive the following error. I set image/jpeg for Content-Type. I know there are some similar posts. However, it doesn't work. So, would you give me the solution for this?

{
"status":400,
"uri":"https://api.appery.io/rest/1/db/files...",
"response":{
"code":"BCXX002",
"description":"Cannot consume content type"
}
}

I refered to the following articles.

https://devcenter.appery.io/documenta...

And, I uploaded files using the following Upload File to Database plugin.

https://devcenter.appery.io/documenta...

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Retrieving image from DB

Hello,

Please use a direct link to the image to read it: https://devcenter.appery.io/documenta...

Makoto
Posts: 0
Joined: Fri Oct 10, 2014 8:15 am

Retrieving image from DB

Hi Sergiy,

Thank you for your quick reply!
I tried to implement the way you suggested and I could successfully get an image on "browser".

But, how can I import it as response on "DB service" and map it on "Mapping action editor"?

The response was something like the following image and I couldn't import it as response.

Image

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Retrieving image from DB

Do you need to show that image in the image component?
If so, please add a JS code below to the mapping from service responce-image component:

prereturn "https://api.appery.io/rest/1/db/files/databaseID/" + value;/pre

here databaseID ID of your database

Makoto
Posts: 0
Joined: Fri Oct 10, 2014 8:15 am

Retrieving image from DB

Hi Sergiy,

Thank you for your update!
Now, I'm following your advice and implementing it.
I will give you the result as soon as possible.
Thanks.

Makoto
Posts: 0
Joined: Fri Oct 10, 2014 8:15 am

Retrieving image from DB

I found the following very useful Appery.io official posts.
And, I could successfully show image in image component.
Thank you!

Learn How to Quickly Upload, Display, and Customize Images from the Database with the Built-in Files Collection

Display Images from a Cloud Database Using Generated REST APIs

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Retrieving image from DB

Glad to hear that this posts were helpful! :)

guru
Posts: 0
Joined: Fri Nov 10, 2017 12:16 pm

Retrieving image from DB

Thanks a lot Serhii, Even I was having same issue.Now it has got resolved. Thank you very much for the help.

Return to “Issues”