37
Views
8
Comments
API uploading files
Question

Hi all,

I would like to integrate that Python code into OutSystems API.

In the Python code, we have to login to reach the UI end point before we upload files to it. The API should respone an filepath after a file is uploaded. (e.g. [/tmp/gradio/xxxxxxxxxxx/Test.pdf])

However, how can I do this in OutSystems for the upload files part (i.e. under the #API section)? 

I have searched online but it seems they don't help much for my case, as I am posting a list with both string and binary, instead of solely a binary. 

(FYI, the "pdf_value" in line109 can actually be replaced by a string instead, and the API will still provide a filepath for me. Idk whether this is useful though)

Thanks.


UserImage.jpg
Kwan Yat MOK

Thanks @Rupesh Patil 

Integrating Python with OutSystems would be a good idea, but as we would like to use OutSystems solely so all things can be maintained in one system, I am afraid that this method may not be a solution for us.

Thanks a lot.

2021-01-04 08-13-48
Toto
 
MVP

Hi @Kwan Yat MOK 

Just to make it clear, so you upload your file using Outsystems application and want the path to be consume in python ?


UserImage.jpg
Kwan Yat MOK

Hi @Toto ,

Sorry for not expressing clearly in my post previously. 

I would like to automate the whole process in OutSystems only with no Python used.

(i.e. from generating pdf --> login to UI end point --> upload files to the end point --> receive the file path --> use the file path in another API --> output the response in OutSystems).

Thanks for your reply.

2021-01-04 08-13-48
Toto
 
MVP

Ok,

I don't know if this will works or not, but Outsystems have PostRequest_Submit Action from dependencies HTTPRequestHandler, you can try this action to trigger the post request.

As to automate this, you can try to put the logic in the timer, so timer will trigger this automatically.


UserImage.jpg
Kwan Yat MOK

Thanks. 

I am trying on it, but it seems that it cannot do a basic authentication, nor uploading other inputs.

I would like to input the cookies (act as authentication), as well as the binary file to the API.

Can the action do this?

Thanks.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Kwan,

I don't know Python at all, but looking at the specification of "files" in the POST, I assume it's an end point expecting a multipart/form-data payload. Can you confirm that? Do you have an API description of the end point?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.