Question

How to use a workflow published to fme flow in my web app ?

  • 22 February 2024
  • 4 replies
  • 69 views

Userlevel 2
Badge +5

 

I have a workflow that takes a file in input , does a conversion , then outputs the converted file.

I published this workflow to fme flow . and i want to use it to in my simple node js project : 

simply : the user clicks on “Choose an input File” , and chooses the file he wants to convert ; and after clicking on “Convert and download result!” , his file should get uploaded to my fme server , the workflow gets applied on it , and the resulted file gets downloaded to the users computer. 

 

And I don’t know how to apply the workflow on the file that the user chooses , because the filepath of the reader dataset is static , and can be changed only manually in the fme flow web interface ;


​​

 

 


4 replies

Userlevel 5
Badge +29

To upload the file, you want to use the upload service. This then returns a path you can use when you submit the job
https://docs.safe.com/fme/html/FME-Flow/ReferenceManual/service_dataupload.htm

Userlevel 2
Badge +5

 @hkingsbury  Thanks for the response ! 

 

“This then returns a path you can use when you submit the job”

 

Can you please elaborate how can I do that ? and How can I run the a Job on a different path each time ?

Here is how I run my workflow from Postman for exemple : 

 

The job runs using the default source file path . I’m still struggling to make to change the parameters of the request.

Userlevel 5
Badge +29

Each time you want to run the job you first need to submit the file using the dataupload service, this will upload a temporary copy of the file that will exist for a certain period of time (depends on your server clean up settings).

The response from that call contains the path to that file that you uploaded. This is then used in the subsequent call to run the workspace (in your case a datadownload). This needs to be passed to Flow as one of the published parameters in the request body.

If you have a look at Developer Tools in your browser when you submit a job with a file in the FME Flow GUI this should help you construct the calls and request body appropriately

Userlevel 2
Badge +5

Sounds good. Thanks for your time ! 

Reply