Hi Everyone,
What is the problem? Please be detailed.
I need to do daily updates on the media file attached to a survey form (it is a csv file containing a list of names and phone numbers that change each day, but the survey form remains the same).
I can upload a form + media file at the same time with the following:
curl --verbose --digest --user UserName:Password
--header "Content-Type: multipart/form-data"
--form "form_def_file=@/Users/FILE_PATH_TO_FORM/Test.xml"
--form mediaFiles=@/Users/FILE_PATH_TO_MEDIA/comm_db.csv
https://XXX.appspot.com/formUpload
But I would like to be able to:
- Post a media file to an existing survey form (that already contains submissions);
- Delete a media file that is attached to an existing survey form, without deleting the form and submissions.
What ODK tool and version are you using? And on what device and operating system version?
I am using the latest version of ODK Aggregate on Google App Engine.
My operating system is macOS 10.13.4, and I'm using iTerm2 3.1.6
What you have you tried to fix the problem?
I have tried substituting '--form_id Test' instead of
--form "form_def_file=@/Users/FILE_PATH_TO_FORM/Test.xml"
I have also tried curl DELETE, with various combinations of flags (modeled after what works for Ona.io, below)
Anything else we should know or have? If you have a test form or screenshots or logs, attach here.
I currently use Ona.io, and I am able to accomplish the above tasks with the following:
-
Post a media file to existing form:
curl -X POST -F 'data_type=media' -F 'data_value=ret_comm_db.csv' -F 'xform=FormID' -F 'data_file=@/Users/FILE_PATH_TO_MEDIA/comm_db.csv' https://api.ona.io/api/v1/metadata.json -u UserName:Password -
Delete media file without deleting form:
curl -X DELETE https://api.ona.io/api/v1/metadata/MediaID -u UserName:Password
Any help would be much appreciated --- thank you!!
Nicholai