Wiki

Clone wiki

javarosa / OpenRosaStandards

Downloading a list of forms from ODK Aggregate

Download and parse the XML file you get from http://server/formList. Then download each form from the URL. Format is documented below.

<forms> 
    <form url="http://server/url1">Form 1</form>
    <form url="http://server/url2">Form 2</form>  
</forms>

Posting an instance from ODK Collect to ODK Aggregate

Post a multipart entity to http://server/submission. Confirm server url and 201 response. Sample code below.

// cycle through available xml and binary files and encode them for submission
String url = "http://server/submission";
HttpPost post = new HttpPost(url);
MultipartEntity entity = new MultipartEntity();
for (int i = 0; i < files.length; i++) {
    File f = files[j];
    if (f.getName().endsWith(".xml")) {
        entity.addPart("xml_submission_file", new FileBody(f, "text/xml"););      
    } else if (f.getName().endsWith(".jpg")) {
        entity.addPart(f.getName(), new FileBody(f, "image/jpeg"));
    } else if (f.getName().endsWith(".3gpp")) {
	entity.addPart(f.getName(), new FileBody(f, "audio/3gpp"););
    } else if (f.getName().endsWith(".3gp")) {
	entity.addPart(f.getName(), new FileBody(f, "video/3gpp"););
    }
}
post.setEntity(entity);

// check custom header and response to ensure code is from aggregate, not proxy.
HttpResponse response = client.execute(post);
String location = response.getHeaders("Location")[0].getValue();
int code = response.getStatusLine().getStatusCode();
if (url.contains(location) && code == 201) {
	System.out.println("post successful");
}

OpenRosa MetaData header

Schema for downloading a list of entities

Schema for providing information back about those entities (possibly case XML)

Authorization scheme

Allowable mime type submissions (JR and ODK actually submit in slightly different ways right now, crazy annoying for HQ doing it in python / apache)

Health / usage information of the client app (also known as heartbeats)

Register a new user on the phone.

DataDyne Specification

http://www.datadyne.org/episurveyor/api

Updated