How to update media file (.csv) only using curl?

Hi. I know that I can upload the xml file by

curl --verbose --digest --header "Content-Type: multipart/form-data" --form "form_def_file=@/Users/form1.xml" https://xxxx.appspot.com/formUpload

how can I upload the media file using curl? what is the media folder name for each form?

You can add --form mediaFiles=@<local_path>. If you have more than one media attachment, you can just keep adding more of those. For example:

curl --verbose --digest --header "Content-Type: multipart/form-data" 
--form form_def_file=@/Users/form1.xml
--form mediaFiles=@/Users/data.csv 
--form mediaFiles=@/Users/image1.jpg
--form mediaFiles=@/Users/image2.jpg 
https://xxxx.appspot.com/formUpload 

You can see the receiving code here.

1 Like

Thank you! Is there a way that I can only update the media file?

When I do so to replace only the media file. It is saying:

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>409 Form Already Exists for this Namespace/Id attribute
org.opendatakit.aggregate.exception.ODKFormAlreadyExistsException: Form media file(s) have changed.  Please update the form version and resubmit.</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Form Already Exists for this Namespace/Id attribute
org.opendatakit.aggregate.exception.ODKFormAlreadyExistsException: Form media file(s) have changed.  Please update the form version and resubmit.</h1>
</body></html>

@KitoDavy did you ever find a way to replace only the media file using Curl