I'm calling a REST service that has a GET Picture operation. The operation returns the jpg file; not a URL. How do I 1. Get this to display, 2. Do it without the API key being visible. Thanks.
I'm calling a REST service that has a GET Picture operation. The operation returns the jpg file; not a URL. How do I 1. Get this to display, 2. Do it without the API key being visible. Thanks.
Hi Nathan -
Please check our 'File' section here it describes how to work with images in Appery.io -- http://devcenter.appery.io/documentat...
Hi Illya, the above link only shows me how to interact with files that have been uploaded into an Appery database. I'm trying to get an image from an (non-Appery) API to display.
Hello,
You can use external (3rd party) REST services in accordance to their API.
So if you need access to your external DB you need implement/install external API for this database.
See details how to use 3rd party APIs here:https://devcenter.appery.io/tutorials...
Hi Alena, the attached link still doesn't answer the question. I have already connected to the 3rd part API, and can display the data in the Appery app easily - the problem is that the API returns the image (GET Picture) not as a URL, but as a file. As Illya mentioned earlier if this was stored in an Appery DB I could interact with this as a file, but as it's not, I cannot - or at least I cannot find a way to.
In summary, the 3rd party API is returning a JPEG file as part of the GET operation. I need a method within Appery to display this JPEG while not displaying the subscription key.
I've attached a screenshot of the API results within the Appery settings to hopefully clarify the question.
Hi Nathan,
You don't need to use "service" if you don't pass some "headers" to the request.
Here is solution for your goal:
create url with needed request parameters.
Assign received URL as src attribute for image component.
Here is an example of code(you should modify it with your data):
pre
var url = "http://domain.com/path?user=test&password=testPass";
Apperyio("imageComponentName").attr("src", url);
/pre
Regards.
Hi Yurii; won't that make the secret visible to anyone using the app?
Hi Nathan,
Every client part(if it's not somehow secured) is able to view. The question is just how it hard. And client-part service is not an exclusion.
If you need to be sure your secret secured you can use server code to store this sensitive information on the server. Server code gets needed content with secret and and returns it as just content. Thus user could access sensitive information without sensitive secret.
More info about server code here: https://devcenter.appery.io/documenta...
Regards