API returning a file created in Dataiku

Solved!
Ignacio_Toledo
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!

0 Kudos
1 Solution
AlexT
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.html 

Hope this helps!

View solution in original post

2 Replies
AlexT
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.html 

Hope this helps!

Ignacio_Toledo
Author

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.

0 Kudos

Labels

?

Setup info

?
A banner prompting to get Dataiku