dhis2-users team mailing list archive
-
dhis2-users team
-
Mailing list archive
-
Message #01621
Re: New Organization Units Import
Thank you all for the help. They were quite helpful.
I have tried both database method and cURL Meta-data import.
The database method was successful, using ‘nextval('hibernate_sequence')’ and restart of DHIS2 for UID auto populate.
However, I am still struggling with cURL method.
I have downloaded curl.exe and ran it (in Windows 7).
I keep on getting ‘HTTP Status 405 – Request method ‘POST’ not supported’ error.
Is there something I have to set on DHIS2 or on server for this?
The command I used is –> curl –d @test3.xml “http://107.—.—.—:8080/dhis/api/organizationUnits”; –H “Content-Type:application/xml” –u ---/--- -v
This is for adding a new OrganizationUnit. In this email, I have attached curl error output and test Meta-data xml files.
I have tried variations of the curl commands (removing header parameters, etc) and variations of Meta-data xml file contents(adding/removing UID, ID, etc), but all gave me 405 error.
If it is not about the DHIS2 setup issue, I was wondering if someone can provide me with any success case curl command and Meta-data xml file, so that I can use that was an example to follow.
Thank you in advance for any help.
From: Morten Olav Hansen
Sent: Wednesday, December 05, 2012 10:25 PM
To: ChangJames
Cc: dhis2-users
Subject: Re: [Dhis2-users] New Organization Units Import
That should be "without any ou-levels"
--
Morten
On Wed, Dec 5, 2012 at 4:24 PM, Morten Olav Hansen <mortenoh@xxxxxxxxx> wrote:
Do you have a structure in the data your are importing, or is it a flat list with any ou-levels? I would personally use the DHIS 2 web-api to import the data.
For examples, look at our documentation for meta-data import:
http://dhis2.org/doc/snapshot/en/user/html/ch23s04.html
So you would use something like:
<metaData>
<organisationUnits>
<organisationUnit> .... </organisationUnit>
<organisationUnit> .... </organisationUnit>
<organisationUnit> .... </organisationUnit>
<organisationUnit> .... </organisationUnit>
</organisationUnits>
</metaData>
For examples of the meta-data, have a look at:
http://apps.dhis2.org/demo/api
http://apps.dhis2.org/demo/api/metaData.xml
This can then be pushed into DHIS using your username/password, and a proper content-type (I would personally use cURL for this)
--
Morten
On Wed, Dec 5, 2012 at 4:20 PM, ChangJames <jamesbjchang@xxxxxxxxxxx> wrote:
Hi,
Is there any easy way(/preferred way) to import Organization Units (New ones) on blank DHIS2 system?
I have a list of organization units I like to add to the system, but like to know if there is an alternative to the individual manual add using DHIS UI.
It seems there isn’t import function for this on DHIS, so I took a look at datatable for inserting straight to DB.
But, the ‘OrganizationUnit’ table has ‘UID’ field. How do I generate that? One of my data ‘jII07NoHiO5’ does seem like normal Uniquie Identifier number format.
And is this, adding rows straight to datatable, a OK way of mass importing the Organization Units on DHIS?
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~dhis2-users
More help : https://help.launchpad.net/ListHelp
<?xml version='1.0'?>
<dxf xmlns="http://dhis2.org/schema/dxf/1.0" minorVersion="1.3" exported="2012-12-09">
<organisationUnits>
<organisationUnit>
<id>4001</id>
<uid>Umh4HKqqFp6</uid>
<name>Jembe CHC</name>
<shortName>Jembe CHC</shortName>
<code>OU_578sp</code>
<openingDate>2000-01-01</openingDate>
<closedDate></closedDate>
<active>true</active>
<comment></comment>
<geoCode></geoCode>
<feature type="Point"/>
<lastUpdated>2012-02-17</lastUpdated>
</organisationUnit>
</organisationUnits>
</dxf>
<?xml version='1.0' encoding='UTF-8'?>
<organisationUnits>
<organisationUnit xmlns="http://dhis2.org/schema/dxf/2.0" code="437-Igare3" name="437-Igare3" lastUpdated="2012-11-16" shortName="Igare3">
<active>true</active>
<featureType>Point</featureType>
</organisationUnit>
</organisationUnits>
Attachment:
curl_try1.jpg
Description: JPEG image
Follow ups
References