Skip to main content
Solved

Flow REST API Upload curl

  • September 3, 2024
  • 2 replies
  • 481 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"


 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

dylan.at.safe
Safer
Forum|alt.badge.img+8
  • Safer
  • 29 replies
  • 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
  • 62 replies
  • 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.