=== modified file 'src/docbkx/en/dhis2_user_man_web_api.xml' --- src/docbkx/en/dhis2_user_man_web_api.xml 2013-06-09 18:31:44 +0000 +++ src/docbkx/en/dhis2_user_man_web_api.xml 2013-06-09 21:26:38 +0000 @@ -297,20 +297,20 @@ role="italic">/api/metaData to give you a filtered view. The use-case we will be looking into here is where you want a nightly job that synchronizes organisation units. We will be using cURL as the HTTP - client.curl -H "Accept: application/xml" -u user:pass "http://apps.dhis2.org/demo/api/metaData?assumeTrue=false&organisationUnits=true&lastUpdated=01/08/2012" + client.curl -H "Accept: application/xml" -u admin:district "http://apps.dhis2.org/demo/api/metaData?assumeTrue=false&organisationUnits=true&lastUpdated=01/08/2012" Example: Get meta-data that was updated since February 2012 This example will just the default assumeTrue setting, along with getting the last updates from February 2012. This means that every single type that has been updated will be - retrieved.curl -H "Accept: application/xml" -u user:pass "http://apps.dhis2.org/demo/api/metaData?lastUpdated=02/2012" + retrieved.curl -H "Accept: application/xml" -u admin:district "http://apps.dhis2.org/demo/api/metaData?lastUpdated=02/2012" The meta-data resource can also be used to write or update meta-data by using the POST HTTP method. The meta-data content can be both XML and JSON, using "application/xml" and "application/json" content type respectively. The request payload content will be accepted in several formats, including plain text, zipped and gzipped. POSTing a meta-data payload can be done for example like this, where metaData.xml is a file in the same directory with the meta-data content: - curl -H "Content-Type: application/xml" -u user:pass -d @metaData.xml "http://apps.dhis2.org/demo/api/metaData" -X POST + curl -H "Content-Type: application/xml" -u admin:district -d @metaData.xml "http://apps.dhis2.org/demo/api/metaData" -X POST
Sending data values @@ -372,8 +372,7 @@ DHIS 2 supports three kinds of events: single events with no registration (also referred to as anonymous events), single event with registration and multiple events with registration. Registration implies that the data is linked to a person which is identified using some sort - of identifier. Currently only single event with no registration is supported in DXF 2 - currently. + of identifier. Only single event with no registration is supported in DXF 2 currently. To send events to DHIS 2 you must interact with the events resource. The approach to sending events is similar to sending aggregate data values. You will need a programId which can be looked @@ -384,7 +383,7 @@ An example payload in XML format where we send events from the "Inpatient morbidity and mortality" program for the "Ngelehun CHC" facility in the demo database can be seen below: - <?xml version='1.0' encoding='utf-8'?> + <?xml version="1.0" encoding="utf-8"?> <event program="eBAyeGv0exc" orgUnit="DiszpKrYNg8" eventDate="2013-05-17" completed="true" storedBy="admin"> <coordinate latitude="59.8" longitude="10.9" /> <dataValues> @@ -396,7 +395,7 @@ To perform some testing we can save the XML payload as a file called events.xml and send it as a POST request to the events resource in the API using curl with the following command: - curl -d @events.xml "localhost:8080/api/events" -H "Content-Type:application/xml" -u admin:district -v + curl -d @events.xml "http://apps.dhis2.org/demo/api/events" -H "Content-Type:application/xml" -u admin:district -v The same payload in JSON format looks like this: { "program": "eBAyeGv0exc", @@ -419,7 +418,7 @@ curl -d @events.xml "localhost:8080/api/events" -H "Content-Type:application/json" -u admin:district -v We also support sending multiple events at the same time. A payload in XML format might look like this: (Caution: this format might change slightly in version 2.13) - <?xml version='1.0' encoding='utf-8'?> + <?xml version="1.0" encoding="utf-8"?> <events> <eventList> <event program="eBAyeGv0exc" orgUnit="DiszpKrYNg8" eventDate="2013-05-17" completed="true" storedBy="admin">