=== modified file 'src/docbkx/en/dhis2_user_man_web_api.xml' --- src/docbkx/en/dhis2_user_man_web_api.xml 2013-05-24 11:54:48 +0000 +++ src/docbkx/en/dhis2_user_man_web_api.xml 2013-05-26 10:10:22 +0000 @@ -344,6 +344,170 @@ In a real-world scenario, looking up identifiers, constructing and dispatching XML messages would be the task of the client software application. This software would probably interact with the more machine-friendly XML and JSON resource representations and not the human-friendly HTML representations like we did in this example. Developing creative and robust consumers of the Web API services begins here.
+ Sending single event no registration data values + DHIS 2 supports 3 kinds of events, single events with no registration (previously called + anonymous), single event with registration, and multiple events with registration. Currently + only single event with no registration is supported in DXF2, support for additional event + types will come later. + The approach to sending events is very similar to sending aggregate data values, you will + need a programId, organisationUnitId, and a list of valid data element IDs. An example payload can + be seen below (in XML and + JSON):<?xml version='1.0' encoding='utf-8'?> +<event programId="nGREQllB95g" organisationUnitId="yFZVWkkk1QL" eventDate="2013-05-17" + completed="true" storedBy="admin"> + <coordinate latitude="59.8" longitude="10.9" /> + <dataValues> + <dataValue dataElementId="WFhjqschUjD" value="2013-05-17" /> + <dataValue dataElementId="QGfmQy0pxFU" value="-100" /> + </dataValues> +</event>{ + "programId": "nGREQllB95g", + "organisationUnitId": "yFZVWkkk1QL", + "eventDate": "2013-05-17", + "completed": true, + "storedBy": "admin", + "coordinate": { + "latitude": "59.8", + "longitude": "10.9" + }, + "dataValues": [ + { "dataElementId": "WFhjqschUjD", "value": "2013-05-17" }, + { "dataElementId": "QGfmQy0pxFU", "value": "-100" } + ] +} + We also support sending multiple events at the same time (be warned that this format might + change for our next + release):<?xml version='1.0' encoding='utf-8'?> +<events> + <eventList> + <event programId="nGREQllB95g" organisationUnitId="yFZVWkkk1QL" eventDate="2013-05-17" + completed="true" storedBy="admin"> + <coordinate latitude="59.8" longitude="10.9" /> + <dataValues> + <dataValue dataElementId="WFhjqschUjD" value="2013-05-17" /> + <dataValue dataElementId="QGfmQy0pxFU" value="-100" /> + </dataValues> + </event> + + <event programId="nGREQllB95g" organisationUnitId="yFZVWkkk1QL" eventDate="2013-05-17" + completed="true" storedBy="admin"> + <coordinate latitude="59.8" longitude="10.9" /> + <dataValues> + <dataValue dataElementId="WFhjqschUjD" value="2013-05-17" /> + <dataValue dataElementId="QGfmQy0pxFU" value="-100" /> + </dataValues> + </event> + </eventList> +</events>{ + "eventList": [ + { + "programId": "nGREQllB95g", + "organisationUnitId": "yFZVWkkk1QL", + "eventDate": "2013-05-17", + "completed": true, + "storedBy": "admin", + "coordinate": { + "latitude": "59.8", + "longitude": "10.9" + }, + "dataValues": [ + { "dataElementId": "WFhjqschUjD", "value": "2013-05-17" }, + { "dataElementId": "QGfmQy0pxFU", "value": "-100" } + ] + }, + { + "programId": "nGREQllB95g", + "organisationUnitId": "yFZVWkkk1QL", + "eventDate": "2013-05-17", + "completed": true, + "storedBy": "admin", + "coordinate": { + "latitude": "59.8", + "longitude": "10.9" + }, + "dataValues": [ + { "dataElementId": "WFhjqschUjD", "value": "2013-05-17" }, + { "dataElementId": "QGfmQy0pxFU", "value": "-100" } + ] + } + ] +} + Most of the elements here should be easy to understand already, but a table can be seen + below that will explain what they all mean. + + + XML/JSON element/key description + + + + + Key + + + Type + + + Required + + + Options (default first) + + + Description + + + + + + programId + string + true + + UID pointing to the single event no registration program + + + organisationUnitId + string + true + + UID pointing to the organisation unit. + + + eventDate + date + true + + The date this event occured. + + + completed + boolean + false + Defaults to true. + Is this event complete or not. + + + storedBy + string + false + Defaults to current user. + Who stored this event (can be username, system-name etc) + + + coordinate + object + false + GPS coordinate where this event occured. + For XML this is an element called coordinate with two attributes (latitude and longitude), + for JSON this is an object with two keys (latitude and longitude) + + + +
+
+
+
Sending data values using SDMX-HD Posting a dataValueSet report formatted using the WHO SDMX-HD standard is very similar to the dxf2 example above. The same api/dataValueSets resource is used, but the client has to