← Back to team overview

dhis2-devs team mailing list archive

Sending large bulks of data values by WebApi

 

I am trying to send datavalues through WebApi on some Yes/No fields.
My script writes an xml file which is read by curl to POST it.  I run
this on the terminal:
---------
curl -d @/tmp/comandos.xml
"http://127.0.0.1:9080/dhis/api/dataValueSets?dryRun=true"; -H
"Content-Type:application/xml" -u orvaquim:Gafanhoto3\!\!\! -vcurl -d
@/tmp/comandos.xml
"http://127.0.0.1:9080/dhis/api/dataValueSets?dryRun=true&importStrategy=new_and_updates";
-H "Content-Type:application/xml" -u orvaquim:password -v
---------

I always get this sympathetic message:
-----
* About to connect() to 127.0.0.1 port 9080 (#0)
*   Trying 127.0.0.1... connected
* Server auth using Basic with user 'orvaquim'
> POST /dhis/api/dataValueSets?dryRun=true HTTP/1.1
> Authorization: Basic b3J2YXF1aW06R2FmYW5ob3RvMyEhIQ==
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: 127.0.0.1:9080
> Accept: */*
> Content-Type:application/xml
> Content-Type:application/xml
> Content-Length: 820299
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
* Added cookie JSESSIONID="07EE661B3FA51FC71870040377C0F670" for
domain 127.0.0.1, path /dhis, expire 0
< Set-Cookie: JSESSIONID=07EE661B3FA51FC71870040377C0F670; Path=/dhis
< Content-Type: application/xml;charset=UTF-8
< Transfer-Encoding: chunked
< Date: Wed, 12 Jun 2013 03:38:56 GMT
<
* Connection #0 to host 127.0.0.1 left intact
* Re-using existing connection! (#0) with host 127.0.0.1
* Connected to 127.0.0.1 (127.0.0.1) port 9080 (#0)
* Server auth using Basic with user 'orvaquim'
> POST /dhis/api/dataValueSets?dryRun=true&importStrategy=new_and_updates HTTP/1.1
> Authorization: Basic b3J2YXF1aW06R2FmYW5ob3RvMyEhIQ==
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: 127.0.0.1:9080
> Accept: */*
> Cookie: JSESSIONID=07EE661B3FA51FC71870040377C0F670
> Content-Type:application/xml
> Content-Type:application/xml
> Content-Length: 820299
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
< Content-Type: application/xml;charset=UTF-8
< Transfer-Encoding: chunked
< Date: Wed, 12 Jun 2013 03:39:00 GMT
<
* Connection #0 to host 127.0.0.1 left intact
* Closing connection #0
<?xml version='1.0' encoding='UTF-8'?><importSummary
xmlns="http://dhis2.org/schema/dxf/2.0";><status>SUCCESS</status><description>Import
process completed successfully</description><dataValueCount
imported="4660" updated="0"
ignored="0"/><dataSetComplete>false</dataSetComplete></importSummary><?xml
version='1.0' encoding='UTF-8'?><importSummary
xmlns="http://dhis2.org/schema/dxf/2.0";><status>SUCCESS</status><description>Import
process completed successfully</description><dataValueCount
imported="4660" updated="0"
ignored="0"/><dataSetComplete>false</dataSetComplete></importSummary>
---------

Which says it is OK. But on the database nothing is there!!!

I have tried this:
<dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0";>
<dataValue dataElement="stfpY6qg9sO" period="2012Q2"
orgUnit="KzhEvYuYMaM" value="Yes"/>
<dataValue dataElement="stfpY6qg9sO" period="2013Q1"
orgUnit="D8qmS3fQGeU" value="Yes"/>
<dataValue dataElement="stfpY6qg9sO" period="2012Q4"
orgUnit="uUfLM2SwMtZ" value="Yes"/>
</dataValueSet>
----

This:
<dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0";>
<dataValue dataElement="stfpY6qg9sO" period="2012Q2"
orgUnit="KzhEvYuYMaM" value="true"/>
<dataValue dataElement="stfpY6qg9sO" period="2013Q1"
orgUnit="D8qmS3fQGeU" value="true"/>
<dataValue dataElement="stfpY6qg9sO" period="2012Q4"
orgUnit="uUfLM2SwMtZ" value="true"/>
</dataValueSet>

----
This too:
<dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0";>
<dataValue dataElement="stfpY6qg9sO" period="2012Q2"
orgUnit="KzhEvYuYMaM" value="1"/>
<dataValue dataElement="stfpY6qg9sO" period="2013Q1"
orgUnit="D8qmS3fQGeU" value="1"/>
<dataValue dataElement="stfpY6qg9sO" period="2012Q4"
orgUnit="uUfLM2SwMtZ" value="1"/>
</dataValueSet>

---
and this too:
<dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0";>
<dataValue dataElement="stfpY6qg9sO" period="2012Q2"
orgUnit="KzhEvYuYMaM"><value>true</value></dataValue>
<dataValue dataElement="stfpY6qg9sO" period="2013Q1"
orgUnit="D8qmS3fQGeU"><value>true</value></dataValue>
<dataValue dataElement="stfpY6qg9sO" period="2012Q4"
orgUnit="uUfLM2SwMtZ"><value>true</value></dataValue>
</dataValueSet>

And always I get the same interesting message and plus this on the logs:
* INFO  2013-06-12 05:38:54,525 importing data values
(DefaultDataValueSetService.java [http-9080-6])
* INFO  2013-06-12 05:38:57,540 Data values set saved [data element id
scheme: null, org unit id scheme: null, dry run: true, strategy: null,
skip check: false] (DataValueSetController.java [http-9080-6])
* INFO  2013-06-12 05:38:57,752 importing data values
(DefaultDataValueSetService.java [http-9080-6])
* INFO  2013-06-12 05:39:00,478 Data values set saved [data element id
scheme: null, org unit id scheme: null, dry run: true, strategy: null,
skip check: false] (DataValueSetController.java [http-9080-6])

But nothing else on the database.

I am using DHIS 2.12 build 11149 on a 64 bit Linux (Ubuntu and CentOS)
server. I have allowed all organisationunities to enter data on the
dataset involving those dataelements.

What it is wrong?

Caveman