URL formation for ODK briefcase API

I'd like to use the ODK briefcase API to download submissions from a google
app engine install of ODK aggregate. Looking at the docs for the briefcase
API
https://github.com/opendatakit/opendatakit/wiki/Briefcase-Aggregate-API
and the associated Openrosa API
https://bitbucket.org/javarosa/javarosa/wiki/OpenRosaAPI I'm confused as
to how the GET request should be formed. Are there any examples of URL
formation anywhere such as:

https://my-domain.appspot.com//view/submissionList

Apologies if this is a dumb question. The purpose is to try and download
submissions programmatically without having to schedule briefcase to run
every so often. I'm not sure if this is even possible but neither Google
fusion tables and Google sheets will work with my set up.

Thanks,

Oliver

I'm making some progress. So far I can list the individual submissions with
view/submissionList. The URL looks like this:

https://my-domain.appspot.com/view/submissionList?formId=name_of_form

If you need to find your name_of_form you can go to
https://my-domain.appspot.com/xformsList and look for the tag.

Listing the submissions is progress but the view/downloadSubmission
documentation is causing me problems. In particular this section:

formid[@version=null and @uiVersion=null]/topElement[@key=idvalue]

Where formid is the form id. version is either null if not used or the
version number of the form (ODK Aggregate only supports integer version
strings at this time). topElement is the name of the top-level element in
the submission. This is the element within the instance element of the
model that has the id attribute identifying the formid.
And idvalue is the
value of the id returned by the view/submissionList API.

What is the topElement and how do I find it?

Thanks,

Oliver

Got there in the end. I'll leave this up in case anyone else is having
similar difficulties.

The download URL ended up looking like this:

https://my-domain.appspot.com/view/downloadSubmission?formId=name_of_form[@version=null%20and%20@uiVersion=null]/name_of_form[@key=uuid:####whateverNo#####]

To find the topElement I went into Aggregate's form management and viewed
the form xml. In my case topElement was the same as the formId.

The plan now is to use AWS lambda to poll the aggregate site every so often
to pick up new submissions. If anyone has a better method than this please
let me know.

Cheers,

Oliver

You can also find the top element by opening the XML of the form definition
and looking at the main instance definition.

Note that the view/submissionList API takes up to 3 arguments (


). The numEntries argument is useful for large forms and the cursor is
supplied when resuming a pull.

After you have pulled everything from the server, you can use the
resumptionCursor value from your last call to view/submissionList when you
want to test for new submissions on the server (you don't need to start
over again from the beginning).

These additional query parameters are all detailed on the


page.

ยทยทยท On Fri, Mar 24, 2017 at 6:17 AM, Oliver Burdekin <oliverburdekin@burdgis.com wrote:

Got there in the end. I'll leave this up in case anyone else is having
similar difficulties.

The download URL ended up looking like this:

https://my-domain.appspot.com/view/downloadSubmission?
formId=name_of_form[@version=null%20and%20@uiVersion=null]/
name_of_form[@key=uuid:####whateverNo#####]
https://my-domain.appspot.com/view/downloadSubmission?formId=name_of_form[@version=null%20and%20@uiVersion=null]/name_of_form[@key=uuid:#%23%23%23whateverNo%23%23%23%23%23]

To find the topElement I went into Aggregate's form management and viewed
the form xml. In my case topElement was the same as the formId.

The plan now is to use AWS lambda to poll the aggregate site every so
often to pick up new submissions. If anyone has a better method than this
please let me know.

Cheers,

Oliver

--

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.

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