API returning a file created in Dataiku
Hi community,
I was wondering if anyone might have experience in solving a challenge we have right now. Perhaps is something that has already been done by others, or it might be available as an example in Dataiku's documentation, and I've not found it yet.
We have a project that is creating Excel files and plots to be used in reports. At our organization, we already have a "frontend" that people are used to, and we would like to try to connect this fronted through an API with the dataiku results.
The scenario is like this: a user will like to get the plots and data (as files) for a specific set of metrics for a particular year. The idea would be that the frontend would ask for the files from Dataiku through a rest API.
My question is: what is the right API endpoint to use? I'm guessing is a Python function endpoint. Does anyone have an example of this kind of functionality?
Furthermore, what is your opinion on people consuming information created with dataiku in this way? Could it be that in the long term it is better to create a "frontend" directly in Dataiku?
Thank you for any feedback or help that you can share!
Best Answer
-
Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,226 Dataiker
Hi @Ignacio_Toledo
,The Python function returns a JSON response only, so downloading file directly is not you would need to have additional logic on your end to read that response and generate a file that can be download from it.
I think the existing REST APIs may suffice in this case, if you know which files/dataset you want to serve to users:
If the excel files stored in the managed folder you can use :https://doc.dataiku.com/dss/api/11.0/rest/#managed-folders-managed-folder-contents-get-1
If these are actually datasets you can use: https://doc.dataiku.com/dss/api/11.0/rest/#datasets-dataset-data-get
You could use these REST API endpoints in your existing frontend interface to interact with DSS and server these files to users.
Indeed Dataiku Webapp would allow more flexibility, you could dynamically build the file as users request it by running a scenario for example and saving the file to a managed folder here we have an example of a simple web app to download a file https://knowledge.dataiku.com/latest/kb/reporting/web-apps/download-from-dss-webapp.htmlHope this helps!
Answers
-
Ignacio_Toledo Dataiku DSS Core Designer, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Dataiku Frontrunner Awards 2021 Participant, Frontrunner 2022 Participant, Neuron 2023 Posts: 415 Neuron
Thanks @AlexT
, this is, in fact, useful. I'll be looking at the docs and links you shared.
I will mark the answer as "solution" in a few days, just in case there is more people that wants to jump in with suggestions.