[ODK Developers] Posting the form definition file to ODKaggregate

I have no idea what that response from Curl means.

Note that form submissions into ODK Aggregate use standard plain old form
posts. If you have a working ODK Aggregate, you can see the web page for
form submission by opening a browser and pointing to .../formUpload. You
can then view source on that page and reconstruct what you should be
sending to the server.

i.e., if you had the ability to log into opendatakit.appspot.com, you could
get to this plain old web page via:

http://opendatakit.appspot.com/formUpload

From there, your knowledge of Curl should enable you to construct the
appropriate submission.

Mitch

··· On Tue, Mar 12, 2013 at 9:14 AM, wrote:

Hi there,

I am working on a PHP application to manage forms and form data from
outside ODK.
My idea was to post the form definition file from within the application
using curl.
Something like:

$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
curl_setopt($ch, CURLOPT_URL, '

http://myAggregateserver.org/ODKAggregate/formUpload');
curl_setopt($ch, CURLOPT_USERPWD, "myUser:myPassword");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_POST, true);
$post = array(
"form_def_file"=>"@myformdefinition.xml",
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);

This does not work however.
The application returns: "Resource id #2"

Is there anyone who has an idea how to do this?

Cheers!

Wiebe

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

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

Yes. See /formUpload

At the moment, the servlet is not reporting invalid forms correctly. Seems
to be a 1.3 regression.
If it were reporting invalid forms correctly, you would see an error page
other than the over-quota page that it now seems to display.

Mitch

··· On Sun, Mar 24, 2013 at 11:13 AM, wrote:

On Tuesday, March 12, 2013 10:03:30 PM UTC+5, Mitch wrote:

I have no idea what that response from Curl means.

Note that form submissions into ODK Aggregate use standard plain old
form posts. If you have a working ODK Aggregate, you can see the web page
for form submission by opening a browser and pointing to .../formUpload.
You can then view source on that page and reconstruct what you should be
sending to the server.

i.e., if you had the ability to log into opendatakit.appspot.com, you
could get to this plain old web page via:

http://opendatakit.appspot.com/formUpload

From there, your knowledge of Curl should enable you to construct the
appropriate submission.

Mitch

On Tue, Mar 12, 2013 at 9:14 AM, in...@webwolf.nl wrote:

Hi there,

I am working on a PHP application to manage forms and form data from
outside ODK.

My idea was to post the form definition file from within the application
using curl.

Something like:

$ch = curl_init();

curl_setopt($ch, CURLOPT_HEADER, true);

curl_setopt($ch, CURLOPT_VERBOSE, 0);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");

curl_setopt($ch, CURLOPT_URL, '

http://myAggregateserver.org/ODKAggregate/formUpload');

curl_setopt($ch, CURLOPT_USERPWD, "myUser:myPassword");

curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);

curl_setopt($ch, CURLOPT_POST, true);

$post = array(

    "form_def_file"=>"@myformdefinition.xml",

);

curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

$response = curl_exec($ch);

This does not work however.

The application returns: "Resource id #2"

Is there anyone who has an idea how to do this?

Cheers!

Wiebe

--

You received this message because you are subscribed to the Google
Groups "ODK Developers" group.

To unsubscribe from this group and stop receiving emails from it, send
an email to opendatakit-developers+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

--
Mitch Sundt
Software Engineer
University of Washington
mitche...@gmail.com

Hi everyone,

I have a questions along the same line. We have a use case for one of our
upcoming installations where we would be dynamically designing forms and
want to be able to upload them to aggregate through some API call (so that
collect application can download this from the server, fill in the values
and submit it back to aggregate). I see from above that form submission is
a simple http post method. Is it the same if we are uploading a new form
(empty...not a data submission) for a new survey that we now want to
conduct without using the designer etc.

Thanks for any help or suggestions in this regard
Zaineb

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

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com