Curl : Submission to ODKAggregate

Greetings.

Currently doing a project using OKDAggregate Server, to use "curl" to
submit form data to Aggregate.
Did read all wiki pages:
https://bitbucket.org/javarosa/javarosa/wiki/OpenRosaAPI
https://bitbucket.org/javarosa/javarosa/wiki/FormSubmissionAPI
and related wiki pages but no solution.
After some web search and figured out how to use "curl -F" to submit xml
text file to Aggregate.
Just guess it's not so difficult to submit associated file such as jpg
image file to Aggregate.
However, still can't do that after so many tries.

For example image file = picture.jpg
Did try:
curl -F "image=@picture.jpg" "[AggregateServerURL]/submission", not working.
curl -F "media=@picture.jpg" "[AggregateServerURL]/submission", not working.
curl -F "binary=@picture.jpg" "[AggregateServerURL]/submission", not
working.
Also tried:
curl -d --data-binary "file:///[location]/picture.jpg"
"[AggregateServerURL]/submission", not working.

Any help will be appreciated.
Cheers,
Janus

Hi Yaw,
Thanks for your quick reply and appreciate you help.
Sorry for repost, since I'm using a low speed RDP remote.

Thanks for your advice. Yes, look at the Collect source code is really a
good idea, although it's a hard job.
If I can't figure that, I will definite do that or even tcpdump to find out.

However, just just before I reply this, I figured out how to do that
luckily.
After I look at
(1) [OKDAggregateURL]/submission webpage with manual upload interface, and
(2) read "javarosa / FormSUbmissionAPI" wiki again, especially below:

Additional Parts

  • Content Type: arbitrary
  • Name: matches an appropriate element inside of the XForm Element's
    XML.

Then, I believe I found the solution, and it's correct. I'm pretty happy
and relax now.
Thanks, Yaw for your help.
I trust ODK very much because your support.

··· On Thursday, November 26, 2015 at 2:36:53 PM UTC+8, janusm...@gmail.com wrote: > > Greetings. > > Currently doing a project using OKDAggregate Server, to use "curl" to > submit form data to Aggregate. > Did read all wiki pages: > https://bitbucket.org/javarosa/javarosa/wiki/OpenRosaAPI > https://bitbucket.org/javarosa/javarosa/wiki/FormSubmissionAPI > and related wiki pages but no solution. > After some web search and figured out how to use "curl -F" to submit xml > text file to Aggregate. > Just guess it's not so difficult to submit associated file such as jpg > image file to Aggregate. > However, still can't do that after so many tries. > > For example image file = picture.jpg > Did try: > curl -F "image=@picture.jpg" "[AggregateServerURL]/submission", not > working. > curl -F "media=@picture.jpg" "[AggregateServerURL]/submission", not > working. > curl -F "binary=@picture.jpg" "[AggregateServerURL]/submission", not > working. > Also tried: > curl -d --data-binary "file:///[location]/picture.jpg" > "[AggregateServerURL]/submission", not working. > > Any help will be appreciated. > Cheers, > Janus >

Hi Janus,

Please don't send multiple messages to the list.

Form submissions are sent to servers as a multipart MIME envelope and
you must always send the XML content.

I'm not sure how best to do that in curl, but you should look at at
the Collect source code at


to see how it's done in Java and try to go from there. Might also be
easier to build a proof of concept with the lightweight language of
your choice (e.g, Python, Ruby).

If you have more developer questions, please send them to
opendatakit-developers instead of this list.

Yaw

··· -- Need ODK consultants? Nafundi provides form design, server setup, in-field training, and software development for ODK. Go to https://nafundi.com to get started.

On Thu, Nov 26, 2015 at 1:36 PM, janusma.caben@gmail.com wrote:

Greetings.

Currently doing a project using OKDAggregate Server, to use "curl" to submit
form data to Aggregate.
Did read all wiki pages:
https://bitbucket.org/javarosa/javarosa/wiki/OpenRosaAPI
https://bitbucket.org/javarosa/javarosa/wiki/FormSubmissionAPI
and related wiki pages but no solution.
After some web search and figured out how to use "curl -F" to submit xml
text file to Aggregate.
Just guess it's not so difficult to submit associated file such as jpg image
file to Aggregate.
However, still can't do that after so many tries.

For example image file = picture.jpg
Did try:
curl -F "image=@picture.jpg" "[AggregateServerURL]/submission", not working.
curl -F "media=@picture.jpg" "[AggregateServerURL]/submission", not working.
curl -F "binary=@picture.jpg" "[AggregateServerURL]/submission", not
working.
Also tried:
curl -d --data-binary "file:///[location]/picture.jpg"
"[AggregateServerURL]/submission", not working.

Any help will be appreciated.
Cheers,
Janus

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.