-
Notifications
You must be signed in to change notification settings - Fork 163
Posting To External Site
ukanga edited this page Aug 2, 2012
·
3 revisions
You can now be able to post to an external service as submissions arrive into your formhub.org account. This is possible through two services that can be attached to a form namely JSON POST and and XML POST. You are only required to provide a url which formhub will use to post xml or json data.
- Open the link to the form on your profile page on formhub.org
- Under the Rest Services section, select the JSON POST as the service name
- Type in the url that will process posted json data submissions e.g example.com/json
- Click on "add service" button to add the service to your form
Now for every form submission, there will be a JSON formatted data posted to the link you specified.
An simple example of this endpoint is data consumer implemented using python and cherrypy.
[{
"act_dispensed": "8",
"_uuid": "8948bc11a9b8440da6dfa315d067b557",
"_submission_time": "2012-08-02T12:11:04",
"total_cases": "89",
"period": "2012-03-08",
"act_balance": "89",
"_attachments": [],
"rdt_tested": "8",
"_geolocation": [null, null],
"location": "t6inJWegKEQ",
"_xform_id_string": "dhis2_malaria",
"rdt_positive": "8",
"_status": "submitted_via_web",
"_id": 9,
"suspected_malaria_cases": "8",
"formhub/uuid": "3974t86fgidchjasljbkdh47treigdshkcb"
}]
<?xml version=\'1.0\' ?>
<dhis2_malaria id="dhis2_malaria">
<period>2012-03-08</period>
<total_cases>89</total_cases>
<suspected_malaria_cases>8</suspected_malaria_cases>
<rdt_tested>8</rdt_tested>
<rdt_positive>8</rdt_positive>
<act_dispensed>8</act_dispensed>
<act_balance>89</act_balance>
<location>t6inJWegKEQ</location>
<formhub>
<uuid>3974t86fgidchjasljbkdh47treigdshkcb</uuid>
</formhub>
</dhis2_malaria>