Skip to main content

commcare@1.6.10

Functions​

clientPost(formData)
fetchReportData(reportId, params, postUrl)
submit(formData)
submitXls(formData, params)

clientPost​

clientPost(formData) β‡’ State Performs a post request

Kind: global function

ParamTypeDescription
formDataObjectForm Data with auth params and body

Example

clientPost(formData)

fetchReportData​

fetchReportData(reportId, params, postUrl) β‡’ Operation Make a GET request to CommCare's Reports API and POST the response to somewhere else.

Kind: global function
Access: public

ParamTypeDescription
reportIdStringAPI name of the report.
paramsObjectQuery params, incl: limit, offset, and custom report filters.
postUrlStringUrl to which the response object will be posted.

Example

fetchReportData(reportId, params, postUrl)

submit​

submit(formData) β‡’ Operation Submit form data

Kind: global function
Access: public

ParamTypeDescription
formDataObjectObject including form data.

Example

submit(
fields(
field("@", function(state) {
return {
"xmlns": "http://openrosa.org/formdesigner/form-id-here"
};
}),
field("question1", dataValue("answer1")),
field("question2", "Some answer here.")
)
)

submitXls​

submitXls(formData, params) β‡’ Operation Convert form data to xls then submit.

Kind: global function
Access: public

ParamTypeDescription
formDataObjectObject including form data.
paramsObjectRequest params including case type and external id.

Example

submitXls(
[
{name: 'Mamadou', phone: '000000'},
],
{
case_type: 'student',
search_field: 'external_id',
create_new_cases: 'on',
}
)