Form Autodownload for Client
All forms in OpenSRP for Client apps are maintained on server in form directory in application core resources.
Form Structure:
Each form is composed of three files model.xml, form_definition.json, form.xml in a separate directory named by unique name for form.
Each form has three properties
- formName: The Name/ID specified in xls form by science team. This is also used to link nodes in model.xml and form_definition.json as bind
- formDirName: The name of folder with which developers access form file in enketo. All three files are in this directory
- formDataDefinitionVersion: The version of form to keep track of the form used for data submission
Form Access:
- To access the latest versions for all forms make a call to http://yourserver/form/latest-form-versions. For demo server call to http://46.101.51.199:8080/oweb/form/latest-form-versions
- The output is a json as follows
{"formVersions" : [{"formName": "ANC_Close_EngKan", "formDirName": "anc_close", "formDataDefinitionVersion": "2"},
{"formName": "ANC_Registration_OA_EngKan", "formDirName": "anc_registration_oa", "formDataDefinitionVersion": "4"},
.......,
{"formName": "Child_Vitamin_A_EngKan", "formDirName": "vitamin_a", "formDataDefinitionVersion": "1"}]}
- If you find any formDataDefinitionVersion lesser than the mentioned version, on your client, then
- Download the form by http://yourserver/form/form-files?formDirName=THE_FORM_TO_DOWNLOAD. For demo server call to http://46.101.51.199:8080/oweb/form/form-files?formDirName=THE_FORM_TO_DOWNLOAD . Where formDirName is the form directory name containing form files.
- The response is a zip file with name same as formDirName and containing three files form.xml, model.xml and form_definition.json
This site is no longer maintained. Please visit docs.opensrp.io for current documentation.