Skip to main content
Solved

Flow REST API Upload curl

  • September 3, 2024
  • 2 replies
  • 263 views

pflegpet
Contributor
Forum|alt.badge.img+8

Hi, 

I try to upload a file to the FME Flow Shared Resource Folder via the Flow REST API. When I use Postman the request works as expected but I need to send the request in a command prompt with curl. Of course, first I tried to use the curl that can be generated in Postman but it always returns the error “curl: (26) Failed to open/read local data from file/application. 
 

Here are the paramters for the working upload in Postman:

Postman generates the following curl:

curl --location 'https://fmeflow/fmerest/v3/resources/connections/FME_SHAREDRESOURCE_DATA/filesys/Test' --header 'Authorization: fmetoken token=1234' --form 'file=@"/C:/Users/e059231a/Downloads/test_upload.txt"'

 

I already tried to remove the quotes from the filename and to replace the slashes with double backslashes but still get the mentioned error. 

Best answer by dylan.at.safe

Hi @pflegpet,

 

I tested this on a Windows machine and initially encountered the same error you did. It appears that the Postman cURL code snippet is formatted for Unix-like operating systems.

 

I was able to successfully upload a text file using the formatting below:

Working URL Format

curl --location "https://myfmeflow.com/fmerest/v3/resources/connections/FME_SHAREDRESOURCE_DATA/filesys/Dylan_Testing" --header "Authorization: fmetoken token=12345" --form "file=@C:/Users/dylan/Documents/FME Training/test_upload.txt"


 

View original
Did this help you find an answer to your question?

2 replies

dylan.at.safe
Safer
Forum|alt.badge.img+7
  • Safer
  • Best Answer
  • September 3, 2024

Hi @pflegpet,

 

I tested this on a Windows machine and initially encountered the same error you did. It appears that the Postman cURL code snippet is formatted for Unix-like operating systems.

 

I was able to successfully upload a text file using the formatting below:

Working URL Format

curl --location "https://myfmeflow.com/fmerest/v3/resources/connections/FME_SHAREDRESOURCE_DATA/filesys/Dylan_Testing" --header "Authorization: fmetoken token=12345" --form "file=@C:/Users/dylan/Documents/FME Training/test_upload.txt"


 


pflegpet
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • September 4, 2024

@dylan.at.safe,

Thank you! The curl command is now working for me as well. Had to replace the single quotes with double quotes.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings