Page 1 of 1

Retrieving image from DB

Posted: Thu May 26, 2016 5:54 am
by Makoto

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...


Retrieving image from DB

Posted: Thu May 26, 2016 9:51 am
by Serhii Kulibaba

Hello,

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


Retrieving image from DB

Posted: Fri May 27, 2016 6:16 am
by Makoto

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


Retrieving image from DB

Posted: Mon May 30, 2016 5:31 pm
by Serhii Kulibaba

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


Retrieving image from DB

Posted: Tue May 31, 2016 3:41 pm
by Makoto

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.


Retrieving image from DB

Posted: Wed Jun 01, 2016 1:42 pm
by Makoto

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


Retrieving image from DB

Posted: Wed Jun 01, 2016 1:45 pm
by Illya Stepanov

Glad to hear that this posts were helpful! :)


Retrieving image from DB

Posted: Mon Sep 03, 2018 9:27 am
by guru

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