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
Param | Type | Description |
---|---|---|
formData | Object | Form 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
Param | Type | Description |
---|---|---|
reportId | String | API name of the report. |
params | Object | Query params, incl: limit, offset, and custom report filters. |
postUrl | String | Url 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
Param | Type | Description |
---|---|---|
formData | Object | Object 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
Param | Type | Description |
---|---|---|
formData | Object | Object including form data. |
params | Object | Request params including case type and external id. |
Example
submitXls(
[
{name: 'Mamadou', phone: '000000'},
],
{
case_type: 'student',
search_field: 'external_id',
create_new_cases: 'on',
}
)