CommcareFormService

public interface CommcareFormService

A service to perform queries against CommCareHQ form APIs.

Methods

retrieveForm

CommcareForm retrieveForm(String id, String configName)

Retrieves form with the given ID from server represented by the given configuration.

Parameters:
  • id – the ID of the form
  • configName – the name of the configuration used for connecting to the CommcareHQ server, null means default configuration
Returns:

the form with the given ID

retrieveForm

CommcareForm retrieveForm(String id)

Same as retrieveForm but uses default Commcare configuration.

retrieveFormJson

String retrieveFormJson(String id, String configName)

Retrieves form with the given ID from server represented by the given configuration.

Parameters:
  • id – the ID of the form
  • configName – the name of the configuration used for connecting to the CommcareHQ server, null means default configuration
Returns:

the form with the given ID as JSON

retrieveFormJson

String retrieveFormJson(String id)

Same as retrieveFormJson but uses default Commcare configuration.

retrieveFormList

CommcareFormList retrieveFormList(FormListRequest request)

Retrieves a list of forms from Commcare HQ along with metadata. Can be used for browsing through forms.

Parameters:
  • request – the request specifying the details of the query
Returns:

the form list received from Commcare HQ

retrieveFormList

CommcareFormList retrieveFormList(FormListRequest request, String configName)

Retrieves a list of forms from Commcare HQ along with metadata. Can be used for browsing through forms.

Parameters:
  • request – the request specifying the details of the query
  • configName – the name of the configuration used for connecting to the CommcareHQ server, null means default configuration
Returns:

the form list received from Commcare HQ

uploadForm

OpenRosaResponse uploadForm(FormXml formXml, String configName)

Upload form xml wrapped in a minimal xform instance to CommCareHQ.

Parameters:
  • formXml – An object representing the form information to be submitted as form xml
  • configName – the name of the configuration used for connecting to CommcareHQ, null means default configuration
Returns:

an informational object representing the status, nature and message of the response from CommCareHQ when attempting to upload this instance of form xml.

uploadForm

OpenRosaResponse uploadForm(FormXml formXml)

Same as uploadCase but uses default Commcare configuration.